diff --git a/src/Milieu.astro b/src/Milieu.astro index 9546e08..08f6dad 100644 --- a/src/Milieu.astro +++ b/src/Milieu.astro @@ -1,4 +1,3 @@ - @@ -48,7 +47,7 @@ const drawFrame = () => { transitionToEvenCanvas() } oddFrame = !oddFrame -}; +} const transitionToOddCanvas = () => { oddCanvas.style.opacity = canvasOpacity @@ -60,26 +59,16 @@ const transitionToEvenCanvas = () => { oddCanvas.style.opacity = "0" } -const drawStart = () => { - intervalId = window.setInterval(drawFrame, frameIntervalMs) -} +const drawStart = () => {intervalId = window.setInterval(drawFrame, frameIntervalMs)} -const drawPause = () => { - if (intervalId) window.clearInterval(intervalId) -} +const drawPause = () => {if (intervalId) window.clearInterval(intervalId)} -const init = () => { - - //fixes a issue where firefox/chromium fails to load the ambinet mode and doesnt load it. - please dont remove this line lmao - - AMvideo.pause();AMvideo.play(); - - // DO NOT REMOVE - +const init = () => { + AMvideo.pause() + AMvideo.play() AMvideo.addEventListener("play", drawStart, false) AMvideo.addEventListener("pause", drawPause, false) AMvideo.addEventListener("ended", drawPause, false) - oddCanvas.style.transition = evenCanvas.style.transition = `opacity ${frameIntervalMs}ms` } @@ -87,7 +76,7 @@ const cleanup = () => { AMvideo.removeEventListener("play", drawStart) AMvideo.removeEventListener("pause", drawPause) AMvideo.removeEventListener("ended", drawPause) - drawPause(); + drawPause() } window.addEventListener("load", init)