title

deconbatch's Land of 1000 Creative Codings. example codes of Processing / p5.js, how-to articles, generative art images, and much more!

Don't Count the Waves.

Colorful and complex shape waves made with many Perlin noises.
Complex waves made with many Perlin noises.

Description of this video.

Creative coding made with Processing. And I made a movie for YouTube with Kdenlive video editor.

I used many Perlin noises to draw complex wave shapes and colors.
Poisonous, flashy color. It charms me.

Thanks to nice music:
The North by Kevin MacLeod
2014/Nov/19
http://freemusicarchive.org/music/Kevin_MacLeod/Thatched_Villagers/The_North
The North by Kevin MacLeod is licensed under a Attribution 3.0 International License.
Based on a work at incompetech.com
Permissions beyond the scope of this license may be available at http://incompetech.com/music/royalty-free/licenses/ or contact artist via email.

クリエイティブ・コモンズ・ライセンス

Processing example code.

// Don't Count the Waves
// Processing 3.2.1
// 2017.09.17

/* ---------------------------------------------------------------------- */
class Petals {

  int cntWidthMax;
  int divRotate;
  int cntRotateMax;
  float basePetalSize;
  float baseColor;
  float petalBaseFrom, petalBaseTo, petalDivFrom, petalDivTo;

  Petals() {
    divRotate = 8; // divide 360 degree
    cntRotateMax = 30 * 360 * divRotate;  // draw while rotating
    cntWidthMax = 10; // repeat same shape with different ellipse size
    basePetalSize = 500.0;
    baseColor = map(random(1.0), 0.0, 1.0, 210.0, 360.0);
  }

  void drawPetals() {

    for (int cntWidth = 1; cntWidth <= cntWidthMax; ++cntWidth) {

      float noiseHue = noiseHueStart + cntWidth / 300;
      float noiseSat = noiseSatStart;
      float noiseBri = noiseBriStart;
      float noiseAlp = noiseAlpStart;
      float noiseShp = noiseShpStart;
      float sumRotation = 0;

      for (int cntRotate = 0; cntRotate < cntRotateMax; ++cntRotate) {

        // rotate fixed degree and calculate the plot point
        float rotation = 1.0 / divRotate;
        canvasRotation(rotation);
        sumRotation += rotation;
        float idxW = 0.0;
        float idxH = basePetalSize * sin(radians(sumRotation / (50.0 + 5 * cos(radians(2.0 * cntRotate))))) * map(noise(noiseShp), 0.0, 1.0, 0.8, 1.2);;

        float brushHue = (baseColor + 360 + map(noise(noiseHue), 0.0, 1.0, -60.0, 60)) % 360;
        float brushSat = map(noise(noiseSat), 0.0, 1.0, 50.0, 100.0);
        float brushSiz = map(noise(noiseBri), 0.0, 1.0, 0.0, 1.0 * cntWidth);
        float brushBri = map(noise(noiseBri), 0.0, 1.0, 0.0, 100.0) / cntWidth;
        float brushAlp = map(noise(noiseAlp), 0.0, 1.0, 0.0, 100.0);
        drawLine(idxW, idxH, brushHue, brushSat, brushBri, brushAlp, brushSiz);
            
        noiseHue += 0.001;
        noiseSat += 0.003;
        noiseBri += 0.005;
        noiseAlp += 0.005;
        noiseShp += 0.002;

      }

      canvasRotation(-cntRotateMax);

    }

  }

  void drawLine(float idxW, float idxH, float brushHue, float brushSat, float brushBri, float brushAlp, float brushSiz) {
    pushMatrix();
    translate(idxW, idxH);
    fill(brushHue, brushSat, brushBri, brushAlp);
    ellipse(0.0, 0.0, brushSiz, brushSiz);
    popMatrix();
  }
  
  void canvasRotation(float degrees) {
    rotate(radians(degrees));
  }

}

/* ---------------------------------------------------------------------- */
Petals pt;
float noiseShpStart = random(100.0); //random(0.5, 3.0);
float noiseHueStart = random(100.0);
float noiseBriStart = random(100.0);
float noiseAlpStart = random(100.0);
float noiseSatStart = random(100.0);

void setup() {

  size(1080, 1080);
  colorMode(HSB, 360, 100, 100, 100);
  blendMode(SCREEN);
  noiseSeed(0);
  smooth();
  noStroke();
  //  noLoop();
  frameRate(1);

  pt = new Petals();  

}

void draw() {

  background(0, 0, 0);
  translate(width / 2, height / 2);

  pt.drawPetals();

  noiseHueStart += 0.005;
  noiseSatStart += 0.002;
  noiseBriStart -= 0.003;
  noiseAlpStart -= 0.006;
  noiseShpStart += 0.002;
  
  saveFrame("frames/####.png");
  if (frameCount >= 180) {
    exit();
  }
  
}

/*
Copyright (C) 2017- deconbatch

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see 
*/





Colorful and complex shape waves made with many Perlin noises.

Post a Comment

0 Comments