Animate React components with AI and GSAP
Set up scoped animation in a React component and handle later click-driven tweens, updates and unmounting.
You can animate React components with AI and GSAP when an interaction lasts longer than a single render. A product panel may animate on entry, then start another movement when the visitor clicks a swatch. The gsap-react skill explains how to keep both the initial tween and the later event-driven animation inside the appropriate context.
The agent can use the official React hook, a container ref and explicit dependencies. You decide when a prop change deserves a fresh animation. The guide also covers cleanup and client-side setup in projects that render the initial interface on the server.
What it does
- Keep motion scoped to one of several repeated panels.
- Register a click callback that creates a tween after initial setup.
- Rebuild an animation when a relevant prop changes.
- Revert the previous state during an update when appropriate.
- Check that closing the component releases its animations.
Install and use
- Prepare an authorised React project with GSAP and the official @gsap/react package. Provide the component containing the moving element.
- Ask the agent to animate the selected product and explain which change should reset the motion.
- Switch products quickly and mount the component again to check for duplicate behaviour.
FAQ
Source
Made by GreenSock (Webflow). Original skill: gsap-react, published on GitHub under the MIT licence.
View on GitHub