xxxxxxxxxx
32
let x = 0;
let y = 25;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(0);
let widinc = 20;
let heiinc = -20;
let wed = 100;
let hei = 200;
while (x <= windowWidth) {
let r = random(255);
let g = 0;
let b = random(255);
fill(r, g, b);
ellipse(x, y, wed, hei);
wed += widinc;
hei += heiinc;
if (wed > 200 || wed < 100) {
widinc *= -1;
}
if (hei < 100 || hei > 200) {
heiinc *= -1;
}
x += 8;
}
y += 2;
x = 0;
}