xxxxxxxxxx
43
function setup() {
createCanvas(400, 400);
pinkBubble= new Pinkie();
blinkBubble= new Blinky();
}
function draw() {
background(220);
pinkBubble.show();
blinkBubble.show();
}
class Blinky{
constructor(){
this.x=random(200,250);
this.y=random(100,150);
this.s= 1;
}
show(){
noStroke();
fill(100,110,100,random(50,100));
ellipse(this.x,this.y,30);
this.x=this.x+this.s*-1;
if(this.x>width||this.x<0){
this.s=this.s*-1;}}
}
class Pinkie{
constructor(){
this.x=random(200,250);
this.y=random(100,150);
this.s= 1;
}
show(){
noStroke();
fill(250,150,150);
ellipse(this.x,this.y,24);
this.x=this.x+this.s;
if(this.x>width||this.x<0){
this.s=this.s*-1;}
}
}