random_lines03

void setup() {
  size(500, 500);
  colorMode(HSB, 360, 100, 100, 100);
  background(0, 0, 100);
  strokeWeight(1);
  smooth();
  frameRate(5);
}

void draw() {
  int xstep = 10;
  int ystep = 50;
  float lastx = -999;
  float lasty = -999;
  float ynoise = random(10);
  float ny;

  background(0, 0, 100, 2);
  translate(0, -30);
  stroke(360%frameCount, 80, 90);
  
  for (int y = 0; y<= height; y += xstep) {
    for (int x= 0; x<= width; x += ystep   ) {
      ny = y + noise(ynoise) * 80;
      if (lastx > -999) {
        line(x, ny, lastx, lasty);
      }
      lastx = x;
      lasty = ny;
      ynoise += 0.1;
    }
  }
}

今日もやったことは昨日と同じだけれど,もっと教科書に忠実にした.ウィンドウいっぱいに線を引きたかったので,調整した.思い描いてたことが書けた.今度はこの線を回転させたい.まずは全体を回転させていきたい.

頭のなかで「こうしたら,ああなる」というのがわかったと思って書くと,その通り動かない.難しい.