better fireowkrs

master
Aevann 2023-07-22 12:57:23 +03:00
parent 0d7283392e
commit 6d0dccc83f
1 changed files with 33 additions and 31 deletions

View File

@ -1,11 +1,4 @@
const fireworks = document.getElementsByClassName("firework") function execute_fireworks(firework) {
let counter = 0
for (let firework of fireworks){
const timeout = 2000 * counter
counter++
setTimeout(() => {
setInterval(() => {
firework.firstElementChild.src = "/i/firework-trail.webp" firework.firstElementChild.src = "/i/firework-trail.webp"
const xpos = Math.floor(Math.random() * 80) + 5 const xpos = Math.floor(Math.random() * 80) + 5
@ -33,6 +26,15 @@ for (let firework of fireworks){
firework.style.top=ypos+"%" firework.style.top=ypos+"%"
} }
} }
}, 7000) }
let counter = 0
for (let firework of document.getElementsByClassName("firework")){
const timeout = 2000 * counter
counter++
setTimeout(() => {
execute_fireworks(firework)
setInterval(execute_fireworks, 5000, firework)
}, timeout) }, timeout)
} }