rotate_rects01

int x = 0;
int y = 0;

void setup() {
  size(500, 500);
  colorMode(HSB, 360, 100, 100);
  smooth();
  rectMode(CENTER);
  noStroke();
  background(0, 0, 0);
}

void draw() {
  fill(68, frameCount%100, 100); 

  rect(x, y, 10, 10);
  rect(x, height-y, 10, 10);

  pushMatrix();
  translate(width/2, y);
  rotate(PI/4.0);
  rect(0, 0, 10, 10);
  popMatrix();

  pushMatrix();
  translate(x, height/2);
  rotate(PI/4.0);
  rect(0, 0, 10, 10);
  popMatrix();

  x = x + 10;
  y = y + 10;
}

ユニオンジャックを描いてみた.縦と横の線もギザギザにするところが,とても苦労した.高尾さんにrotateについて教えてもらって,やっとできた.このとき,rotateのことを少しだけ理解できたような気がした.