Agent skill Web motion
Three.js React Three Fiber
Use spatial graphics, scenes or materials to support a web experience.
Install the skill
Run the command from your project root with Node.js and npm.
npx skills@latest add cloudai-x/threejs-skills --skill threejs-react-three-fiber --agent claude-code --yesCheck this file in your project.claude/skills/threejs-react-three-fiber/SKILL.md
Other ways to install
Choose an assistant interactively
npx skills@latest add cloudai-x/threejs-skills --skill threejs-react-three-fiberSelect your assistant and choose the project installation scope.
Official instructions
The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. An existing React and Three.js app. The source targets React 19 with React Three Fiber 9.8 and uses drei 10.7 if helpers are needed.
View operation manualWhat this skill helps with
- Use spatial graphics, scenes or materials to support a web experience.
Good for
- 3D on the web
- Publisher
- cloudai-x
- Control points
- Canvas frameloop="demand" · useThree · invalidate() · useFrame
- Result
- A demand-rendered Canvas with a predictable idle state and a button-driven pose update.
- Skill name
threejs-react-three-fiber- Repository
cloudai-x/threejs-skills
Common pitfall
Avoid this prompt
Call React setState from useFrame on an otherwise static inspection page.
A per-frame React update adds work and conflicts with the goal of rendering only when visual state changes.
Use these steps
- Inspect the original target
- Apply the documented technique
- Verify the result in the project
Project walkthrough
Build a static object inspector that requests frames when its imperative mesh pose changes.
Build a static object inspector that requests frames when its imperative mesh pose changes.
Inspect the original target
Inspect the original target
Prompt · Step 1Use Three.js React Three Fiber on [my object inspector]. Verify the React and Fiber versions in the lockfile, confirm the Canvas parent has a measurable height, and identify a mesh whose pose only changes after explicit input. Record the current idle rendering behavior.Apply the documented technique
Apply the documented technique
Prompt · Step 2Set the existing Canvas frameloop to demand. Keep useThree and useFrame inside that Canvas. For the rotate control, mutate the existing mesh ref and call the Canvas invalidate() once to schedule a frame. Leave ordinary UI state in React and clean up external listeners if used.Verify the result in the project
The mesh pose updates after one explicit invalidation and settled idle stays quiet.
- The mesh pose updates after one explicit invalidation and settled idle stays quiet.
Prompt · Step 3Count a settled window of useFrame calls, activate the control, and confirm the new mesh pose appears on the next scheduled frame. Check that the Canvas idles again and performs correct layout on resize. Unmount the viewer to verify owned listener cleanup and report the version and frame counts.
Implementation lookup
Find the input and the expected observation for the selected workflow.
Check the control pointsInputs
- Command or reference
Canvas frameloop="demand" · useThree · invalidate() · useFrame- Examples
- The mesh pose updates after one explicit invalidation and settled idle stays quiet.
FAQ
Do regular React prop changes need invalidate() too?
Fiber’s scene prop commits schedule rendering in demand mode. Call invalidate() for scene mutations made outside React’s prop updates.
Where can I verify the version?
Open the publisher’s pinned Skill source and compare the API references with the application’s lockfile.