Daily Creative Coding

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

曼荼羅

/**
* Mandala
*
* @author aa_debdeb
* @date 2016/01/05
*/

void setup(){
  size(500, 500);
  background(64);
}

void draw(){
  if(mousePressed){
    PVector mouse = new PVector(mouseX - width / 2, mouseY - height / 2);
    translate(width / 2, height / 2);
    float diameter = random(20);
    stroke(30, 144, 255);
    strokeWeight(diameter * 0.3);
    fill(32);
    ellipse(mouse.x, mouse.y, diameter, diameter);
    ellipse(-mouse.x, mouse.y, diameter, diameter);
    ellipse(mouse.x, -mouse.y, diameter, diameter);
    ellipse(-mouse.x, -mouse.y, diameter, diameter);
  } 
}