xxxxxxxxxx
28
let fireworks = [];
let gravity;
function setup() {
createCanvas(400, 400);
// createCanvas(windowWidth, windowHeight);
gravity = createVector(0,0.2);
// stroke(255);
// strokeWeight(2);
}
function draw() {
background(0,0,0,25);
if(random(1)<0.03){
let r = random(255);
let g = random(255);
let b = random(255);
fireworks.push(new Firework(r,g,b));
}
for(let i=fireworks.length-1;i>=0; i--){
fireworks[i].update();
fireworks[i].show();
if(fireworks[i].done()){
fireworks.splice(i,1);
}
}
// console.log(fireworks.length);
}