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
|
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"
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue