useAnimations ^1.5.0
useAnimation
is a composable that returns a shallowReactive
with all the models actions based on the animations provided. It is a wrapper around the AnimationMixer class.
Usage
ts
import { useAnimations } from '@tresjs/cientos'
const { scene: model, animations } = await useGLTF('/models/ugly-naked-bunny.gltf')
// Animations [Â { name: 'Greeting'}, { name: 'Idle' } ]
const { actions, mixer } = useAnimations(animations, model)
let currentAction = actions.Greeting
currentAction.play()