Daily Creative Coding

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

おもちゃのキラキラ

/**
* toy twinckle 
* 
* @author aa_debdeb
* @date 2017/01/22
*/

int rectNum = 43;
float rectSize = 10;

color[] colors = {
  color(229, 10, 132),
  color(84, 195, 241),
  color(240, 235, 69),
  color(156, 202, 84),
  color(237, 109, 31),
  color(229, 10, 132),
  color(124, 80, 157),

};

void setup(){
  size(500, 500);
  frameRate(20);
  noStroke();
}

void draw(){
  background(229, 10, 132);
  translate(width / 2, height / 2);
  translate(-rectNum * rectSize / 2, -rectNum * rectSize / 2);
  for(int x = 0; x <rectNum; x++){
    for(int y = 0; y < rectNum; y++){
      int ci;
      fill(colors[(x * y + frameCount) % 7]);
      rect(x * rectSize, y * rectSize, rectSize, rectSize);
    }
  }
}
f:id:aa_debdeb:20170116215527j:plain