xxxxxxxxxx
70
const fireworks = [];
let gravity;
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB);
gravity = createVector(0, 0.2);
stroke(255);
strokeWeight(4);
background(0);
}
function draw() {
colorMode(HSB);
stroke(255);
strokeWeight(4);
colorMode(RGB);
background(0, 0, 0, 25);
mothersDay(width/2, height/2, 30);
if (random(1) < 0.04) {
fireworks.push(new Firework());
}
for (let i = fireworks.length - 1; i >= 0; i--) {
fireworks[i].update();
fireworks[i].show();
if (fireworks[i].done()) {
fireworks.splice(i, 1);
}
}
}
function mothersDay(x, y, s){
colorMode(HSB);
textAlign(CENTER, CENTER);
textSize(s);
noStroke();
fill(frameCount*0.5 % 360, 255, 255);
push();
translate(x, y);
textSize( abs(cos(frameCount*0.02) * 30) + 20);
rotate( (cos(frameCount*0.05) * 30) * 0.01);
text("Happy Mothers Day!!!", 0, 0);
pop();
}
function clamp(c, cap){
do { c -= cap } while ( c > cap );
return c
}