Bring back old spinning

This commit is contained in:
bingus_violet 2024-06-20 23:34:24 -05:00
parent f3bf26b572
commit 9c6dff4bea

View file

@ -39,6 +39,7 @@ if (teto) {
} }
music.loop = true music.loop = true
music.preservesPitch = false
var sock var sock
@ -65,16 +66,15 @@ function spinLoop() {
setTimeout(() => { setTimeout(() => {
spinWaiting = false spinWaiting = false
if (spinning) { if (spinning) {
music.volume = 0.5 // music.volume = 0.5
if (music.currentTime > 6.5 && teto) { if (music.currentTime > 6.5 && teto) {
spinFactor = 0.25 spinFactor = 0.25
} else { } else {
spinFactor = 3 spinFactor = 3
} }
// music.playbackRate = lerp(music.playbackRate, 1, 1/spinSpeed) if (!teto) {
if (spins > 1) { music.playbackRate = lerp(music.playbackRate, 1, 1/spinSpeed)
document.querySelector(".spinnyCount").style.display = "block" music.volume = lerp(music.volume, 0.5, 1/spinSpeed)
document.querySelector(".localSpins").innerHTML = Math.ceil(spins - 1);
} }
spins += 1/spinSpeed / spinFactor spins += 1/spinSpeed / spinFactor
if (Math.floor(spins) != lastSent && sock && sock.OPEN) { if (Math.floor(spins) != lastSent && sock && sock.OPEN) {
@ -82,12 +82,20 @@ function spinLoop() {
lastSent = Math.floor(spins) lastSent = Math.floor(spins)
// resetPFP() // resetPFP()
sock.send(`{"op": 4}`) sock.send(`{"op": 4}`)
console.log("Spin Sent!") if (spins > 1) {
document.querySelector(".spinnyCount").style.display = "block"
document.querySelector(".localSpins").innerHTML = lastSent;
}
} }
} else { } else {
// music.playbackRate = lerp(music.playbackRate, 0.5, 1/spinSpeed) if (!teto) {
music.playbackRate = lerp(music.playbackRate, 0.5, 1/spinSpeed)
music.volume = lerp(music.volume, -0, 3/spinSpeed)
} else {
music.pause() music.pause()
music.currentTime = 1.5 music.currentTime = 1.5
}
spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3) spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3)
} }
document.querySelector(".pfp").style.rotate = (spins * 360) + "deg" document.querySelector(".pfp").style.rotate = (spins * 360) + "deg"