2022-07-16 21:00:02 +00:00
|
|
|
const fireworks = document.getElementsByClassName("firework")
|
2022-12-04 15:40:32 +00:00
|
|
|
let counter = 0
|
2022-07-16 21:00:02 +00:00
|
|
|
|
|
|
|
for (let firework of fireworks){
|
2023-06-26 10:20:17 +00:00
|
|
|
const timeout = 2000 * counter
|
|
|
|
counter++
|
|
|
|
setTimeout(() => {
|
|
|
|
setInterval(() => {
|
2023-06-27 21:22:37 +00:00
|
|
|
firework.firstElementChild.src = "/i/firework-trail.webp"
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2023-06-27 21:22:37 +00:00
|
|
|
const xpos = Math.floor(Math.random() * 80) + 5
|
|
|
|
let ypos = 95
|
|
|
|
firework.style.top=ypos+"%"
|
|
|
|
firework.style.left=xpos+"%"
|
2022-09-04 23:15:37 +00:00
|
|
|
|
2023-06-27 21:22:37 +00:00
|
|
|
firework.style.display="inline-block"
|
|
|
|
const hue = Math.floor(Math.random()*360)+1
|
|
|
|
firework.style.filter="hue-rotate("+hue+"deg)"
|
2022-09-04 23:15:37 +00:00
|
|
|
|
2023-06-27 21:22:37 +00:00
|
|
|
let id = null
|
|
|
|
const height = Math.floor(Math.random()*60)+15
|
|
|
|
clearInterval(id);
|
|
|
|
id = setInterval(frame, 20);
|
2022-09-04 23:15:37 +00:00
|
|
|
|
2023-06-27 21:22:37 +00:00
|
|
|
const vnum = Math.floor(Math.random()*1000)
|
2022-09-04 23:15:37 +00:00
|
|
|
|
2023-06-27 21:22:37 +00:00
|
|
|
function frame() {
|
|
|
|
if (ypos <= height) {
|
|
|
|
clearInterval(id);
|
|
|
|
firework.firstElementChild.src = "/i/firework-explosion.webp?v="+vnum
|
|
|
|
} else {
|
|
|
|
ypos--;
|
|
|
|
firework.style.top=ypos+"%"
|
|
|
|
}
|
2023-06-26 10:20:17 +00:00
|
|
|
}
|
2023-06-27 21:22:37 +00:00
|
|
|
}, 7000)
|
2023-06-26 10:20:17 +00:00
|
|
|
}, timeout)
|
2022-12-04 15:40:32 +00:00
|
|
|
}
|