From c62c3e7a5845d136cf1f605c0b667b8b1baa3786 Mon Sep 17 00:00:00 2001 From: ByteDice Date: Tue, 7 Jan 2025 15:15:03 +0100 Subject: [PATCH] displayed more debugging info --- globalScript.js | 3 +++ pxDensity.js | 15 ++++++++++----- script.js | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/globalScript.js b/globalScript.js index 5f7eab2..f284643 100644 --- a/globalScript.js +++ b/globalScript.js @@ -116,6 +116,9 @@ document.addEventListener("DOMContentLoaded", async function() { calcPixelDensity() console.log("pxDensity: " + getComputedStyle(document.body).getPropertyValue("--pxDensity")) + if (densityWidth > densityHeight) { console.log("pxDensity Direction: Width, " + densityWidth) } + else { console.log("pxDensity Direction: Height, " + densityHeight) } + switch (CURRENT_PAGE) { case (PAGES.SYNTHWAVE): loadingScreenSynthwave() } diff --git a/pxDensity.js b/pxDensity.js index 654630d..e7f394a 100644 --- a/pxDensity.js +++ b/pxDensity.js @@ -1,12 +1,17 @@ let pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity")) let pxDensityDefined = false -function calcPixelDensity() { - let densityWidth = document.documentElement.clientWidth / 256 - let densityHeight = document.documentElement.clientHeight / 164 +let densityWidth = document.documentElement.clientWidth / 256 +let densityHeight = document.documentElement.clientHeight / 164 - document.documentElement.style.setProperty("--pxDensity", Math.max(densityWidth, densityHeight)) - document.documentElement.style.setProperty("--pxDensityPx", `${Math.max(densityWidth, densityHeight)}px`) +function calcPixelDensity() { + densityWidth = document.documentElement.clientWidth / 256 + densityHeight = document.documentElement.clientHeight / 164 + + let widest = Math.max(densityWidth, densityHeight) + + document.documentElement.style.setProperty("--pxDensity", widest) + document.documentElement.style.setProperty("--pxDensityPx", `${widest}px`) pxDensity = parseFloat(getComputedStyle(document.body).getPropertyValue("--pxDensity")) diff --git a/script.js b/script.js index ac024e1..0bc2b52 100644 --- a/script.js +++ b/script.js @@ -5,8 +5,8 @@ function loadingScreenSynthwave() { addStars() setLoadingProgress("Starting synthwave animation...") - //preAnimateSynthwave(25) - //animateSynthwave(0) + preAnimateSynthwave(25) + animateSynthwave(0) }