xxxxxxxxxx
26
let x = 0;
let direction = 1;
function setup() {
createCanvas(600,600);
}
function draw() {
background(220);
ellipse(x, height / 2, 20);
x = x + direction;
// if(x > width) {
// direction = -1;
// }
// if(x < 0) {
// direction = 1;
// }
if(x > width || x < 0) {
direction = -direction;
}
}