Daily Creative Coding

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

パーリンノイズでマーブル模様

/**
* marble pattern by perlin noise
*
* @author aa_debdeb
* @date 2016/07/24
*/

float noiseX, noiseY;

void setup(){
  size(400, 400);
  noiseX = random(10000);
  noiseY = random(10000);
  stroke(255, 140, 128);
}

void draw(){
  background(255, 250, 205);
  for(int x = 0; x < width; x++){
    for(int y = 0; y < height; y++){
      float n = noise(x * 0.003 + noiseX, y * 0.003 + noiseY, frameCount * 0.004);
      if(int(n * 200) % 2 == 0){
        point(x, y);
      }
    }
  }
}