only check every second for timer updates

This commit is contained in:
bingus_violet 2024-06-29 18:54:27 -05:00
parent a530774d36
commit 7f8fdb6b7c

View file

@ -86,7 +86,7 @@ function timeFormatter(seconds) {
}
}
function loop() {
function spinLoop() {
spinWaiting = true
setTimeout(() => {
spinWaiting = false
@ -125,7 +125,11 @@ function loop() {
spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3)
}
$(".pfp").css("rotate", (spins * 360) + "deg")
spinLoop()
}, 1/spinSpeed * 1000);
}
function secondLoop() {
$(".durationBarFormatter").each((_, item) => {
item = $(item)
item.text(`${timeFormatter((Date.now() - item.attr("data-start")))}/${timeFormatter((item.attr("data-end") - item.attr("data-start")))}`)
@ -141,8 +145,9 @@ function loop() {
item.text(timeFormatter((item.attr("data-end") - Date.now())))
})
loop()
}, 1/spinSpeed * 1000);
setTimeout(() => {
secondLoop()
}, 1000);
}
window.onbeforeunload = function () {
@ -154,7 +159,8 @@ window.onload = function () {
pfp = $(".pfp")
loop()
spinLoop()
secondLoop()
pfp.on("mousedown", () => {
// if (!spinWaiting) {