added beam to fixture
This commit is contained in:
parent
ecb319a41b
commit
918b0d49e8
8 changed files with 61 additions and 37 deletions
|
|
@ -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'
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue