p5(sketch => {
let x = 0;
let speed = 3;
sketch.setup = function() {
sketch.createCanvas(width, 400);
};
sketch.draw = function() {
sketch.background(0);
sketch.noStroke();
for (let i = 0; i <= sketch.width; i += 50) {
sketch.fill(sketch.random(255), 0, sketch.random(255));
sketch.circle(i + x, sketch.height / 2, 25);
}
if (x >= sketch.width || x < 0) {
speed = speed * -1;
}
x = x + speed;
};
})