Spin counter more consistent
This commit is contained in:
parent
5b5d5887a2
commit
440865f91a
2 changed files with 14 additions and 12 deletions
|
@ -4,19 +4,18 @@ catsOnMars.loop = true
|
|||
|
||||
var spins = 1
|
||||
|
||||
function notif(text) {
|
||||
document.body.innerHTML = "apple"
|
||||
}
|
||||
var spinWaiting = false
|
||||
|
||||
function secondLoop() {
|
||||
function spinLoop() {
|
||||
spinWaiting = true
|
||||
setTimeout(() => {
|
||||
spinWaiting = false
|
||||
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
|
||||
document.querySelector(".spinnyCount").innerHTML = `Violet has spun ${Math.floor(spins)} times!` + pfp.style.animationDuration
|
||||
spinLoop()
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
secondLoop()
|
||||
}, 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"
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
transform: scale(0.9);
|
||||
border-radius: 50%;
|
||||
rotate: 0deg;
|
||||
user-select: none;
|
||||
|
||||
animation-duration: 2s;
|
||||
animation-timing-function: linear;
|
||||
|
|
Loading…
Reference in a new issue