xxxxxxxxxx
24
let x;
let xspeed = 1;
let color;
function setup() {
createCanvas(400, 400);
x = width / 2;
}
function draw() {
background(250);
x += xspeed;
if (x <= 0 || x >= width) {
xspeed *= -1;
}
color = map(x, 25, 375, 255, 0);
noStroke();
fill(color);
ellipse(x, height / 2, 100, 100);
}