xxxxxxxxxx
28
let myArray=[];
function setup() {
createCanvas(400, 400);
for(i=0;i<52;i++){
myArray.push(new Bubble())}
}
function draw() {
background(220);
for(i=0;1<myArray.length;i++){
myArray.move()
myArray.show()}
}
class Bubble{
constructor(){
this.x=random(100,200);
this.y=random(100,200);
this.r=random(10,25);
this.s= random(1,2);
}
move(){
this.x=this.x+this.s;
this.y=this.y+this.s;
}
show(){
ellipse(this.x,this.y,this.r);
}
}