Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

4つの回転する正方形

/**
* four spining squares
*
* @author aa_debdeb
* @date 2016/08/29
*/

void setup(){
  size(500, 500);
  rectMode(CENTER);
  fill(255, 128, 234);
  stroke(255);
  strokeWeight(20);
}

void draw(){
  background(127, 255, 212);
  translate(width / 2, height / 2);
  for(int i = 0; i < 4; i++){
    float angle = HALF_PI * i + HALF_PI / 2 + frameCount * 0.01;
    pushMatrix();
    translate(100 * cos(angle), 100 * sin(angle));
    rotate(frameCount * 0.04);
    rect(0, 0, 75, 75);
    popMatrix();
  }
}
f:id:aa_debdeb:20160826175244j:plain