xxxxxxxxxx
// Motion using an operator 1
// In this sketch we use a conditional operator to stop the ellipse
// Why does the ball stop at the edge of the canvas?
let x = 0;
function setup() {
background(64, 0, 120);
createCanvas(300, 300);
noFill();
stroke(255);
strokeWeight(2);
}
function draw() {
background(64, 0, 120);
ellipse(x, 150, 100, 100);
if (x < width) {
x = x + 3;
}
}