Daily Creative Coding

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

吸い込み口

/**
* intake port
*
* @author aa_debdeb
* @date 2017/01/07
*/

int LOOP = 20;
int ANGLE_NUM = 17;

void setup(){
  size(1000, 1000);
}

void draw(){
  fill(0, 100);
  noStroke();
  rect(0, 0, width, height);
  translate(width / 2, height / 2);
  rotate(-frameCount * 0.01);
  for(int i = 0; i < ANGLE_NUM; i++){
    pushMatrix();
    rotate(TWO_PI / ANGLE_NUM * i);
    int num = 20;
    for(int j = 1; j < num; j++){
      float x = map(j - float(frameCount % LOOP) / LOOP, 0, num, 0, 400);
      float y = map(j - float(frameCount % LOOP) / LOOP, 0, num, 0, 400);
      float alpha = map(j - float(frameCount % LOOP) / LOOP, 0, num, 255, 0);
      float grad = map(j - float(frameCount % LOOP) / LOOP, 0, num, 0, 1);
      stroke(lerpColor(color(100, 255, 255), color(0, 200, 255), grad), alpha);
      line(x, -y, x, y);
    }
    popMatrix();
  }
}
f:id:aa_debdeb:20170101224553j:plain