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

View file

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