What problem does it solve?
Web developers building scroll-linked animations often face tricky timing, pinning, scrub sync, and integration issues with custom scrollers; this Skill consolidates ScrollTrigger configuration, patterns, and caveats to produce reliable scroll-driven animations and avoid common mistakes.
Core Features & Use Cases
- Triggered Animations & Timelines: Tie tweens or timelines to scroll ranges with precise start/end control and toggle behaviors for enter/leave events.
- Pinning & Scrubbed Progress: Pin elements during scroll ranges and optionally scrub animation progress to create a 1:1 or eased scroll-driven playback.
- Batching & Performance: Use ScrollTrigger.batch to efficiently reveal groups of elements with staggered animations instead of expensive per-element handlers.
- Scroller Integration & Horizontal Scroll: Integrate third-party smooth scrollers with scrollerProxy and implement fake horizontal scroll patterns via containerAnimation and ease: "none".
- Lifecycle & SPA Safety: Best practices for registering the plugin once, calling ScrollTrigger.refresh after layout changes, and killing triggers on teardown to prevent leaks in single-page apps.
Quick Start
Use gsap-scrolltrigger to implement a pinned section with a scrubbed timeline, ensure gsap.registerPlugin(ScrollTrigger) runs once, and call ScrollTrigger.refresh() after dynamic layout changes.