gsap.registerPlugin(ScrollToPlugin); const run=(vars)=>{gsap.killTweensOf(window);gsap.to(window,{duration:2,...vars})}; document.getElementById('to-pixel').addEventListener('click',()=>run({scrollTo:400})); document.getElementById('to-target').addEventListener('click',()=>run({scrollTo:'#someID'})); document.getElementById('to-offset').addEventListener('click',()=>run({scrollTo:{y:'#someID',offsetY:50}})); document.getElementById('to-start').addEventListener('click',()=>run({scrollTo:0})); const update=()=>document.getElementById('scroll-reading').textContent='스크롤 '+Math.round(scrollY)+'px'; const placeMarker=()=>{const map=document.querySelector('.scroll-map');document.querySelector('.pixel-marker').style.top=(400-map.getBoundingClientRect().top-scrollY)+'px';}; new ResizeObserver(placeMarker).observe(document.querySelector('.study'));placeMarker(); addEventListener('scroll',update,{passive:true});update();