/* import Lenis from '@studio-freight/lenis' import gsap from 'gsap' import ScrollTrigger from 'gsap/ScrollTrigger' */ gsap.registerPlugin(ScrollTrigger) // Lenis 초기화 const lenis = new Lenis({ duration: 1.5, easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), smooth: true }) // raf 루프 function raf(time) { lenis.raf(time) requestAnimationFrame(raf) } requestAnimationFrame(raf) // Lenis와 ScrollTrigger 연결 lenis.on('scroll', ScrollTrigger.update) ScrollTrigger.scrollerProxy(document.body, { scrollTop(value) { if (arguments.length) { lenis.scrollTo(value) } return window.scrollY }, getBoundingClientRect() { return { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight } }, // pinType은 body의 overflow 방식에 따라 결정 //pinType: 'transform' pinType: document.body.style.transform ? 'transform' : 'fixed' }) // 스크롤 위치가 변했음을 알려줌 ScrollTrigger.addEventListener('refresh', () => lenis.update()) ScrollTrigger.refresh() // 앵커 링크 클릭 시 부드러운 이동 document.querySelectorAll('a[href^="#"]').forEach(link => { link.addEventListener('click', e => { e.preventDefault() const targetId = link.getAttribute('href') const targetEl = document.querySelector(targetId) if (targetEl) { lenis.scrollTo(targetEl, { offset: 0, // 헤더 높이만큼 조절 : -50 duration: 1.2, easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)) }) } }) }) /* // 앵커 링크 클릭 시 부드러운 이동 document.querySelectorAll('.anchor-link').forEach((link) => { link.addEventListener('click', (e) => { e.preventDefault() const targetId = link.getAttribute('href') const targetElement = document.querySelector(targetId) if (targetElement) { lenis.scrollTo(targetElement, { offset: 0, // 원하는 만큼 오프셋 조절 가능 duration: 1.2, // 애니메이션 지속 시간 (초) easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)) // 이징 커스텀 가능 }) } }) }) */