generative_noise01

float xstart, xnoise, ynoise;

void setup() {
  size(500, 500);
  smooth();
  background(0);

  float xstart =random(10);
  float xnoise = xstart;
  float ynoise = random(10);

  for (int y = 0; y < height; y+=5 ) {
    ynoise += 0.1;
    xnoise = xstart;
    for (int x = 0; x <= width; x +=5) {
      xnoise += 0.1;
      drawPoint(x, y, noise(xnoise, ynoise));
      drawPoint2(x, y, noise(xnoise, ynoise));
      drawPoint3(x, y, noise(xnoise, ynoise));
    }
  }
}

void drawPoint(float x, float y, float noiseFactor) {
  float len = 10*noiseFactor;
  rect(x, y, len, len);
}

void drawPoint2(float x, float y, float noiseFactor) {
  pushMatrix();
  translate(x, y);
  rotate(noiseFactor * radians(360));
  stroke(0, 150);
  line(0, 0, 20, 0);
  popMatrix();
}

void drawPoint3(float x, float y, float noiseFactor) {
  pushMatrix();
  translate(x, y);
  rotate(noiseFactor*radians(540));
  float edgeSize = noiseFactor*35;
  float grey = 150 + (noiseFactor*120);
  float alpha = 150+(noiseFactor*120);
  noStroke();
  fill(grey, alpha);
  ellipse(0, 0, edgeSize, edgeSize/2);
  popMatrix();
}

教科書にしているGenerative Artの写経.変えたところはvoid drawPointに番号をつけて,写経したすべてのノイズパターンを同時にひょうじしたところ.つまり,単に写経.明日はクリックするたびに1,2,3を切り替えたい.もしくは,教科書の写経を進める.以前よりもrotateがすんなりと受け入れられた.