xxxxxxxxxx
23
let x = 200;
let xSpeed = 5;
let colorr = 0;
let colorInc = true;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
let colorr = map(x, 0, width, 0, 255);
fill(colorr);
ellipse(x, 200, 30, 30);
x += xSpeed;
if (x >= width || x <= 0) {
xSpeed *= -1;
}
}