Spin counter more consistent

This commit is contained in:
bingus_violet 2024-04-20 12:24:46 -05:00
parent 5b5d5887a2
commit 440865f91a
2 changed files with 14 additions and 12 deletions

View file

@ -4,19 +4,18 @@ catsOnMars.loop = true
var spins = 1 var spins = 1
function notif(text) { var spinWaiting = false
document.body.innerHTML = "apple"
}
function secondLoop() { function spinLoop() {
spinWaiting = true
setTimeout(() => {
spinWaiting = false
var pfp = document.querySelector(".pfp") var pfp = document.querySelector(".pfp")
if (!catsOnMars.paused) { if (!catsOnMars.paused) {
spins += 0.5 spins += 0.5
document.querySelector(".spinnyCount").innerHTML = `You have spun Violet ${Math.floor(spins)} times!` + pfp.style.animationDuration document.querySelector(".spinnyCount").innerHTML = `Violet has spun ${Math.floor(spins)} times!` + pfp.style.animationDuration
spinLoop()
} }
setTimeout(() => {
secondLoop()
}, 1000); }, 1000);
} }
@ -26,11 +25,13 @@ window.onbeforeunload = function () {
window.onload = function () { window.onload = function () {
window.scrollTo(0, 0); window.scrollTo(0, 0);
secondLoop()
var pfp = document.querySelector(".pfp") var pfp = document.querySelector(".pfp")
pfp.addEventListener("mousedown", () => { pfp.addEventListener("mousedown", () => {
if (!spinWaiting) {
spinLoop();
}
catsOnMars.play() catsOnMars.play()
pfp.style.animationName = "spinny" pfp.style.animationName = "spinny"

View file

@ -54,6 +54,7 @@
transform: scale(0.9); transform: scale(0.9);
border-radius: 50%; border-radius: 50%;
rotate: 0deg; rotate: 0deg;
user-select: none;
animation-duration: 2s; animation-duration: 2s;
animation-timing-function: linear; animation-timing-function: linear;