Agent skill Web motion
GSAP ScrollTrigger
Build scroll-linked effects and pinned sections with official guidance for GSAP ScrollTrigger.
Install the skill
Run the command from your project root with Node.js and npm.
npx skills@latest add greensock/gsap-skills --skill gsap-scrolltrigger --agent claude-code --yesCheck this file in your project.claude/skills/gsap-scrolltrigger/SKILL.md
Other ways to install
Choose an assistant interactively
npx skills@latest add greensock/gsap-skills --skill gsap-scrolltriggerSelect your assistant and choose the project installation scope.
Official instructions
The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Open a frontend project in a coding assistant that can load the Skill. The examples use the separate gsap package, ScrollTrigger registration, and GSAP 3.11+ for gsap.matchMedia().
View operation manualWhat this skill helps with
- Set start and end positions for scroll-triggered animation.
- Use pinning or tie the animation progress to scroll position.
- Refresh measurements and clean up triggers when the layout changes.
Good for
- Scroll-driven product tours
- Parallax and pinned storytelling
- Publisher
- GreenSock, with the ScrollTrigger plugin documentation.
- Inputs
- The page and elements, actual scrolling container, motion range, and small-screen layout.
- Controls
- Use scrub for scroll-linked progress and toggleActions for discrete playback.
- Deliverable
- A local preview with measured trigger boundaries and component-level cleanup.
- Skill name
gsap-scrolltrigger- Repository
greensock/gsap-skills
Define the two scroll boundaries
An open-ended request
Add scroll animation to the product page.
The assistant has to guess where the animation starts, which content follows scrolling, and whether pinning fits the available space.
A measured scroll range
- Specify the start and end from the section and viewport edges.
- Pin the visual frame and animate an element inside it.
- Keep the content in reading order at phone width and with reduced motion.
GSAP ScrollTrigger operation manual
Build a desktop product tour that follows the scroll position, or add a one-time entrance to an existing case-study card.
Keep a product preview in view while three real steps scroll beside it on wide screens.
Find the section, frame, and scroller
Measure the actual section and distinguish the element that stays in place from the content that moves.
Prompt · Step 1Use GreenSock’s gsap-scrolltrigger Skill to plan a three-step tour on my existing product page. Locate the section, three step descriptions, product preview, and actual scrolling element. On a wide viewport, use the section as trigger and identify a separate frame to pin. Check whether the section has enough scroll distance for start: 'top top' and end: 'bottom bottom'. If those boundaries do not fit the layout, propose alternatives and explain where each lands. Show the three steps in ordinary reading order on phones and when reduced motion is enabled. Return the targets, scroll range, and fallback before editing.Drive one timeline with scroll
Register ScrollTrigger in client-side code, tie a top-level timeline to the scroller, and scope it to the section.
Prompt · Step 2Use gsap-scrolltrigger to implement the approved tour. Register ScrollTrigger once in the project’s GSAP setup. Use one top-level timeline with scrollTrigger, the agreed trigger and positions, pin set to the frame, and scrub: true so the playhead follows the scroll position directly. Animate the preview inside the frame. Keep the step text readable as it scrolls, and keep the product link outside the animated visual state. Activate this timeline only when the chosen breakpoint and prefers-reduced-motion: no-preference both match, using gsap.matchMedia(). Revert the matchMedia instance during component teardown. If an asset or expanded section changes the measured layout after setup, run ScrollTrigger.refresh() after that change settles. Return the edited files and the local preview route.Verify both scroll directions and cleanup
Check the pin start and release, resize into the normal layout, and check the next section.
- Each preview state can be reached in both scroll directions.
- Phone and reduced-motion layouts retain all steps and links.
- The pin releases and route changes clean up its spacer.
Prompt · Step 3Use gsap-scrolltrigger to verify the tour in the running browser. Scroll down and back up through all three steps. Check that the preview reaches each agreed state, the pinned frame releases at the boundary, and the next section stays reachable without an extra gap. Use markers only for local diagnosis. Switch across the breakpoint and enable reduced motion. Verify the instructions and links stay available and the frame is unpinned. Navigate away and return to check that the section has only one trigger and no stale spacer. List exactly which checks you ran.
Look up a scroll behavior
Name the affected section and the start, end, or direction where you observe a problem.
The animation should move backward with scrollingProgress
- Command or reference
scrub- Examples
- Set scrub: true for direct tracking. A number adds that many seconds for the playhead to catch up.
The pinned graphic jumpsPinning
- Command or reference
pin and pinSpacing- Examples
- Check the spacer, pin a stable wrapper, and animate a child. Inspect the real scrolling container and its layout.
The entry position changes when content loadsMeasurement
- Command or reference
ScrollTrigger.refresh()- Examples
- Refresh after a verified layout change once its new dimensions are available.
ScrollTrigger troubleshooting
Why did a tween inside my timeline lose sync?
Give the top-level timeline one ScrollTrigger. Its playhead already controls the children, so arrange each child at the appropriate time within that timeline.
Can I turn off pinning on a phone?
Create the trigger in a wide-screen gsap.matchMedia() branch and keep the default layout in normal flow. GSAP reverts the animations created in that branch when it stops matching.
When should I refresh the trigger measurements?
ScrollTrigger recalculates on resize by default. Call ScrollTrigger.refresh() after an additional layout change such as a late-loading asset or expanded accordion. Check markers in development to see the recalculated points.