use-animations.md 701 B

useAnimations

useAnimation en un composable que desvuelve un shallowReactive con todas las acciones de los modelos en base de las animaciones proveídas. Es un wrapper sobre la clase AnimationMixer.

Utilización

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