日常の進捗

主に自分のための,行為とその習慣化の記録

風景とプログラミング

波の動き、涼しげに。

float step = 30;
float offset = 30;
// setup関数 : 初回1度だけ実行される
void setup() {
  size(960, 540); // ウィンドウサイズを960px,540pxに
  colorMode(HSB, 360, 100, 100); // HSBでの色指定にする
}
// draw関数 : setup関数実行後繰り返し実行される
void draw() {
  randomSeed(1);
  fill(0, 0, 100, 40);
  for (float y = -offset; y <= height+offset; y = y + map(y,-offset,height+offset,step*2,step/2)) {
    stroke(0, 0, 100);
    strokeWeight(3);
    fill(random(160, 230), random(80, 100), random(80, 100), random(50, 100));
    beginShape();
    for (float x = -offset; x <= width+offset; x = x + step) {
      float n = noise(y*0.1, x*0.001, (y+frameCount)*0.005);
      n = map(n, 0, 1, -height/3, height/3);
      float y2 = y + n;
      vertex(x, y2);
    }
    vertex(width+offset, height+offset);
    vertex(-offset, height+offset);
    endShape(CLOSE);
  }
}