// needs mouse drag before anything happens
let bubbles =[];function setup(){
createCanvas(600,400);}function mouseDragged(){
let r = random(10,50);
let b =newBubble(mouseX, mouseY, r);
bubbles.push(b);}function draw(){
background(0);// for .. of way of doing it:for(let bubble of bubbles){
bubble.move();
bubble.show();}/*
// other way of doing it:
for (let i = 0; i < bubbles.length; i++) {
bubbles[i].move();
bubbles[i].show();
}
*/}classBubble{
constructor(x, y, r){this.x = x;this.y = y;this.r = r;}
move(){this.x =this.x + random(-5,5);this.y =this.y + random(-5,5);}
show(){
stroke(255);
strokeWeight(4);
noFill();
ellipse(this.x,this.y,this.r *2);}}