xxxxxxxxxx
31
var bubbles = []; //empty
function setup() {
createCanvas(400, 400);
for(i = 0; i < 1000; i++){
bubbles[i] = {
x:random(0,width),
y:random(0,height),
display: function(){
ellipse(this.x, this.y, 20,20);
},
move: function(){
this.x = this.x + random(-1,1);
this.y = this.y + random(-1,1);
},
}
}
}
function draw() {
background(220);
for(i=0;i<bubbles.length;i++){
bubbles[i].display();
bubbles[i].move();
}
}