xxxxxxxxxx
40
var x;
var y;
var theFill;
var speedX;
var speedY;
function setup() {
createCanvas(400, 400);
x=width/2
y=width/2
theFill = color(random(255),random(255),random(255));
speedX = random(-5,5)
speedY = random(-5,5)
}
function draw() {
background(220);
x = x + speedX
y = y + speedY
textAlign(CENTER)
noStroke()
fill(theFill)
ellipse(x,y,100);
textSize(12)
fill(0);
text("marvelous!",x,y)
textSize(30)
text("🤯",x,y+30)
if(x>width || x<0){
speedX = speedX*-1
theFill = color(random(255),random(255),random(255))
}
if(y>height || y<0){
speedY = speedY*-1
theFill = color(random(255),random(255),random(255))
}
}