xxxxxxxxxx
43
let img= [];
let bubbles =[];
function preload(){
for (var i=0; i< 6; i++){
img[i] = loadImage("flower" +i+".png");
}
}
function setup() {
createCanvas(600, 600);
for(var i = 0; i<6 ;i++){
bubbles [i] = {
x:random(0,width),
y: random (0, height),
display: function (){
//stroke(50,255,100,50);
//strokeWeight(2);
// fill(255,100,250,50);
// ellipse( this.x, this.y, 24,24);
image(img[i],this.x, this.y);
},
move: function (){
this.x= this.x+random(-2,2);
this.y= this.y +random (-2,2);
},
}
}
}
function draw() {
background(55,155,200);
for (i = 0; i< bubbles.length; i++){
bubbles[i].move();
bubbles[i].display();
}
}