Daily Creative Coding

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

四角形の輪

/**
* circle of rectangles
*
* @author aa_debdeb
* @date 2016/04/09
*/

void setup(){
  size(500, 500);
  fill(255, 50);
  stroke(255);
  strokeWeight(1);
  rectMode(CENTER);
}

void draw(){
  background(0);
  translate(width / 2, height / 2);
  rotate(frameCount * 0.03);
  float size = map(sin(frameCount * 0.01), -1, 1, 3, 100);
  for(float angle = 0; angle < 360; angle += 5){
    float radian = radians(angle);
    rect(100 * cos(radian), 100 * sin(radian), size, size);
  }
}