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