読者です 読者をやめる 読者になる 読者になる

Daily Creative Coding

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

弧の間隔が変わらない渦

/**
* circular eyes
*
* @author aa_debdeb
* @date 2016/05/02
*/

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

void draw(){
  background(64);
  translate(width / 2, height / 2);
  float radian = 0.0;
  float radious = 10.0;
  while(radious <= width){
    radious += map(mouseX, 0, width, 1, 10);
    float arc = map(mouseY, 0, height, 30, 70); 
    radian += arc / radious;
    fill(220, 20, 60);
    ellipse(radious * cos(radian), radious * sin(radian), arc, arc); 
    fill(255);
    ellipse(radious * cos(radian), radious * sin(radian), arc * 0.66, arc * 0.66); 
    fill(0);
    ellipse(radious * cos(radian), radious * sin(radian), arc * 0.33, arc * 0.33); 
  }
}