let lenis; document.addEventListener("DOMContentLoaded", () => { gsap.registerPlugin(ScrollTrigger) lenis = new Lenis({ duration: 1.2, easing: t => Math.min(1, 1.001 - Math.pow(2, -10 * t)), smooth: true, smoothTouch: false, }) function raf(time) { lenis.raf(time) requestAnimationFrame(raf) } requestAnimationFrame(raf) lenis.on("scroll", ScrollTrigger.update) ScrollTrigger.scrollerProxy(document.documentElement, { scrollTop(value) { return arguments.length ? lenis.scrollTo(value, { immediate: true }) : window.scrollY }, getBoundingClientRect() { return { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight } }, pinType: "transform" }) ScrollTrigger.refresh() // 앵커 링크 부드럽게 이동 document.querySelectorAll('a[href^="#"]').forEach(link => { link.addEventListener("click", e => { e.preventDefault() const id = link.getAttribute("href") const target = document.querySelector(id) if (target) { lenis.scrollTo(target, { offset: 0, // 필요 시 -헤더 높이만큼 조절 : -50 duration: 1.2, easing: t => Math.min(1, 1.001 - Math.pow(2, -10 * t)) }) } }) }) })