Exercise 43

int num=50, d=100, frames=120;
float theta;

void setup() {
  size(540, 540, P2D);
  blendMode(SCREEN);
  stroke(255);
  noStroke();
  fill(255);
  //noFill();
}

void draw() {
  background(0);
  for (int j=0; j < 3; j++) {
    if (j==0) fill(255, 0, 0);
    if (j==1) fill(0, 255, 0);
    if (j==2) fill(0, 0, 255);
    for (int i=0; i < num; i++) {
      float angle = TWO_PI/num*i;
      float x = width/2 + j*5 + cos(angle)*d;
      float y = height/2 + sin(angle)*d;
      pushMatrix();
      translate(x, y);
      rotate(theta+angle);
      float d2=d*1.5;
      arc(0, 0, d2, d2, 0, radians(5));
      popMatrix();
    }
  }
  theta += TWO_PI/frames;
  // if (frameCount <= frames) saveFrame("frames/image-###.png");
}

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *