Daily Creative Coding

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

グレイスケールのドット

/**
* grayscale dots
*
* @author aa_debdeb
* @date 2017/01/12
*/

void setup(){
  size(640, 640);
  noStroke();
  mousePressed();
}

void mousePressed(){
  background(200);
  for(int i = 0; i < 2000; i++){
    float x = random(-50, width + 50);
    float y = random(-50, height + 50);
    float gray = map(y, 0, height, 120, 255) + randomGaussian() * map(y, 0, height, 70, 10);
    gray = constrain(gray, 0, 255);
    float alpha = random(10, 50);
    fill(gray, alpha);
    float es = random(30, 100);
    ellipse(x, y, es, es);
  }
  filter(BLUR, 2);
}

void draw(){

}
f:id:aa_debdeb:20170109193722j:plain