From f176e7d7735ea03dc2ce13a5dcfe3a5e83ff92d9 Mon Sep 17 00:00:00 2001 From: ION606 Date: Thu, 25 Apr 2024 11:52:19 -0700 Subject: [PATCH] added speedup --- script.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index faaa28f..506e6d2 100644 --- a/script.js +++ b/script.js @@ -73,10 +73,14 @@ function changeBK() { document.body.style.backgroundColor = backgroundColor; } +let animIntId; +let animIntTime = 2000; + + // Animate emotes every second document.addEventListener('DOMContentLoaded', () => { emotes.push(document.querySelector('.NOCLONE')); - setInterval(animateEmotes, 2000); + animIntId = setInterval(animateEmotes, animIntTime); const konamiCode = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a', 'Enter']; let userInput = []; @@ -116,6 +120,15 @@ document.addEventListener('DOMContentLoaded', () => { container.style.opacity = 0; }, 3000); } + else if (event.ctrlKey && event.key === 'a') { + event.preventDefault(); + clearInterval(animIntId); + + animIntTime = (animIntTime <= 500) ? 2000 : animIntTime - 500; + console.debug(animIntTime); + + animIntId = setInterval(animateEmotes, animIntTime); + } }); });