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