xxxxxxxxxx
25
let bubbles = [];
let numBubbles = 100;
let gravity;
function setup() {
createCanvas(1000, 1000);
rectMode(CENTER);
for (let i=0; i < numBubbles; i++) {
bubbles.push(new Bubble(random(0, width), random(0, height)));
}
gravity = createVector(0, 0.1);
}
function draw() {
background(180, 200, 350);
for (let i = 1; i < numBubbles; i++) {
bubbles[i].applyForce(gravity);
bubbles[i].update();
bubbles[i].display();
}
}