xxxxxxxxxx
33
let sistem = [];
function setup() {
createCanvas(200, 300);
// createLoop({ duration: 1, gif: true });
}
function draw() {
background(0);
for (let i = 0; i < 5; i++) {
sistem.push({
x: 100,
y: 280,
vx: random(-1, 1),
vy: random(-5, -1),
r: random(5, 20),
providnost: random(0, 255),
zelena: random(50, 150)
});
}
for (let i = sistem.length - 1; i >= 0; i--) {
sistem[i].x += sistem[i].vx;
sistem[i].y += sistem[i].vy;
sistem[i].providnost -= 3.5;
noStroke();
fill(220, sistem[i].zelena, 40, sistem[i].providnost);
ellipse(sistem[i].x, sistem[i].y, sistem[i].r);
if (sistem[i].providnost < 0)
sistem.splice(i, 1);
}
}