Skip to main content

Animation and deformation

Animation combines clip playback, skeletal deformation, and morph targets to bring characters and scene objects to life.

The RobotExpressive sample in the glTF Asset Studio demonstrates this capability. The embedded viewer opens that asset and retains the studio controls for exploring it.

GitHub
0s

Engine playback API​

AnimationBinding, AnimationTrack, AnimationClip, and AnimationMixer belong to @luma.gl/engine. They sample and blend resolved runtime properties without reading a source asset during playback. ScenegraphAnimator adds clip selection and a dependent-update callback for skin palettes and other controllers.

import {AnimationMixer, MixerAnimationClip, ScenegraphAnimator} from '@luma.gl/engine';

// walkingClip and runningClip are resolved engine AnimationClip objects.
const mixer = new AnimationMixer();
const animator = new ScenegraphAnimator([
new MixerAnimationClip(walkingClip, mixer),
new MixerAnimationClip(runningClip, mixer)
], mixer, {autoplay: 'first', onUpdate: () => skins.update()});

animator.selectClip(walkingClip.name);
animator.selectClip(runningClip.name, {crossFadeDuration: 0.3});
animator.update(1 / 60);

update() advances by delta seconds; the compatibility setTime() method accepts absolute milliseconds. Crossfade durations are seconds. Do not advance the mixer independently as well as through its animator during the same frame. Active tracks may overwrite manual edits to the same property.

See Animation for native track construction and interpolation, Skins for palette updates, and Morph targets for weight updates.

glTF conversion​

createScenegraphsFromGLTF() decodes source tracks and exposes the shared engine animator as scenegraphs.animator. It resolves source node indices into bindings and arranges dependent skin updates. Imported clip names and node indices are asset-specific.

Node translation, rotation, scale, skins, and morph-weight animation are core glTF features. KHR_animation_pointer additionally targets supported material, texture-transform, camera, light, and visibility properties. The animation reference describes playback and supported targets.

See glTF materials and textures, glTF animation, and the extension support matrix for adapter details and current support limits.

All engine features