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

// Animations [ { name: 'Greeting'}, { name: 'Idle' } ]

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

let currentAction = actions.Greeting

currentAction.play()