Minor minify to Milieu script

This commit is contained in:
Korbs 2024-11-04 13:37:42 -05:00
parent 97ee8b20f4
commit 53ac2d61c0

View file

@ -1,4 +1,3 @@
<canvas id="ambient-canvas-1"/>
<canvas id="ambient-canvas-2"/>
@ -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)