gsap-scrolltrigger

Implements scroll-linked animations, pinning, and scrubbing with the GSAP ScrollTrigger plugin.

Updated May 23, 2026
One-click install
npx skills add https://github.com/Oatse/CWE-Automation --skill gsap-scrolltrigger-oatse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-scrolltrigger
Source: https://github.com/Oatse/CWE-Automation/tree/main/.agents/skills/gsap-scrolltrigger
Command: npx skills add https://github.com/Oatse/CWE-Automation --skill gsap-scrolltrigger-oatse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building scroll-driven animations requires precise control over trigger positions, pinning behavior, and scroll-linked progress, which is error-prone when hand-rolled with scroll listeners or IntersectionObserver. ## Core Features & Use Cases - Scroll-Linked Animations: Tie tweens and timelines to scroll position with start/end triggers, toggleActions, and scrub for progress-linked playback. - Pinning and Parallax: Pin sections during scroll ranges with automatic pin spacing, and build fake horizontal scroll sections using containerAnimation. - Batching and Custom Scrollers: Use ScrollTrigger.batch() for staggered reveal animations and scrollerProxy() to integrate third-party smooth-scroll libraries. - Use Case: Pin a full-viewport section, scrub a timeline as the user scrolls 2000px, and animate inner content horizontally with proper cleanup in a React component. ## Quick Start Ask the AI to create a GSAP ScrollTrigger animation that pins a section and scrubs a timeline as the user scrolls.

Frequently Asked Questions about gsap-scrolltrigger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I trigger a GSAP animation on scroll?

Register the ScrollTrigger plugin with gsap.registerPlugin(ScrollTrigger), then add a scrollTrigger config object to your tween or timeline with trigger, start, and end properties. Use toggleActions for play/reverse behavior or scrub to link progress directly to scroll position.

How to pin a section while scrolling with ScrollTrigger?

Set pin: true in the scrollTrigger config and define an end value like "+=1000" to pin for 1000px of scroll. ScrollTrigger adds pin spacing by default so the layout does not collapse; animate children of the pinned element rather than the pinned element itself.

Should I use scrub or toggleActions in ScrollTrigger?

Use scrub when animation progress should follow scroll position directly, and toggleActions for discrete play/reverse behavior at trigger boundaries. Do not combine both on the same ScrollTrigger; if both are present, scrub wins.

Why is my ScrollTrigger animation out of position after content loads?

Trigger positions are calculated at creation time, so dynamic content, images, or fonts that change layout make them stale. Call ScrollTrigger.refresh() after DOM or layout changes; viewport resize is handled automatically with a 200ms debounce.

Does ScrollTrigger work with React components?

Yes, but ScrollTrigger instances must be cleaned up when components unmount to avoid stale triggers. Use the useGSAP() hook from the @gsap/react package for automatic cleanup, or kill instances manually in a useEffect cleanup function.

How do I integrate ScrollTrigger with a smooth scrolling library?

Use ScrollTrigger.scrollerProxy() to override how ScrollTrigger reads and writes scroll position for your scroller, providing scrollTop getter/setter functions. Then register ScrollTrigger.update as a listener on the third-party scroller so positions stay synchronized.