Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

パーリンノイズを格子状に配置された四角形の大きさで可視化する

/**
* cloud of rect
*
* @author aa_debdeb
* @date 2016/08/23
*/

float step = 5;
PVector offset;

void setup(){
  size(800, 800);
  rectMode(CENTER);
  noStroke();
  fill(0);
  offset = new PVector(random(10000), random(10000), random(10000));
}

void draw(){
  background(255);
  for(int w = 0; w < width; w += step){
    for(int h = 0; h < height; h += step){
      float e = map(noise(w * 0.04 + offset.x + frameCount * 0.07, h * 0.04 + offset.y + frameCount * 0.07, frameCount * 0.02 + offset.z), 0, 1, 0, step);
      rect(w + step / 2, h + step / 2, e, e);   
    }
  }
}
f:id:aa_debdeb:20160818195637j:plain