UNPKG

1.75 kBTypeScriptView Raw
1import { AnimationBlendMode } from "../constants.js";
2import { Object3D } from "../core/Object3D.js";
3import { Vector3 } from "../math/Vector3.js";
4import { Bone } from "../objects/Bone.js";
5import { Mesh } from "../objects/Mesh.js";
6import { KeyframeTrack, KeyframeTrackJSON } from "./KeyframeTrack.js";
7
8export interface AnimationClipJSON {
9 name: string;
10 duration: number;
11 tracks: KeyframeTrackJSON[];
12 uuid: string;
13 blendMode: AnimationBlendMode;
14}
15
16export interface MorphTarget {
17 name: string;
18 vertices: Vector3[];
19}
20
21export class AnimationClip {
22 constructor(name?: string, duration?: number, tracks?: KeyframeTrack[], blendMode?: AnimationBlendMode);
23
24 name: string;
25 tracks: KeyframeTrack[];
26
27 /**
28 * @default THREE.NormalAnimationBlendMode
29 */
30 blendMode: AnimationBlendMode;
31
32 /**
33 * @default -1
34 */
35 duration: number;
36 uuid: string;
37 results: any[];
38
39 resetDuration(): AnimationClip;
40 trim(): AnimationClip;
41 validate(): boolean;
42 optimize(): AnimationClip;
43 clone(): this;
44 toJSON(clip: AnimationClip): any;
45
46 static CreateFromMorphTargetSequence(
47 name: string,
48 morphTargetSequence: MorphTarget[],
49 fps: number,
50 noLoop: boolean,
51 ): AnimationClip;
52 static findByName(objectOrClipArray: AnimationClip[] | Object3D | Mesh, name: string): AnimationClip;
53 static CreateClipsFromMorphTargetSequences(
54 morphTargets: MorphTarget[],
55 fps: number,
56 noLoop: boolean,
57 ): AnimationClip[];
58 static parse(json: AnimationClipJSON): AnimationClip;
59 static parseAnimation(animation: AnimationClipJSON, bones: Bone[]): AnimationClip;
60 static toJSON(clip: AnimationClip): AnimationClipJSON;
61}