xxxxxxxxxx
48
let x = 50,
y = 100;
let xspeed = 5;
let yspeed = 3;
let circles;
let R;
let G;
let B;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
x = x + xspeed;
y = y + yspeed;
if (x > 350) {
xspeed = random(-5,-10);
fill(R, G, B);
circles = random (80,120)
}
if (x < 50) {
xspeed = random(5,10);
fill(R, G, B);
circles = random (80,120)
}
if (y < 50) {
yspeed = random(3,6);
fill(R, G, B);
circles = random (80,120)
}
if (y > 350) {
yspeed = random(-3,-6);
fill(R, G, B);
circles = random (80,120)
}
R = random(255);
G = random(255);
B = random(255);
//fill(R,G,B)
circle(x, y, circles);
}