.claude/skills/r3f-animation/SKILL.md
React Three Fiber animation - useFrame, useAnimations, spring physics, morph targets. Use when animating objects, playing GLTF animations, or implementing physics-based movement.
npx skillsauth add tadams95/kardashev-network r3f-animationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
import { useFrame } from '@react-three/fiber'
function AnimatedMesh() {
const ref = useRef()
useFrame((state, delta) => {
ref.current.rotation.y += delta
ref.current.position.y = Math.sin(state.clock.elapsedTime) * 2
})
return <mesh ref={ref}><boxGeometry /><meshStandardMaterial /></mesh>
}
import { useGLTF, useAnimations } from '@react-three/drei'
function AnimatedModel() {
const group = useRef()
const { scene, animations } = useGLTF('/models/character.glb')
const { actions, names } = useAnimations(animations, group)
useEffect(() => {
actions[names[0]]?.play()
}, [actions, names])
return <primitive ref={group} object={scene} />
}
function Character({ animation }) {
const { actions } = useAnimations(animations, group)
useEffect(() => {
Object.values(actions).forEach(action => action?.fadeOut(0.5))
actions[animation]?.reset().fadeIn(0.5).play()
}, [animation, actions])
}
import { useSpring, animated } from '@react-spring/three'
function SpringBox() {
const [active, setActive] = useState(false)
const { scale, color } = useSpring({
scale: active ? 1.5 : 1,
color: active ? '#ff6b6b' : '#4ecdc4',
config: { mass: 1, tension: 280, friction: 60 }
})
return (
<animated.mesh scale={scale} onClick={() => setActive(!active)}>
<boxGeometry />
<animated.meshStandardMaterial color={color} />
</animated.mesh>
)
}
import { Float, MeshWobbleMaterial, Trail } from '@react-three/drei'
// Floating effect
<Float speed={1} rotationIntensity={1} floatIntensity={1}>
<mesh>...</mesh>
</Float>
// Wobbly material
<mesh>
<torusKnotGeometry />
<MeshWobbleMaterial factor={1} speed={2} color="hotpink" />
</mesh>
// Motion trail
<Trail width={2} length={8} color="hotpink">
<mesh ref={movingMeshRef}>...</mesh>
</Trail>
function MorphingMesh() {
const ref = useRef()
useFrame(({ clock }) => {
const t = clock.elapsedTime
const index = ref.current.morphTargetDictionary['smile']
ref.current.morphTargetInfluences[index] = (Math.sin(t) + 1) / 2
})
return <primitive ref={ref} object={mesh} />
}
// Smooth follow
function SmoothFollow({ target }) {
const ref = useRef()
const pos = useRef(new THREE.Vector3())
useFrame((_, delta) => {
pos.current.lerp(target, delta * 5)
ref.current.position.copy(pos.current)
})
return <mesh ref={ref}>...</mesh>
}
// Oscillation
useFrame(({ clock }) => {
const t = clock.elapsedTime
ref.current.position.y = Math.sin(t * 2) * 0.5
ref.current.position.x = Math.cos(t) * 2
ref.current.position.z = Math.sin(t) * 2
})
// Use getState() in useFrame for zero overhead
useFrame(() => {
const { playerPosition } = useGameStore.getState()
ref.current.position.lerp(playerPosition, 0.1)
})
development
Web3 integration with wagmi and viem - wallet connection, contract interactions, transactions, RainbowKit. Use when implementing wallet features, reading/writing contracts, or handling blockchain transactions.
content-media
Three.js textures - loading, configuration, UV mapping, environment maps. Use when loading images, configuring texture properties, or working with HDR environments.
data-ai
Three.js shaders - GLSL, ShaderMaterial, uniforms, custom effects. Use when creating custom visual effects, modifying vertices, writing fragment shaders, or extending built-in materials.
testing
Three.js post-processing - EffectComposer, bloom, depth of field, custom passes. Use when adding visual effects, screen-space effects, or enhancing rendered output.