xxxxxxxxxx
38
var drop = [];
var drops = 50;
function setup() {
createCanvas(windowWidth, windowHeight);
noStroke();
fill(112, 182, 234);
for (var i = 0; i < drops; i++) drop[i] = new Drop();
}
function draw() {
background(150,150,170); //clear();
for (var i = 0; i < drops; i++) drop[i].update(); // drop[i].show();
}
function Drop() { // class Drop initial settings
this.x = random(0, width);
this.y = random(0, -height);
this.speed = random(6, 16);
this.update = function() { // falling down
// this.speed = random(5, 15);
// this.gravity = 0.85;
this.y = this.y + this.speed; // * this.gravity;
if (this.y > height) {
this.y = random(0, -height);
// start in next run at different speed ( and size )
this.speed = random(6, 16);
}
// }
// this.show = function() {
ellipse(this.x, this.y, this.speed, 20);
}
}