xxxxxxxxxx
30
let bgColor = 255;
X = 0
let speed = 3
function setup() {
createCanvas(400, 400);
}
function draw() {
background(bgColor);
if (mouseIsPressed == true && mouseX < width/2){
//print(mouseX + " " + mouseY);
bgColor = 0;
} else if (mouseIsPressed == true && mouseX >= width/2){
bgColor = 255;
} else {
bgColor = 127;
stroke(25);
strokeWeight(1);
fill(255);
ellipse(X, 200, 100, 100);
if (X > width)
speed = -3;
X = X + speed;
}
}