Agent skill Web motion
React Spring Physics
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 https://github.com/freshtechbro/claudedesignskills/tree/main/plugins/bundles/animation-components/skills/react-spring-physics --skill react-spring-physics --agent claude-code --yesCheck this file in your project.claude/skills/react-spring-physics/SKILL.md
Other ways to install
Choose an assistant interactively
npx skills@latest add https://github.com/freshtechbro/claudedesignskills/tree/main/plugins/bundles/animation-components/skills/react-spring-physics --skill react-spring-physicsSelect your assistant and choose the project installation scope.
Official instructions
The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. A React web app, an existing toggle interaction, and a compatible @react-spring/web dependency. Use the @react-spring/web hooks demonstrated in the current useSpring documentation. Check its peer dependencies before changing the app version.
View operation manualWhat this skill helps with
- Design, implement or review motion on the web.
Good for
- Web motion and transitions
- Publisher
- FreshTechBro
- Compatibility
- Use the @react-spring/web hooks demonstrated in the current useSpring documentation. Check its peer dependencies before changing the app version.
- Scenario
- Make a toggle indicator follow fast state changes
- Skill name
react-spring-physics- Repository
freshtechbro/claudedesignskills
Common pitfall
Avoid this prompt
Start a new spring from zero on each toggle and update the label when it stops.
Restarting from a fixed origin can cause jumps, and waiting for animation leaves the visible or announced state behind user input.
Use these steps
- Find the semantic control and the indicator it owns.
- Reuse useSpring and let raw input update semantics independently.
- Exercise rapid clicks and keyboard input and inspect the final indicator position.
Hands-on walkthrough
Use one spring for a decorative indicator while updating the control’s semantic state immediately.
Use one spring for a decorative indicator while updating the control’s semantic state immediately.
Identify the source of toggle state
Find the semantic control and the indicator it owns.
Prompt · Step 1Use React Spring Physics on [toggle]. Locate the state, keyboard behavior, and decorative indicator. Read the resolved React and @react-spring/web versions. Record the indicator’s off/on positions and the exact moment the control’s checked state or pressed state changes.Retarget a single spring
Reuse useSpring and let raw input update semantics independently.
Prompt · Step 2Use the function form of useSpring with dependencies to get [styles, api] from @react-spring/web. Bind the indicator to an animated element. When the selected state changes, update the existing semantic control promptly and use api.start() to retarget the indicator. Start with mass: 1, tension: 170, friction: 26, then tune against the real control. Use immediate: true for reduced motion.Verify reversals and semantics
Exercise rapid clicks and keyboard input and inspect the final indicator position.
- The control state follows user input independently of the spring.
- Fast reversals settle at the latest selection and reduced motion updates immediately.
Prompt · Step 3Toggle before the first spring settles, then repeat with the keyboard. Verify the semantic state changes with each input and the indicator lands at the last chosen position without jumping back to the original endpoint mid-flight. Emulate reduced motion, check the immediate position, and report the final config and observed outputs.
Workflow lookup
Use the documented calls with the version selected for the walkthrough.
Retarget the existing animationAPI
- Command or reference
useSpring(() => ({ … }), []) · api.start()- Examples
- Use the imperative reference from the hook and update its target on each state change.
Tune the spring responseAPI
- Command or reference
config.mass · config.tension · config.friction- Examples
- Compare changes to the same control at the same travel distance.
FAQ
Does this need a Popmotion dependency?
The indicator uses React Spring’s web hook and animated element. The skill also covers Popmotion for other low-level cases.
Where are the skill materials?
Open the project skill folder printed by the installer for SKILL.md and any bundled resources. The app’s runtime libraries are managed separately in its own package manifest.