Agent skill Web motion
GSAP React
Design, implement or review motion on the web.
Install the skill
Run the command from your project root with Node.js and npm.
npx skills@latest add nexu-io/open-design --skill gsap-react --agent claude-code --yesCheck this file in your project.claude/skills/gsap-react/SKILL.md
Other ways to install
Choose an assistant interactively
npx skills@latest add nexu-io/open-design --skill gsap-reactSelect your assistant and choose the project installation scope.
Official instructions
The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. The Open Design and GreenSock editions use the same installed Skill directory. Check the source and the edition your project needs if the name is already present. Use a React project with gsap and @gsap/react available. Run animation setup after DOM targets mount, in a Client Component when the app uses the Next.js App Router.
View operation manualWhat this skill helps with
- Design, implement or review motion on the web.
Good for
- Web motion and transitions
- Current edition
- The GreenSock workflow curated by Open Design.
- Upstream publisher
- GreenSock, with the official React integration.
- Scope
- A container ref scopes selector text to one component instance.
- Lifecycle
- Use useGSAP, deliberate dependencies, and contextSafe for tweens created after setup.
- Evidence
- A preview that survives re-render, unmount, and a second instance on the same page.
- Skill name
gsap-react- Repository
nexu-io/open-design
Give each component ownership of its animation
Unscoped setup
Animate .card from the page and replay it every time the component renders.
One selector can reach sibling components, while repeated setup can accumulate tweens or leave inline styles behind.
A scoped lifecycle
- Give the repeating component a root ref.
- Choose the data change that warrants rebuilding the animation.
- Check the effects of update, unmount, and a click-triggered tween.
GSAP React operation manual
Scope a filterable collection’s animation, then add interactive feedback whose GSAP work cleans up with its component.
Make the cards in an updated collection settle into place and leave neighboring collections alone.
Identify the instance and change to watch
Locate the repeated grid and the stable value representing its visible collection.
Prompt · Step 1Use the Open Design edition of the gsap-react Skill to plan an entrance for my existing filterable card collection. Find the reusable component, its React or Next.js rendering boundary, where the visible items are decided, and whether a second copy exists on the page. Name the root ref and a stable selected-filter or collection key that signals a new set of items. Keep cards and links visible in the default HTML, and define the reduced-motion state. Share the plan before editing.Scope setup and rebuild on the intended change
Use the collection root to target descendants, and revert the old tween when the selected collection changes.
Prompt · Step 2Use gsap-react to implement the agreed collection entrance. Import useGSAP from @gsap/react and register it with gsap once in the client animation setup. Scope the hook to the collection root and target only the decorative card content with a short y-offset. Use the stable collection key in dependencies and set revertOnUpdate: true so the old animation is reverted before setup runs on the new set. Keep unchanged renders from replaying the entrance. Follow prefers-reduced-motion using the project’s existing helper or gsap.matchMedia() with teardown. Give me the changed files and preview route.Verify two instances and repeated updates
Change one filter several times and confirm its sibling component stays still.
- Only the affected collection moves.
- An unrelated render does not replay motion.
- Rapid changes and unmount leave no stale instances or styles.
Prompt · Step 3Use gsap-react to check the collection in the local browser. With two instances visible, change only the first filter, then switch it twice rapidly. Check that the second instance stays unchanged and that old cards leave no unexpected transform styles behind. Cause an unrelated rerender and confirm the effect does not replay. Navigate away during a tween and return. Check the development Strict Mode behavior if enabled and the no-animation state under reduced motion. Report each observation and any unavailable check.
Look up a React animation lifecycle problem
Provide the component, the animation target, and the update or user action when it breaks.
Another component with the same class animatesScope
- Command or reference
scope and refs- Examples
- Attach a root ref and give it to useGSAP so selector text stays within the instance.
Old tweens remain after props changeUpdates
- Command or reference
dependencies / revertOnUpdate- Examples
- Confirm the dependency is stable across unrelated renders and revert the previous context when it changes.
A tween made on click leaves inline stylesCallbacks
- Command or reference
contextSafe()- Examples
- Wrap creation in contextSafe and remove any manually added event listener or timer at teardown.
GSAP React troubleshooting
Does contextSafe remove native event listeners?
It records GSAP objects created by the wrapped function and applies the selector scope. Return cleanup for native listeners and timers you add yourself.
Is a dependency array enough to revert on updates?
Dependencies control when the hook reruns. Set revertOnUpdate: true when those dependencies should also trigger reversion before rebuilding.
How do I use it on a server-rendered route?
Render usable HTML first, place the hook in the client-side component, and resolve DOM targets after mount. In the Next.js App Router the component that uses this hook belongs within a Client Component boundary.