Skip to content

useAnimations

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')

const { actions, mixer } = useAnimations(animations, model)

const currentAction = actions.Greeting

currentAction.play()