@types/three 0.174.0 → 0.175.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- three/README.md +1 -1
- three/examples/jsm/Addons.d.ts +1 -1
- three/examples/jsm/controls/PointerLockControls.d.ts +4 -1
- three/examples/jsm/geometries/ParametricFunctions.d.ts +8 -0
- three/examples/jsm/interactive/HTMLMesh.d.ts +9 -2
- three/examples/jsm/loaders/LUTImageLoader.d.ts +2 -2
- three/examples/jsm/postprocessing/HalftonePass.d.ts +1 -1
- three/examples/jsm/postprocessing/LUTPass.d.ts +1 -1
- three/examples/jsm/postprocessing/SMAAPass.d.ts +1 -1
- three/examples/jsm/transpiler/AST.d.ts +218 -1
- three/examples/jsm/transpiler/TSLEncoder.d.ts +35 -1
- three/examples/jsm/webxr/VRButton.d.ts +4 -2
- three/package.json +2 -2
- three/src/Three.TSL.d.ts +3 -1
- three/src/animation/AnimationAction.d.ts +219 -19
- three/src/animation/AnimationClip.d.ts +140 -28
- three/src/animation/AnimationMixer.d.ts +100 -8
- three/src/animation/AnimationObjectGroup.d.ts +55 -14
- three/src/animation/AnimationUtils.d.ts +154 -43
- three/src/animation/KeyframeTrack.d.ts +134 -25
- three/src/animation/PropertyBinding.d.ts +89 -31
- three/src/animation/PropertyMixer.d.ts +62 -5
- three/src/animation/tracks/BooleanKeyframeTrack.d.ts +12 -4
- three/src/animation/tracks/ColorKeyframeTrack.d.ts +10 -4
- three/src/animation/tracks/NumberKeyframeTrack.d.ts +10 -4
- three/src/animation/tracks/QuaternionKeyframeTrack.d.ts +10 -4
- three/src/animation/tracks/StringKeyframeTrack.d.ts +12 -4
- three/src/animation/tracks/VectorKeyframeTrack.d.ts +10 -4
- three/src/constants.d.ts +2 -2
- three/src/core/BufferAttribute.d.ts +11 -0
- three/src/core/BufferGeometry.d.ts +1 -3
- three/src/extras/Controls.d.ts +1 -1
- three/src/extras/Earcut.d.ts +5 -3
- three/src/extras/ImageUtils.d.ts +1 -0
- three/src/lights/PointLight.d.ts +1 -1
- three/src/loaders/FileLoader.d.ts +2 -2
- three/src/loaders/LoaderUtils.d.ts +0 -5
- three/src/materials/Material.d.ts +3 -0
- three/src/nodes/Nodes.d.ts +1 -0
- three/src/nodes/accessors/BufferAttributeNode.d.ts +11 -4
- three/src/nodes/accessors/Object3DNode.d.ts +6 -6
- three/src/nodes/accessors/SkinningNode.d.ts +4 -3
- three/src/nodes/accessors/StorageTextureNode.d.ts +2 -2
- three/src/nodes/accessors/TextureNode.d.ts +3 -1
- three/src/nodes/code/ExpressionNode.d.ts +3 -2
- three/src/nodes/code/ScriptableNode.d.ts +1 -1
- three/src/nodes/code/ScriptableValueNode.d.ts +1 -1
- three/src/nodes/core/StructTypeNode.d.ts +1 -1
- three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +1 -12
- three/src/nodes/math/ConditionalNode.d.ts +4 -4
- three/src/nodes/math/MathNode.d.ts +20 -12
- three/src/nodes/math/OperatorNode.d.ts +57 -26
- three/src/nodes/tsl/TSLBase.d.ts +1 -0
- three/src/nodes/utils/DebugNode.d.ts +20 -0
- three/src/nodes/utils/SpriteSheetUVNode.d.ts +2 -2
- three/src/renderers/common/Animation.d.ts +2 -2
- three/src/renderers/common/Attributes.d.ts +1 -1
- three/src/renderers/common/Color4.d.ts +1 -1
- three/src/renderers/common/CubeRenderTarget.d.ts +6 -0
- three/src/renderers/common/RenderList.d.ts +2 -2
- three/src/renderers/common/RenderObject.d.ts +1 -1
- three/src/renderers/common/RenderObjects.d.ts +2 -2
- three/src/renderers/common/Renderer.d.ts +36 -27
- three/src/renderers/common/XRManager.d.ts +69 -3
- three/src/renderers/common/nodes/NodeBuilderState.d.ts +3 -3
- three/src/renderers/webgpu/utils/WebGPUConstants.d.ts +1 -1
- three/src/textures/CanvasTexture.d.ts +1 -1
- three/examples/jsm/geometries/ParametricGeometries.d.ts +0 -32
|
@@ -2,85 +2,285 @@ import { AnimationActionLoopStyles, AnimationBlendMode } from "../constants.js";
|
|
|
2
2
|
import { Object3D } from "../core/Object3D.js";
|
|
3
3
|
import { AnimationClip } from "./AnimationClip.js";
|
|
4
4
|
import { AnimationMixer } from "./AnimationMixer.js";
|
|
5
|
-
// Animation ////////////////////////////////////////////////////////////////////////////////////////
|
|
6
5
|
|
|
6
|
+
/**
|
|
7
|
+
* An instance of `AnimationAction` schedules the playback of an animation which is
|
|
8
|
+
* stored in {@link AnimationClip}.
|
|
9
|
+
*/
|
|
7
10
|
export class AnimationAction {
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new animation action.
|
|
13
|
+
*
|
|
14
|
+
* @param {AnimationMixer} mixer - The mixer that is controlled by this action.
|
|
15
|
+
* @param {AnimationClip} clip - The animation clip that holds the actual keyframes.
|
|
16
|
+
* @param {?Object3D} [localRoot=null] - The root object on which this action is performed.
|
|
17
|
+
* @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode.
|
|
18
|
+
*/
|
|
19
|
+
constructor(
|
|
20
|
+
mixer: AnimationMixer,
|
|
21
|
+
clip: AnimationClip,
|
|
22
|
+
localRoot?: Object3D | null,
|
|
23
|
+
blendMode?: AnimationBlendMode,
|
|
24
|
+
);
|
|
25
|
+
/**
|
|
26
|
+
* Defines how the animation is blended/combined when two or more animations
|
|
27
|
+
* are simultaneously played.
|
|
28
|
+
*/
|
|
10
29
|
blendMode: AnimationBlendMode;
|
|
11
|
-
|
|
12
30
|
/**
|
|
13
|
-
* @
|
|
31
|
+
* The loop mode, set via {@link AnimationAction#setLoop}.
|
|
32
|
+
*
|
|
33
|
+
* @default LoopRepeat
|
|
14
34
|
*/
|
|
15
35
|
loop: AnimationActionLoopStyles;
|
|
16
|
-
|
|
17
36
|
/**
|
|
18
|
-
*
|
|
37
|
+
* The local time of this action (in seconds, starting with `0`).
|
|
38
|
+
*
|
|
39
|
+
* The value gets clamped or wrapped to `[0,clip.duration]` (according to the
|
|
40
|
+
* loop state).
|
|
41
|
+
*
|
|
42
|
+
* @default Infinity
|
|
19
43
|
*/
|
|
20
44
|
time: number;
|
|
21
|
-
|
|
22
45
|
/**
|
|
46
|
+
* Scaling factor for the {@link AnimationAction#time}. A value of `0` causes the
|
|
47
|
+
* animation to pause. Negative values cause the animation to play backwards.
|
|
48
|
+
*
|
|
23
49
|
* @default 1
|
|
24
50
|
*/
|
|
25
51
|
timeScale: number;
|
|
26
|
-
|
|
27
52
|
/**
|
|
53
|
+
* The degree of influence of this action (in the interval `[0, 1]`). Values
|
|
54
|
+
* between `0` (no impact) and `1` (full impact) can be used to blend between
|
|
55
|
+
* several actions.
|
|
56
|
+
*
|
|
28
57
|
* @default 1
|
|
29
58
|
*/
|
|
30
59
|
weight: number;
|
|
31
|
-
|
|
32
60
|
/**
|
|
61
|
+
* The number of repetitions of the performed clip over the course of this action.
|
|
62
|
+
* Can be set via {@link AnimationAction#setLoop}.
|
|
63
|
+
*
|
|
64
|
+
* Setting this number has no effect if {@link AnimationAction#loop} is set to
|
|
65
|
+
* `THREE:LoopOnce`.
|
|
66
|
+
*
|
|
33
67
|
* @default Infinity
|
|
34
68
|
*/
|
|
35
69
|
repetitions: number;
|
|
36
|
-
|
|
37
70
|
/**
|
|
71
|
+
* If set to `true`, the playback of the action is paused.
|
|
72
|
+
*
|
|
38
73
|
* @default false
|
|
39
74
|
*/
|
|
40
75
|
paused: boolean;
|
|
41
|
-
|
|
42
76
|
/**
|
|
77
|
+
* If set to `false`, the action is disabled so it has no impact.
|
|
78
|
+
*
|
|
79
|
+
* When the action is re-enabled, the animation continues from its current
|
|
80
|
+
* time (setting `enabled` to `false` doesn't reset the action).
|
|
81
|
+
*
|
|
43
82
|
* @default true
|
|
44
83
|
*/
|
|
45
84
|
enabled: boolean;
|
|
46
|
-
|
|
47
85
|
/**
|
|
86
|
+
* If set to true the animation will automatically be paused on its last frame.
|
|
87
|
+
*
|
|
88
|
+
* If set to false, {@link AnimationAction#enabled} will automatically be switched
|
|
89
|
+
* to `false` when the last loop of the action has finished, so that this action has
|
|
90
|
+
* no further impact.
|
|
91
|
+
*
|
|
92
|
+
* Note: This member has no impact if the action is interrupted (it
|
|
93
|
+
* has only an effect if its last loop has really finished).
|
|
94
|
+
*
|
|
48
95
|
* @default false
|
|
49
96
|
*/
|
|
50
97
|
clampWhenFinished: boolean;
|
|
51
|
-
|
|
52
98
|
/**
|
|
99
|
+
* Enables smooth interpolation without separate clips for start, loop and end.
|
|
100
|
+
*
|
|
53
101
|
* @default true
|
|
54
102
|
*/
|
|
55
103
|
zeroSlopeAtStart: boolean;
|
|
56
|
-
|
|
57
104
|
/**
|
|
105
|
+
* Enables smooth interpolation without separate clips for start, loop and end.
|
|
106
|
+
*
|
|
58
107
|
* @default true
|
|
59
108
|
*/
|
|
60
109
|
zeroSlopeAtEnd: boolean;
|
|
61
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Starts the playback of the animation.
|
|
112
|
+
*
|
|
113
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
114
|
+
*/
|
|
62
115
|
play(): AnimationAction;
|
|
116
|
+
/**
|
|
117
|
+
* Stops the playback of the animation.
|
|
118
|
+
*
|
|
119
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
120
|
+
*/
|
|
63
121
|
stop(): AnimationAction;
|
|
122
|
+
/**
|
|
123
|
+
* Resets the playback of the animation.
|
|
124
|
+
*
|
|
125
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
126
|
+
*/
|
|
64
127
|
reset(): AnimationAction;
|
|
128
|
+
/**
|
|
129
|
+
* Returns `true` if the animation is running.
|
|
130
|
+
*
|
|
131
|
+
* @return {boolean} Whether the animation is running or not.
|
|
132
|
+
*/
|
|
65
133
|
isRunning(): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Returns `true` when {@link AnimationAction#play} has been called.
|
|
136
|
+
*
|
|
137
|
+
* @return {boolean} Whether the animation is scheduled or not.
|
|
138
|
+
*/
|
|
66
139
|
isScheduled(): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Defines the time when the animation should start.
|
|
142
|
+
*
|
|
143
|
+
* @param {number} time - The start time in seconds.
|
|
144
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
145
|
+
*/
|
|
67
146
|
startAt(time: number): AnimationAction;
|
|
147
|
+
/**
|
|
148
|
+
* Configures the loop settings for this action.
|
|
149
|
+
*
|
|
150
|
+
* @param {(LoopRepeat|LoopOnce|LoopPingPong)} mode - The loop mode.
|
|
151
|
+
* @param {number} repetitions - The number of repetitions.
|
|
152
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
153
|
+
*/
|
|
68
154
|
setLoop(mode: AnimationActionLoopStyles, repetitions: number): AnimationAction;
|
|
155
|
+
/**
|
|
156
|
+
* Sets the effective weight of this action.
|
|
157
|
+
*
|
|
158
|
+
* An action has no effect and thus an effective weight of zero when the
|
|
159
|
+
* action is disabled.
|
|
160
|
+
*
|
|
161
|
+
* @param {number} weight - The weight to set.
|
|
162
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
163
|
+
*/
|
|
69
164
|
setEffectiveWeight(weight: number): AnimationAction;
|
|
165
|
+
/**
|
|
166
|
+
* Returns the effective weight of this action.
|
|
167
|
+
*
|
|
168
|
+
* @return {number} The effective weight.
|
|
169
|
+
*/
|
|
70
170
|
getEffectiveWeight(): number;
|
|
171
|
+
/**
|
|
172
|
+
* Fades the animation in by increasing its weight gradually from `0` to `1`,
|
|
173
|
+
* within the passed time interval.
|
|
174
|
+
*
|
|
175
|
+
* @param {number} duration - The duration of the fade.
|
|
176
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
177
|
+
*/
|
|
71
178
|
fadeIn(duration: number): AnimationAction;
|
|
179
|
+
/**
|
|
180
|
+
* Fades the animation out by decreasing its weight gradually from `1` to `0`,
|
|
181
|
+
* within the passed time interval.
|
|
182
|
+
*
|
|
183
|
+
* @param {number} duration - The duration of the fade.
|
|
184
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
185
|
+
*/
|
|
72
186
|
fadeOut(duration: number): AnimationAction;
|
|
73
|
-
|
|
74
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Causes this action to fade in and the given action to fade out,
|
|
189
|
+
* within the passed time interval.
|
|
190
|
+
*
|
|
191
|
+
* @param {AnimationAction} fadeOutAction - The animation action to fade out.
|
|
192
|
+
* @param {number} duration - The duration of the fade.
|
|
193
|
+
* @param {boolean} [warp=false] - Whether warping should be used or not.
|
|
194
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
195
|
+
*/
|
|
196
|
+
crossFadeFrom(fadeOutAction: AnimationAction, duration: number, warp?: boolean): AnimationAction;
|
|
197
|
+
/**
|
|
198
|
+
* Causes this action to fade out and the given action to fade in,
|
|
199
|
+
* within the passed time interval.
|
|
200
|
+
*
|
|
201
|
+
* @param {AnimationAction} fadeInAction - The animation action to fade in.
|
|
202
|
+
* @param {number} duration - The duration of the fade.
|
|
203
|
+
* @param {boolean} [warp=false] - Whether warping should be used or not.
|
|
204
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
205
|
+
*/
|
|
206
|
+
crossFadeTo(fadeInAction: AnimationAction, duration: number, warp?: boolean): AnimationAction;
|
|
207
|
+
/**
|
|
208
|
+
* Stops any fading which is applied to this action.
|
|
209
|
+
*
|
|
210
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
211
|
+
*/
|
|
75
212
|
stopFading(): AnimationAction;
|
|
213
|
+
/**
|
|
214
|
+
* Sets the effective time scale of this action.
|
|
215
|
+
*
|
|
216
|
+
* An action has no effect and thus an effective time scale of zero when the
|
|
217
|
+
* action is paused.
|
|
218
|
+
*
|
|
219
|
+
* @param {number} timeScale - The time scale to set.
|
|
220
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
221
|
+
*/
|
|
76
222
|
setEffectiveTimeScale(timeScale: number): AnimationAction;
|
|
223
|
+
/**
|
|
224
|
+
* Returns the effective time scale of this action.
|
|
225
|
+
*
|
|
226
|
+
* @return {number} The effective time scale.
|
|
227
|
+
*/
|
|
77
228
|
getEffectiveTimeScale(): number;
|
|
229
|
+
/**
|
|
230
|
+
* Sets the duration for a single loop of this action.
|
|
231
|
+
*
|
|
232
|
+
* @param {number} duration - The duration to set.
|
|
233
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
234
|
+
*/
|
|
78
235
|
setDuration(duration: number): AnimationAction;
|
|
236
|
+
/**
|
|
237
|
+
* Synchronizes this action with the passed other action.
|
|
238
|
+
*
|
|
239
|
+
* @param {AnimationAction} action - The action to sync with.
|
|
240
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
241
|
+
*/
|
|
79
242
|
syncWith(action: AnimationAction): AnimationAction;
|
|
243
|
+
/**
|
|
244
|
+
* Decelerates this animation's speed to `0` within the passed time interval.
|
|
245
|
+
*
|
|
246
|
+
* @param {number} duration - The duration.
|
|
247
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
248
|
+
*/
|
|
80
249
|
halt(duration: number): AnimationAction;
|
|
81
|
-
|
|
250
|
+
/**
|
|
251
|
+
* Changes the playback speed, within the passed time interval, by modifying
|
|
252
|
+
* {@link AnimationAction#timeScale} gradually from `startTimeScale` to
|
|
253
|
+
* `endTimeScale`.
|
|
254
|
+
*
|
|
255
|
+
* @param {number} startTimeScale - The start time scale.
|
|
256
|
+
* @param {number} endTimeScale - The end time scale.
|
|
257
|
+
* @param {number} duration - The duration.
|
|
258
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
259
|
+
*/
|
|
260
|
+
warp(startTimeScale: number, endTimeScale: number, duration: number): AnimationAction;
|
|
261
|
+
/**
|
|
262
|
+
* Stops any scheduled warping which is applied to this action.
|
|
263
|
+
*
|
|
264
|
+
* @return {AnimationAction} A reference to this animation action.
|
|
265
|
+
*/
|
|
82
266
|
stopWarping(): AnimationAction;
|
|
267
|
+
/**
|
|
268
|
+
* Returns the animation mixer of this animation action.
|
|
269
|
+
*
|
|
270
|
+
* @return {AnimationMixer} The animation mixer.
|
|
271
|
+
*/
|
|
83
272
|
getMixer(): AnimationMixer;
|
|
273
|
+
/**
|
|
274
|
+
* Returns the animation clip of this animation action.
|
|
275
|
+
*
|
|
276
|
+
* @return {AnimationClip} The animation clip.
|
|
277
|
+
*/
|
|
84
278
|
getClip(): AnimationClip;
|
|
279
|
+
/**
|
|
280
|
+
* Returns the root object of this animation action.
|
|
281
|
+
*
|
|
282
|
+
* @return {Object3D} The root object.
|
|
283
|
+
*/
|
|
85
284
|
getRoot(): Object3D;
|
|
285
|
+
_scheduleFading(duration: number, weightNow: number, weightThen: number): this;
|
|
86
286
|
}
|
|
@@ -2,7 +2,6 @@ import { AnimationBlendMode } from "../constants.js";
|
|
|
2
2
|
import { Object3D } from "../core/Object3D.js";
|
|
3
3
|
import { Vector3 } from "../math/Vector3.js";
|
|
4
4
|
import { Bone } from "../objects/Bone.js";
|
|
5
|
-
import { Mesh } from "../objects/Mesh.js";
|
|
6
5
|
import { KeyframeTrack, KeyframeTrackJSON } from "./KeyframeTrack.js";
|
|
7
6
|
|
|
8
7
|
export interface AnimationClipJSON {
|
|
@@ -18,44 +17,157 @@ export interface MorphTarget {
|
|
|
18
17
|
vertices: Vector3[];
|
|
19
18
|
}
|
|
20
19
|
|
|
20
|
+
/**
|
|
21
|
+
* A reusable set of keyframe tracks which represent an animation.
|
|
22
|
+
*/
|
|
21
23
|
export class AnimationClip {
|
|
22
|
-
constructor(name?: string, duration?: number, tracks?: KeyframeTrack[], blendMode?: AnimationBlendMode);
|
|
23
|
-
|
|
24
|
-
name: string;
|
|
25
|
-
tracks: KeyframeTrack[];
|
|
26
|
-
|
|
27
24
|
/**
|
|
28
|
-
*
|
|
25
|
+
* Factory method for creating an animation clip from the given JSON.
|
|
26
|
+
*
|
|
27
|
+
* @static
|
|
28
|
+
* @param {Object} json - The serialized animation clip.
|
|
29
|
+
* @return {AnimationClip} The new animation clip.
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
static parse(json: AnimationClipJSON): AnimationClip;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Serializes the given animation clip into JSON.
|
|
34
|
+
*
|
|
35
|
+
* @static
|
|
36
|
+
* @param {AnimationClip} clip - The animation clip to serialize.
|
|
37
|
+
* @return {Object} The JSON object.
|
|
38
|
+
*/
|
|
39
|
+
static toJSON(clip: AnimationClip): AnimationClipJSON;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a new animation clip from the passed morph targets array of a
|
|
42
|
+
* geometry, taking a name and the number of frames per second.
|
|
43
|
+
*
|
|
44
|
+
* Note: The fps parameter is required, but the animation speed can be
|
|
45
|
+
* overridden via {@link AnimationAction#setDuration}.
|
|
46
|
+
*
|
|
47
|
+
* @static
|
|
48
|
+
* @param {string} name - The name of the animation clip.
|
|
49
|
+
* @param {Array<Object>} morphTargetSequence - A sequence of morph targets.
|
|
50
|
+
* @param {number} fps - The Frames-Per-Second value.
|
|
51
|
+
* @param {boolean} noLoop - Whether the clip should be no loop or not.
|
|
52
|
+
* @return {AnimationClip} The new animation clip.
|
|
34
53
|
*/
|
|
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(): AnimationClipJSON;
|
|
45
|
-
|
|
46
54
|
static CreateFromMorphTargetSequence(
|
|
47
55
|
name: string,
|
|
48
|
-
morphTargetSequence: MorphTarget
|
|
56
|
+
morphTargetSequence: Array<MorphTarget>,
|
|
49
57
|
fps: number,
|
|
50
58
|
noLoop: boolean,
|
|
51
59
|
): AnimationClip;
|
|
52
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Searches for an animation clip by name, taking as its first parameter
|
|
62
|
+
* either an array of clips, or a mesh or geometry that contains an
|
|
63
|
+
* array named "animations" property.
|
|
64
|
+
*
|
|
65
|
+
* @static
|
|
66
|
+
* @param {(Array<AnimationClip>|Object3D)} objectOrClipArray - The array or object to search through.
|
|
67
|
+
* @param {string} name - The name to search for.
|
|
68
|
+
* @return {?AnimationClip} The found animation clip. Returns `null` if no clip has been found.
|
|
69
|
+
*/
|
|
70
|
+
static findByName(objectOrClipArray: Array<AnimationClip> | Object3D, name: string): AnimationClip | null;
|
|
71
|
+
/**
|
|
72
|
+
* Returns an array of new AnimationClips created from the morph target
|
|
73
|
+
* sequences of a geometry, trying to sort morph target names into
|
|
74
|
+
* animation-group-based patterns like "Walk_001, Walk_002, Run_001, Run_002...".
|
|
75
|
+
*
|
|
76
|
+
* See {@link MD2Loader#parse} as an example for how the method should be used.
|
|
77
|
+
*
|
|
78
|
+
* @static
|
|
79
|
+
* @param {Array<Object>} morphTargets - A sequence of morph targets.
|
|
80
|
+
* @param {number} fps - The Frames-Per-Second value.
|
|
81
|
+
* @param {boolean} noLoop - Whether the clip should be no loop or not.
|
|
82
|
+
* @return {Array<AnimationClip>} An array of new animation clips.
|
|
83
|
+
*/
|
|
53
84
|
static CreateClipsFromMorphTargetSequences(
|
|
54
|
-
morphTargets: MorphTarget
|
|
85
|
+
morphTargets: Array<MorphTarget>,
|
|
55
86
|
fps: number,
|
|
56
87
|
noLoop: boolean,
|
|
57
|
-
): AnimationClip
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
): Array<AnimationClip>;
|
|
89
|
+
/**
|
|
90
|
+
* Parses the `animation.hierarchy` format and returns a new animation clip.
|
|
91
|
+
*
|
|
92
|
+
* @static
|
|
93
|
+
* @deprecated since r175.
|
|
94
|
+
* @param {Object} animation - A serialized animation clip as JSON.
|
|
95
|
+
* @param {Array<Bones>} bones - An array of bones.
|
|
96
|
+
* @return {?AnimationClip} The new animation clip.
|
|
97
|
+
*/
|
|
98
|
+
static parseAnimation(animation: AnimationClipJSON, bones: Array<Bone>): AnimationClip | null;
|
|
99
|
+
/**
|
|
100
|
+
* Constructs a new animation clip.
|
|
101
|
+
*
|
|
102
|
+
* Note: Instead of instantiating an AnimationClip directly with the constructor, you can
|
|
103
|
+
* use the static interface of this class for creating clips. In most cases though, animation clips
|
|
104
|
+
* will automatically be created by loaders when importing animated 3D assets.
|
|
105
|
+
*
|
|
106
|
+
* @param {string} [name=''] - The clip's name.
|
|
107
|
+
* @param {number} [duration=-1] - The clip's duration in seconds. If a negative value is passed,
|
|
108
|
+
* the duration will be calculated from the passed keyframes.
|
|
109
|
+
* @param {Array<KeyframeTrack>} tracks - An array of keyframe tracks.
|
|
110
|
+
* @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode=NormalAnimationBlendMode] - Defines how the animation
|
|
111
|
+
* is blended/combined when two or more animations are simultaneously played.
|
|
112
|
+
*/
|
|
113
|
+
constructor(name?: string, duration?: number, tracks?: Array<KeyframeTrack>, blendMode?: AnimationBlendMode);
|
|
114
|
+
/**
|
|
115
|
+
* The clip's name.
|
|
116
|
+
*/
|
|
117
|
+
name: string;
|
|
118
|
+
/**
|
|
119
|
+
* An array of keyframe tracks.
|
|
120
|
+
*/
|
|
121
|
+
tracks: Array<KeyframeTrack>;
|
|
122
|
+
/**
|
|
123
|
+
* The clip's duration in seconds.
|
|
124
|
+
*/
|
|
125
|
+
duration: number;
|
|
126
|
+
/**
|
|
127
|
+
* Defines how the animation is blended/combined when two or more animations
|
|
128
|
+
* are simultaneously played.
|
|
129
|
+
*/
|
|
130
|
+
blendMode: AnimationBlendMode;
|
|
131
|
+
/**
|
|
132
|
+
* The UUID of the animation clip.
|
|
133
|
+
*/
|
|
134
|
+
readonly uuid: string;
|
|
135
|
+
/**
|
|
136
|
+
* Sets the duration of this clip to the duration of its longest keyframe track.
|
|
137
|
+
*
|
|
138
|
+
* @return {AnimationClip} A reference to this animation clip.
|
|
139
|
+
*/
|
|
140
|
+
resetDuration(): AnimationClip;
|
|
141
|
+
/**
|
|
142
|
+
* Trims all tracks to the clip's duration.
|
|
143
|
+
*
|
|
144
|
+
* @return {AnimationClip} A reference to this animation clip.
|
|
145
|
+
*/
|
|
146
|
+
trim(): AnimationClip;
|
|
147
|
+
/**
|
|
148
|
+
* Performs minimal validation on each track in the clip. Returns `true` if all
|
|
149
|
+
* tracks are valid.
|
|
150
|
+
*
|
|
151
|
+
* @return {boolean} Whether the clip's keyframes are valid or not.
|
|
152
|
+
*/
|
|
153
|
+
validate(): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Optimizes each track by removing equivalent sequential keys (which are
|
|
156
|
+
* common in morph target sequences).
|
|
157
|
+
*
|
|
158
|
+
* @return {AnimationClip} A reference to this animation clip.
|
|
159
|
+
*/
|
|
160
|
+
optimize(): AnimationClip;
|
|
161
|
+
/**
|
|
162
|
+
* Returns a new animation clip with copied values from this instance.
|
|
163
|
+
*
|
|
164
|
+
* @return {AnimationClip} A clone of this instance.
|
|
165
|
+
*/
|
|
166
|
+
clone(): this;
|
|
167
|
+
/**
|
|
168
|
+
* Serializes this animation clip into JSON.
|
|
169
|
+
*
|
|
170
|
+
* @return {Object} The JSON object.
|
|
171
|
+
*/
|
|
172
|
+
toJSON(): AnimationClipJSON;
|
|
61
173
|
}
|
|
@@ -10,30 +10,122 @@ export interface AnimationMixerEventMap {
|
|
|
10
10
|
finished: { action: AnimationAction; direction: number };
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* `AnimationMixer` is a player for animations on a particular object in
|
|
15
|
+
* the scene. When multiple objects in the scene are animated independently,
|
|
16
|
+
* one `AnimationMixer` may be used for each object.
|
|
17
|
+
*/
|
|
13
18
|
export class AnimationMixer extends EventDispatcher<AnimationMixerEventMap> {
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a new animation mixer.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object3D} root - The object whose animations shall be played by this mixer.
|
|
23
|
+
*/
|
|
14
24
|
constructor(root: Object3D | AnimationObjectGroup);
|
|
15
|
-
|
|
16
25
|
/**
|
|
26
|
+
* The global mixer time (in seconds; starting with `0` on the mixer's creation).
|
|
27
|
+
*
|
|
17
28
|
* @default 0
|
|
18
29
|
*/
|
|
19
30
|
time: number;
|
|
20
|
-
|
|
21
31
|
/**
|
|
22
|
-
*
|
|
32
|
+
* A scaling factor for the global time.
|
|
33
|
+
*
|
|
34
|
+
* Note: Setting this member to `0` and later back to `1` is a
|
|
35
|
+
* possibility to pause/unpause all actions that are controlled by this
|
|
36
|
+
* mixer.
|
|
37
|
+
*
|
|
38
|
+
* @default 1
|
|
23
39
|
*/
|
|
24
40
|
timeScale: number;
|
|
25
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Returns an instance of {@link AnimationAction} for the passed clip.
|
|
43
|
+
*
|
|
44
|
+
* If an action fitting the clip and root parameters doesn't yet exist, it
|
|
45
|
+
* will be created by this method. Calling this method several times with the
|
|
46
|
+
* same clip and root parameters always returns the same action.
|
|
47
|
+
*
|
|
48
|
+
* @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip.
|
|
49
|
+
* @param {Object3D} [optionalRoot] - An alternative root object.
|
|
50
|
+
* @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode.
|
|
51
|
+
* @return {?AnimationAction} The animation action.
|
|
52
|
+
*/
|
|
26
53
|
clipAction(
|
|
27
54
|
clip: AnimationClip,
|
|
28
|
-
|
|
55
|
+
optionalRoot?: Object3D | AnimationObjectGroup,
|
|
29
56
|
blendMode?: AnimationBlendMode,
|
|
30
57
|
): AnimationAction;
|
|
31
|
-
|
|
58
|
+
clipAction(
|
|
59
|
+
clip: AnimationClip | string,
|
|
60
|
+
optionalRoot?: Object3D | AnimationObjectGroup,
|
|
61
|
+
blendMode?: AnimationBlendMode,
|
|
62
|
+
): AnimationAction | null;
|
|
63
|
+
/**
|
|
64
|
+
* Returns an existing animation action for the passed clip.
|
|
65
|
+
*
|
|
66
|
+
* @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip.
|
|
67
|
+
* @param {Object3D} [optionalRoot] - An alternative root object.
|
|
68
|
+
* @return {?AnimationAction} The animation action. Returns `null` if no action was found.
|
|
69
|
+
*/
|
|
70
|
+
existingAction(
|
|
71
|
+
clip: AnimationClip | string,
|
|
72
|
+
optionalRoot?: Object3D | AnimationObjectGroup,
|
|
73
|
+
): AnimationAction | null;
|
|
74
|
+
/**
|
|
75
|
+
* Deactivates all previously scheduled actions on this mixer.
|
|
76
|
+
*
|
|
77
|
+
* @return {AnimationMixer} A reference to thi animation mixer.
|
|
78
|
+
*/
|
|
32
79
|
stopAllAction(): AnimationMixer;
|
|
80
|
+
/**
|
|
81
|
+
* Advances the global mixer time and updates the animation.
|
|
82
|
+
*
|
|
83
|
+
* This is usually done in the render loop by passing the delta
|
|
84
|
+
* time from {@link Clock} or {@link Timer}.
|
|
85
|
+
*
|
|
86
|
+
* @param {number} deltaTime - The delta time in seconds.
|
|
87
|
+
* @return {AnimationMixer} A reference to thi animation mixer.
|
|
88
|
+
*/
|
|
33
89
|
update(deltaTime: number): AnimationMixer;
|
|
34
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Sets the global mixer to a specific time and updates the animation accordingly.
|
|
92
|
+
*
|
|
93
|
+
* This is useful when you need to jump to an exact time in an animation. The
|
|
94
|
+
* input parameter will be scaled by {@link AnimationMixer#timeScale}
|
|
95
|
+
*
|
|
96
|
+
* @param {number} time - The time to set in seconds.
|
|
97
|
+
* @return {AnimationMixer} A reference to thi animation mixer.
|
|
98
|
+
*/
|
|
99
|
+
setTime(time: number): AnimationMixer;
|
|
100
|
+
/**
|
|
101
|
+
* Returns this mixer's root object.
|
|
102
|
+
*
|
|
103
|
+
* @return {Object3D} The mixer's root object.
|
|
104
|
+
*/
|
|
35
105
|
getRoot(): Object3D | AnimationObjectGroup;
|
|
106
|
+
/**
|
|
107
|
+
* Deallocates all memory resources for a clip. Before using this method make
|
|
108
|
+
* sure to call {@link AnimationAction#stop} for all related actions.
|
|
109
|
+
*
|
|
110
|
+
* @param {AnimationClip} clip - The clip to uncache.
|
|
111
|
+
*/
|
|
36
112
|
uncacheClip(clip: AnimationClip): void;
|
|
113
|
+
/**
|
|
114
|
+
* Deallocates all memory resources for a root object. Before using this
|
|
115
|
+
* method make sure to call {@link AnimationAction#stop} for all related
|
|
116
|
+
* actions or alternatively {@link AnimationMixer#stopAllAction} when the
|
|
117
|
+
* mixer operates on a single root.
|
|
118
|
+
*
|
|
119
|
+
* @param {Object3D} root - The root object to uncache.
|
|
120
|
+
*/
|
|
37
121
|
uncacheRoot(root: Object3D | AnimationObjectGroup): void;
|
|
38
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Deallocates all memory resources for an action. The action is identified by the
|
|
124
|
+
* given clip and an optional root object. Before using this method make
|
|
125
|
+
* sure to call {@link AnimationAction#stop} to deactivate the action.
|
|
126
|
+
*
|
|
127
|
+
* @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip.
|
|
128
|
+
* @param {Object3D} [optionalRoot] - An alternative root object.
|
|
129
|
+
*/
|
|
130
|
+
uncacheAction(clip: AnimationClip | string, optionalRoot?: Object3D | AnimationObjectGroup): void;
|
|
39
131
|
}
|