consistent padding

master
Aevann 2023-06-26 13:20:17 +03:00
parent 9f7fbbff99
commit 1fb6092b24
1 changed files with 30 additions and 30 deletions

View File

@ -2,37 +2,37 @@ const fireworks = document.getElementsByClassName("firework")
let counter = 0 let counter = 0
for (let firework of fireworks){ for (let firework of fireworks){
const timeout = 2000 * counter const timeout = 2000 * counter
counter++ counter++
setTimeout(() => { setTimeout(() => {
setInterval(() => { 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
let ypos = 95 let ypos = 95
firework.style.top=ypos+"%"
firework.style.left=xpos+"%"
firework.style.display="inline-block"
const hue = Math.floor(Math.random()*360)+1
firework.style.filter="hue-rotate("+hue+"deg)"
let id = null
const height = Math.floor(Math.random()*60)+15
clearInterval(id);
id = setInterval(frame, 20);
const vnum = Math.floor(Math.random()*1000)
function frame() {
if (ypos <= height) {
clearInterval(id);
firework.firstElementChild.src = "/i/firework-explosion.webp?v="+vnum
} else {
ypos--;
firework.style.top=ypos+"%" firework.style.top=ypos+"%"
firework.style.left=xpos+"%"
firework.style.display="inline-block"
const hue = Math.floor(Math.random()*360)+1
firework.style.filter="hue-rotate("+hue+"deg)"
let id = null
const height = Math.floor(Math.random()*60)+15
clearInterval(id);
id = setInterval(frame, 20);
const vnum = Math.floor(Math.random()*1000)
function frame() {
if (ypos <= height) {
clearInterval(id);
firework.firstElementChild.src = "/i/firework-explosion.webp?v="+vnum
} else {
ypos--;
firework.style.top=ypos+"%"
}
} }
} }, 5000)
}, 5000) }, timeout)
}, timeout)
} }