rotate_rects04

int x = 0;
int y = 0;
float d = 1;

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


void draw(){
  fill(0, 0, 100, 60);
  rect(0, 0, width, height);
  
  pushMatrix();
  translate(x, y);
  rotate(frameCount);
  fill(frameCount%360, 80, 80);
  rect(0, 0, 100, 100);
  popMatrix();
  
  pushMatrix();
  translate(x, 500-y);
  rotate(frameCount);
  rect(0, 0, 100, 100);
  popMatrix();
  
  x += 1*d;
  y += 1*d;
  
  if ( x > width){
   
    x = 0;
    y = 0;
    
    d = d + 1;
  }
}

「雰囲気」で書いてみたと言えるかもしれない.最小限のことを書いて,ひとつ上手く行ったら,別の方向を足してみた.その追加のときに,だいたいこんな感じかなと思って書いてみると,上手く動いたから「雰囲気」という感じです.