UNPKG

1.39 kBTypeScriptView Raw
1import { AnimationBlendMode } from "../constants.js";
2import { EventDispatcher } from "../core/EventDispatcher.js";
3import { Object3D } from "../core/Object3D.js";
4import { AnimationAction } from "./AnimationAction.js";
5import { AnimationClip } from "./AnimationClip.js";
6import { AnimationObjectGroup } from "./AnimationObjectGroup.js";
7
8export interface AnimationMixerEventMap {
9 loop: { action: AnimationAction; loopDelta: number };
10 finished: { action: AnimationAction; direction: number };
11}
12
13export class AnimationMixer extends EventDispatcher<AnimationMixerEventMap> {
14 constructor(root: Object3D | AnimationObjectGroup);
15
16 /**
17 * @default 0
18 */
19 time: number;
20
21 /**
22 * @default 1.0
23 */
24 timeScale: number;
25
26 clipAction(
27 clip: AnimationClip,
28 root?: Object3D | AnimationObjectGroup,
29 blendMode?: AnimationBlendMode,
30 ): AnimationAction;
31 existingAction(clip: AnimationClip, root?: Object3D | AnimationObjectGroup): AnimationAction | null;
32 stopAllAction(): AnimationMixer;
33 update(deltaTime: number): AnimationMixer;
34 setTime(timeInSeconds: number): AnimationMixer;
35 getRoot(): Object3D | AnimationObjectGroup;
36 uncacheClip(clip: AnimationClip): void;
37 uncacheRoot(root: Object3D | AnimationObjectGroup): void;
38 uncacheAction(clip: AnimationClip, root?: Object3D | AnimationObjectGroup): void;
39}