Daily Creative Coding

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

Random Flashing Points

/**
* Random Flashing Points 
* 
* @author aa_debdeb
* @date 2015/08/22
*/

float onRate = 0.7;
float diameter = 70;

void setup(){
  size(500, 500);
  noStroke();
  smooth();
  background(255);
  frameRate(3);
  
}

void draw(){
  background(255);
  
  for(int x = 0; x < 5; x++){
    for(int y = 0; y < 5; y++){
      if(random(1) < onRate){
        drawCircle(x * 100 + 50, y * 100 + 50);
      }
    }
  }
}

void drawCircle(float x, float y){
  fill(0);
  arc(x, y, diameter, diameter, 0, 2*PI);
}