Spin back to default when not touched

This commit is contained in:
bingus_violet 2024-06-11 23:20:57 -05:00
parent 2674b553b2
commit 73a01c9964

View file

@ -60,7 +60,6 @@ function spinLoop() {
document.querySelector(".localSpins").innerHTML = Math.ceil(spins - 1); document.querySelector(".localSpins").innerHTML = Math.ceil(spins - 1);
} }
spins += 1/spinSpeed / 3 spins += 1/spinSpeed / 3
document.querySelector(".pfp").style.rotate = (spins * 360) + "deg"
if (Math.floor(spins) != lastSent && sock && sock.OPEN) { if (Math.floor(spins) != lastSent && sock && sock.OPEN) {
document.querySelector(".globalSpins").innerHTML = globalSpins + 1 document.querySelector(".globalSpins").innerHTML = globalSpins + 1
lastSent = Math.floor(spins) lastSent = Math.floor(spins)
@ -71,7 +70,9 @@ function spinLoop() {
} else { } else {
music.playbackRate = lerp(music.playbackRate, 0.5, 1/spinSpeed) music.playbackRate = lerp(music.playbackRate, 0.5, 1/spinSpeed)
music.volume = lerp(music.volume, 0, 1/spinSpeed * 4) music.volume = lerp(music.volume, 0, 1/spinSpeed * 4)
spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3)
} }
document.querySelector(".pfp").style.rotate = (spins * 360) + "deg"
spinLoop() spinLoop()
}, 1/spinSpeed * 1000); }, 1/spinSpeed * 1000);
} }
@ -110,7 +111,7 @@ window.onload = function () {
spinning = false spinning = false
pfp.style.transition = "all 3s cubic-bezier(0.39, 0.575, 0.565, 1)" // pfp.style.transition = "all 3s cubic-bezier(0.39, 0.575, 0.565, 1)"
pfp.style.scale = "1" pfp.style.scale = "1"
} }