added beam to fixture

This commit is contained in:
KoenDR06 2025-04-17 22:36:58 +02:00
parent ecb319a41b
commit 918b0d49e8
8 changed files with 61 additions and 37 deletions

View file

@ -1,7 +1,16 @@
function clamp(value, min, max) { return Math.max( min, Math.min(value, max) ); }
const body = document.querySelector('body');
const beams = document.querySelector(".beams");
window.addEventListener("scroll", function(){
const floaters = document.querySelectorAll(".floater");
const yPos = 0 - window.scrollY;
const yPos = window.scrollY / window.innerHeight;
for (const floater of floaters) {
floater.style.top = -yPos/20 + "%";
floater.style.top = yPos*50 + "%";
}
beams.style.opacity = 1-2*yPos;
beams.style.display = 1-2*yPos < 0 ? 'none' : 'block'
});