【Processing】モアレをつくってみる2









モアレ2
反復運動を作った。


void setup() {
  size(500, 500);
}

void draw() {

  translate(width/2, height/2);
  background(250);

  int space = 4;
  for (int i = -250; i <= 250; i += space*2) {
    strokeWeight(space);
    line(i, -250, i, 250);
  }

  pushMatrix();
  translate(cos(radians(frameCount/2))*125,125);
  for (int j = -375; j <= 375; j += space*2) {
    strokeWeight(space);
    line(j, -125, j, 125);
  }
  popMatrix();
  
  pushMatrix();  
  translate(cos(radians(frameCount/3))*125, 0);
  for (int k = -125; k <= 125; k += space*2) {
    strokeWeight(space);
    line(k, -250, k, 250);
  }
  popMatrix();
}