xxxxxxxxxx
31
let bubble = [];
function setup() {
createCanvas(400, 400);
// create a for loop to draw 200 bubbles!
for(let i = 0; i < 200; i++){
bubble[i] = new Bubble();
}
}
function draw() {
background(220);
for(let i = 0; i < 200; i++){
bubble[i].show();
}
}
class Bubble{
constructor(){
this.bubbleX = random(width);
this.bubbleY = random(height);
}
show(){
ellipse(this.bubbleX, this.bubbleY, 20, 20);
}
}