Daily Creative Coding

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

Poping Up Bubbles

/**
* Poping Up Bubbles
*
* @author aa_debdeb
* @date 2015/08/31
*/

int t = 0;

void setup(){
  size(500, 500);
  noStroke();
  smooth();
  background(0);  
  frameRate(60);
}

void draw(){
  fill(0, 5);
  rect(0, 0, width, height);
  if(t == 100){
    popUpBubble();
    t = 0;
  } else {
    t += 1;
  }
}

void popUpBubble(){
  float diameter = random(1) * 200;
  float radious = diameter / 2.0;
  float x = random(width - radious);
  float y = random(height - radious);
  fill(255, 0, 0);
  arc(x, y, diameter, diameter, 0.0, PI*2); 
}