diff --git a/globalScript.js b/globalScript.js index a6bce67..d9a5773 100644 --- a/globalScript.js +++ b/globalScript.js @@ -135,11 +135,23 @@ window.addEventListener("resize", () => { calcPixelDensity() switch (CURRENT_PAGE) { - case (PAGES.SYNTHWAVE): onResizeSynthWave() + case (PAGES.SYNTHWAVE): onResizeSynthwave() } if (gridVisible) { toggleGrid() toggleGrid() } -}) \ No newline at end of file +}) + +let prevAnimationState = isAnimating + +document.addEventListener("visibilitychange", function (event) { + if (document.hidden) { + prevAnimationState = isAnimating + isAnimating = false + } + else { + isAnimating = prevAnimationState + } +}); \ No newline at end of file diff --git a/loadingScreen.js b/loadingScreen.js index 6ee87ef..622dfc1 100644 --- a/loadingScreen.js +++ b/loadingScreen.js @@ -49,6 +49,7 @@ function removeLoadingScreen() { setTimeout(function() { loadingScreenEl.style.left = "100vw" + loadingScreenEl.style.pointerEvents = "none" document.getElementById("loadingCornerText").remove() newTip() }, fadeOutDur * 1000) diff --git a/screenTransition.js b/screenTransition.js index 8fb4249..d359251 100644 --- a/screenTransition.js +++ b/screenTransition.js @@ -8,6 +8,7 @@ function slideTransition(url) { let mainDiv = document.getElementById("mainDiv") loadingScreen.style.animation = slideLeft + loadingScreen.style.pointerEvents = "auto" mainDiv.style.animation = slideLeft setLoadingProgress(`Loading URL "${url}"`) diff --git a/script.js b/script.js index 014b4e1..0bc2b52 100644 --- a/script.js +++ b/script.js @@ -3,6 +3,10 @@ CURRENT_PAGE = PAGES.SYNTHWAVE function loadingScreenSynthwave() { setLoadingProgress("Adding stars...") addStars() + + setLoadingProgress("Starting synthwave animation...") + preAnimateSynthwave(25) + animateSynthwave(0) }