Setup & Installation
What This Skill Does
ScrollTrigger is a GSAP plugin that links animations to scroll position. It handles triggering tweens and timelines on scroll, pinning elements in place, scrubbing animation progress to scroll distance, and batching scroll-based callbacks for multiple elements.
ScrollTrigger handles pin spacing, scroll position math, refresh-on-resize, and cleanup automatically, removing the manual IntersectionObserver and scroll event bookkeeping that custom implementations require.
When to use it
- Pinning a hero section while inner content animates on scroll
- Scrubbing a timeline so animation progress tracks exact scroll distance
- Triggering staggered card reveals as they enter the viewport
- Building fake horizontal scroll sections with vertical scroll input
- Syncing GSAP with third-party smooth-scroll libraries via scrollerProxy