Daily Creative Coding

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

重なり、離れていく円

/**
* color rotars
* 
* @auhtor aa_debdeb
* @date 2016/11/22
*/

int X =10;
int Y = 10;
float step = 50;

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

void draw(){
  background(0, 0, 100);
  for(int x = 0; x <= X; x++){
    for(int y = 0; y <=Y; y++){
      pushMatrix();
      translate(x * step, y * step);
      color[] colors = {color(30, 100, 100),
                        color(120, 100, 100),
                        color(210, 100, 100),
                        color(300, 100, 100)};
      for(int i = 0; i < 4; i++){
        fill(colors[i], 200);
        if((x + y) % 2 == 0){
        ellipse(step / 2 * cos(frameCount * 0.01 + HALF_PI * i), step / 2 * sin(frameCount * 0.01 + HALF_PI * i), 15, 15);  
        }else {
        ellipse(step / 2 * cos(-frameCount * 0.01 + HALF_PI * i), step / 2 * sin(-frameCount * 0.01 + HALF_PI * i), 15, 15);  
        
        }
      }
      popMatrix();
    }
  }
}
f:id:aa_debdeb:20161116072003j:plain