xxxxxxxxxx
18
function setup() {
createCanvas(windowWidth, windowHeight);
}
let xPos = 0;
let xVel = 4;
function draw() {
background(220, 20, 120);
ellipse(xPos, height / 2, 50);
xPos = xPos + xVel;
if (xPos > width) {
xVel = -4;
} else if (xPos < 0) {
xVel = 4;
}
}