const scrollEl = document.documentElement
let scrollPos
functionanimation(){// check the scroll position has changedif(scrollPos !== scrollEl.scrollTop){// reset the seen scroll position
scrollPos = scrollEl.scrollTop
// update css property --scrollPos with scroll position in pixels
scrollEl.style.setProperty('--scrollPos', scrollPos +'px')}
window.requestAnimationFrame(animation)}
window.requestAnimationFrame(animation)
<divclass="landscape"role="img"aria-label="Equivalent to an img alt attribute"><divclass="layer"style="--offset:0.04">...</div><divclass="layer"style="--offset:0.08">...</div><divclass="layer"style="--offset:0.1">...</div><divclass="layer"style="--offset:0.14">...</div><divclass="layer"style="--offset:0.17">...</div><divclass="layer"style="--offset:0.2">...</div><divclass="layer"style="--offset:0.25">...</div><divclass="layer"style="--offset:0.6">...</div><divclass="layer"style="--offset:0.8">...</div><divclass="layer"style="--offset:1">...</div></div>