@esotericsoftware/spine-core 4.2.115 → 4.3.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.
- package/dist/Animation.d.ts +426 -274
- package/dist/Animation.js +1174 -1210
- package/dist/AnimationState.d.ts +246 -201
- package/dist/AnimationState.js +508 -471
- package/dist/AnimationStateData.d.ts +12 -10
- package/dist/AnimationStateData.js +19 -20
- package/dist/AssetManagerBase.d.ts +29 -23
- package/dist/AssetManagerBase.js +67 -43
- package/dist/AtlasAttachmentLoader.d.ts +18 -12
- package/dist/AtlasAttachmentLoader.js +28 -39
- package/dist/Bone.d.ts +15 -109
- package/dist/Bone.js +22 -362
- package/dist/BoneData.d.ts +13 -28
- package/dist/BoneData.js +20 -29
- package/dist/BonePose.d.ts +130 -0
- package/dist/BonePose.js +426 -0
- package/dist/Constraint.d.ts +41 -0
- package/dist/Constraint.js +38 -0
- package/dist/ConstraintData.d.ts +7 -5
- package/dist/ConstraintData.js +5 -9
- package/dist/DrawOrder.d.ts +48 -0
- package/dist/DrawOrder.js +64 -0
- package/dist/Event.d.ts +11 -6
- package/dist/Event.js +10 -5
- package/dist/EventData.d.ts +10 -6
- package/dist/EventData.js +18 -7
- package/dist/IkConstraint.d.ts +22 -28
- package/dist/IkConstraint.js +115 -117
- package/dist/IkConstraintData.d.ts +23 -18
- package/dist/IkConstraintData.js +32 -22
- package/dist/IkConstraintPose.d.ts +49 -0
- package/dist/IkConstraintPose.js +55 -0
- package/dist/PathConstraint.d.ts +18 -22
- package/dist/PathConstraint.js +160 -136
- package/dist/PathConstraintData.d.ts +11 -14
- package/dist/PathConstraintData.js +14 -16
- package/dist/PathConstraintPose.d.ts +43 -0
- package/dist/PathConstraintPose.js +49 -0
- package/dist/Physics.d.ts +39 -0
- package/dist/Physics.js +41 -0
- package/dist/PhysicsConstraint.d.ts +26 -30
- package/dist/PhysicsConstraint.js +102 -94
- package/dist/PhysicsConstraintData.d.ts +22 -12
- package/dist/PhysicsConstraintData.js +23 -12
- package/dist/PhysicsConstraintPose.d.ts +47 -0
- package/dist/PhysicsConstraintPose.js +55 -0
- package/dist/Pose.d.ts +33 -0
- package/dist/Pose.js +30 -0
- package/dist/Posed.d.ts +58 -0
- package/dist/Posed.js +78 -0
- package/dist/PosedActive.d.ts +41 -0
- package/dist/{attachments/HasTextureRegion.js → PosedActive.js} +17 -2
- package/dist/PosedData.d.ts +40 -0
- package/dist/PosedData.js +45 -0
- package/dist/Skeleton.d.ts +110 -99
- package/dist/Skeleton.js +271 -449
- package/dist/SkeletonBinary.d.ts +2 -2
- package/dist/SkeletonBinary.js +644 -466
- package/dist/SkeletonBounds.d.ts +4 -4
- package/dist/SkeletonBounds.js +45 -46
- package/dist/SkeletonClipping.d.ts +26 -22
- package/dist/SkeletonClipping.js +654 -340
- package/dist/SkeletonData.d.ts +18 -35
- package/dist/SkeletonData.js +57 -97
- package/dist/SkeletonJson.d.ts +8 -6
- package/dist/SkeletonJson.js +892 -641
- package/dist/SkeletonRendererCore.d.ts +58 -0
- package/dist/SkeletonRendererCore.js +310 -0
- package/dist/Skin.d.ts +20 -16
- package/dist/Skin.js +58 -53
- package/dist/Slider.d.ts +46 -0
- package/dist/Slider.js +115 -0
- package/dist/SliderData.d.ts +58 -0
- package/dist/SliderData.js +59 -0
- package/dist/SliderPose.d.ts +37 -0
- package/dist/SliderPose.js +40 -0
- package/dist/Slot.d.ts +16 -38
- package/dist/Slot.js +37 -60
- package/dist/SlotData.d.ts +5 -12
- package/dist/SlotData.js +7 -15
- package/dist/SlotPose.d.ts +59 -0
- package/dist/SlotPose.js +81 -0
- package/dist/Texture.d.ts +1 -0
- package/dist/Texture.js +2 -1
- package/dist/TextureAtlas.d.ts +3 -3
- package/dist/TextureAtlas.js +49 -49
- package/dist/TransformConstraint.d.ts +16 -28
- package/dist/TransformConstraint.js +72 -209
- package/dist/TransformConstraintData.d.ts +108 -20
- package/dist/TransformConstraintData.js +274 -24
- package/dist/TransformConstraintPose.d.ts +45 -0
- package/dist/TransformConstraintPose.js +52 -0
- package/dist/Triangulator.d.ts +1 -1
- package/dist/Triangulator.js +91 -107
- package/dist/{Updatable.d.ts → Update.d.ts} +5 -12
- package/dist/Update.js +30 -0
- package/dist/Utils.d.ts +13 -4
- package/dist/Utils.js +78 -37
- package/dist/attachments/Attachment.d.ts +27 -19
- package/dist/attachments/Attachment.js +59 -35
- package/dist/attachments/AttachmentLoader.d.ts +14 -14
- package/dist/attachments/AttachmentLoader.js +1 -1
- package/dist/attachments/BoundingBoxAttachment.d.ts +1 -1
- package/dist/attachments/BoundingBoxAttachment.js +2 -2
- package/dist/attachments/ClippingAttachment.d.ts +10 -3
- package/dist/attachments/ClippingAttachment.js +12 -3
- package/dist/attachments/{HasTextureRegion.d.ts → HasSequence.d.ts} +11 -14
- package/dist/attachments/HasSequence.js +30 -0
- package/dist/attachments/MeshAttachment.d.ts +28 -35
- package/dist/attachments/MeshAttachment.js +85 -97
- package/dist/attachments/PathAttachment.d.ts +3 -3
- package/dist/attachments/PathAttachment.js +6 -6
- package/dist/attachments/PointAttachment.d.ts +11 -6
- package/dist/attachments/PointAttachment.js +8 -3
- package/dist/attachments/RegionAttachment.d.ts +25 -27
- package/dist/attachments/RegionAttachment.js +101 -113
- package/dist/attachments/Sequence.d.ts +31 -6
- package/dist/attachments/Sequence.js +79 -13
- package/dist/esm/spine-core.min.mjs +2 -2
- package/dist/esm/spine-core.mjs +7651 -6090
- package/dist/esm/spine-core.mjs.map +4 -4
- package/dist/iife/spine-core.js +7651 -6090
- package/dist/iife/spine-core.js.map +4 -4
- package/dist/iife/spine-core.min.js +2 -2
- package/dist/index.d.ts +32 -11
- package/dist/index.js +33 -12
- package/dist/polyfills.js +4 -5
- package/package.json +1 -1
- package/dist/Updatable.js +0 -30
package/dist/AnimationState.d.ts
CHANGED
|
@@ -26,128 +26,152 @@
|
|
|
26
26
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
27
27
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
28
|
*****************************************************************************/
|
|
29
|
-
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
29
|
+
/** biome-ignore-all lint/style/noNonNullAssertion: reference runtime expects some nullable to not be null */
|
|
30
|
+
import { Animation, AttachmentTimeline, RotateTimeline } from "./Animation.js";
|
|
31
|
+
import type { AnimationStateData } from "./AnimationStateData.js";
|
|
32
|
+
import type { Event } from "./Event.js";
|
|
33
|
+
import type { Skeleton } from "./Skeleton.js";
|
|
34
|
+
import { Interpolation, Pool, StringSet } from "./Utils.js";
|
|
35
35
|
/** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies
|
|
36
36
|
* multiple animations on top of each other (layering).
|
|
37
37
|
*
|
|
38
|
-
* See [Applying Animations](http://esotericsoftware.com/spine-applying-animations
|
|
38
|
+
* See [Applying Animations](http://esotericsoftware.com/spine-applying-animations#AnimationState-API) in the Spine Runtimes Guide. */
|
|
39
39
|
export declare class AnimationState {
|
|
40
|
-
static
|
|
41
|
-
private static emptyAnimation;
|
|
40
|
+
static readonly emptyAnimation: Animation;
|
|
42
41
|
/** The AnimationStateData to look up mix durations. */
|
|
43
42
|
data: AnimationStateData;
|
|
44
|
-
/** The list of tracks that
|
|
45
|
-
tracks: (TrackEntry | null)[];
|
|
43
|
+
/** The list of tracks that have had animations. May contain null entries for tracks that currently have no animation. */
|
|
44
|
+
readonly tracks: (TrackEntry | null)[];
|
|
46
45
|
/** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
|
|
47
46
|
* or faster. Defaults to 1.
|
|
48
47
|
*
|
|
49
|
-
* See
|
|
48
|
+
* See {@link TrackEntry.timeScale} to affect a single animation. */
|
|
50
49
|
timeScale: number;
|
|
51
50
|
unkeyedState: number;
|
|
52
|
-
events: Event[];
|
|
53
|
-
listeners: AnimationStateListener[];
|
|
51
|
+
readonly events: Event[];
|
|
52
|
+
readonly listeners: AnimationStateListener[];
|
|
54
53
|
queue: EventQueue;
|
|
55
|
-
|
|
54
|
+
propertyIds: StringSet;
|
|
56
55
|
animationsChanged: boolean;
|
|
57
56
|
trackEntryPool: Pool<TrackEntry>;
|
|
58
57
|
constructor(data: AnimationStateData);
|
|
59
|
-
/** Increments each track entry {@link TrackEntry
|
|
58
|
+
/** Increments each track entry {@link TrackEntry.trackTime}, setting queued animations as current if needed. */
|
|
60
59
|
update(delta: number): void;
|
|
61
60
|
/** Returns true when all mixing from entries are complete. */
|
|
62
61
|
updateMixingFrom(to: TrackEntry, delta: number): boolean;
|
|
63
|
-
/** Poses the skeleton using the track entry animations.
|
|
64
|
-
*
|
|
62
|
+
/** Poses the skeleton using the track entry animations. The animation state is not changed, so can be applied to multiple
|
|
63
|
+
* skeletons to pose them identically.
|
|
65
64
|
* @returns True if any animations were applied. */
|
|
66
65
|
apply(skeleton: Skeleton): boolean;
|
|
67
|
-
applyMixingFrom(to: TrackEntry, skeleton: Skeleton
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
applyMixingFrom(to: TrackEntry, skeleton: Skeleton): number;
|
|
67
|
+
/** Applies the attachment timeline and sets {@link Slot.attachmentState}.
|
|
68
|
+
* @param retain True if the attachment remains after apply, false if temporary for deform timelines. */
|
|
69
|
+
applyAttachmentTimeline(timeline: AttachmentTimeline, skeleton: Skeleton, time: number, fromSetup: boolean, retain: boolean): void;
|
|
70
|
+
/** Applies the rotate timeline, mixing with the current pose while keeping the same rotation direction chosen as the shortest
|
|
71
|
+
* the first time the mixing was applied. */
|
|
72
|
+
applyRotateTimeline(timeline: RotateTimeline, skeleton: Skeleton, time: number, alpha: number, fromSetup: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
|
71
73
|
queueEvents(entry: TrackEntry, animationTime: number): void;
|
|
74
|
+
private eventsReverse;
|
|
72
75
|
/** Removes all animations from all tracks, leaving skeletons in their current pose.
|
|
73
76
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
77
|
+
* Usually you want to use {@link setEmptyAnimations} to mix the skeletons back to the setup pose, rather than leaving
|
|
78
|
+
* them in their current pose. */
|
|
76
79
|
clearTracks(): void;
|
|
77
80
|
/** Removes all animations from the track, leaving skeletons in their current pose.
|
|
78
81
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
82
|
+
* Usually you want to use {@link setEmptyAnimation} to mix the skeletons back to the setup pose, rather than
|
|
83
|
+
* leaving them in their current pose. */
|
|
81
84
|
clearTrack(trackIndex: number): void;
|
|
82
|
-
|
|
85
|
+
setTrack(index: number, current: TrackEntry, interrupt: boolean): void;
|
|
83
86
|
/** Sets an animation by name.
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
*
|
|
88
|
+
* See {@link setAnimation}. */
|
|
86
89
|
setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
|
|
87
|
-
/** Sets the current animation for a track, discarding any queued animations.
|
|
88
|
-
*
|
|
90
|
+
/** Sets the current animation for a track, discarding any queued animations.
|
|
91
|
+
*
|
|
92
|
+
* If the formerly current track entry is for the same animation and was never applied to a skeleton, it is replaced (not mixed
|
|
93
|
+
* from).
|
|
94
|
+
* @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
95
|
+
* duration. In either case {@link TrackEntry.trackEnd} determines when the track is cleared.
|
|
96
|
+
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
97
|
+
* after the {@link AnimationStateListener.dispose} event occurs. */
|
|
98
|
+
setAnimation(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
|
|
99
|
+
private setAnimation1;
|
|
100
|
+
/** Sets the current animation for a track, discarding any queued animations.
|
|
101
|
+
*
|
|
102
|
+
* If the formerly current track entry is for the same animation and was never applied to a skeleton, it is replaced (not mixed
|
|
103
|
+
* from).
|
|
89
104
|
* @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
90
|
-
* duration. In either case {@link TrackEntry
|
|
91
|
-
* @
|
|
92
|
-
* after the {@link AnimationStateListener
|
|
93
|
-
|
|
105
|
+
* duration. In either case {@link TrackEntry.getTrackEnd} determines when the track is cleared.
|
|
106
|
+
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
107
|
+
* after the {@link AnimationStateListener.dispose} event occurs. */
|
|
108
|
+
private setAnimation2;
|
|
94
109
|
/** Queues an animation by name.
|
|
95
110
|
*
|
|
96
|
-
* See {@link
|
|
111
|
+
* See {@link addAnimation}. */
|
|
97
112
|
addAnimation(trackIndex: number, animationName: string, loop?: boolean, delay?: number): TrackEntry;
|
|
98
|
-
/** Adds an animation to be played after the current or last queued animation for a track. If the track
|
|
99
|
-
* equivalent to calling {@link
|
|
100
|
-
* @param delay If > 0, sets {@link TrackEntry
|
|
101
|
-
* minus any mix duration (from
|
|
102
|
-
*
|
|
113
|
+
/** Adds an animation to be played after the current or last queued animation for a track. If the track has no entries, this is
|
|
114
|
+
* equivalent to calling {@link setAnimation}.
|
|
115
|
+
* @param delay If > 0, sets {@link TrackEntry.delay}. If <= 0, the delay set is the duration of the previous track entry
|
|
116
|
+
* minus any mix duration (from {@link data}) plus the specified `delay` (ie the mix ends at (when
|
|
117
|
+
* `delay` = 0) or before (when `delay` < 0) the previous track entry duration). If the
|
|
103
118
|
* previous entry is looping, its next loop completion is used instead of its duration.
|
|
104
|
-
* @
|
|
105
|
-
* after the {@link AnimationStateListener
|
|
106
|
-
|
|
119
|
+
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
120
|
+
* after the {@link AnimationStateListener.dispose} event occurs. */
|
|
121
|
+
addAnimation(trackIndex: number, animation: Animation, loop?: boolean, delay?: number): TrackEntry;
|
|
122
|
+
private addAnimation1;
|
|
123
|
+
private addAnimation2;
|
|
107
124
|
/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
|
|
108
|
-
* {@link TrackEntry
|
|
125
|
+
* {@link TrackEntry.mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
|
|
109
126
|
*
|
|
110
|
-
* Mixing out is done by setting an empty animation with a mix duration using either {@link
|
|
111
|
-
* {@link
|
|
127
|
+
* Mixing out is done by setting an empty animation with a mix duration using either {@link setEmptyAnimation},
|
|
128
|
+
* {@link setEmptyAnimations}, or {@link addEmptyAnimation}. Mixing to an empty animation causes
|
|
112
129
|
* the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
|
|
113
130
|
* transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
|
|
114
|
-
* 0 still
|
|
131
|
+
* 0 still needs to be applied one more time to mix out, so the properties it was animating are reverted.
|
|
115
132
|
*
|
|
116
133
|
* Mixing in is done by first setting an empty animation, then adding an animation using
|
|
117
|
-
* {@link
|
|
118
|
-
* {@link TrackEntry
|
|
119
|
-
* more over the mix duration. Properties keyed in the new animation transition from the value
|
|
120
|
-
* setup pose value if no lower tracks key the property to the value keyed in the new animation.
|
|
134
|
+
* {@link addAnimation} with the desired delay (an empty animation has a duration of 0) and on
|
|
135
|
+
* the returned track entry, set the {@link TrackEntry.setMixDuration}. Mixing from an empty animation causes the new
|
|
136
|
+
* animation to be applied more and more over the mix duration. Properties keyed in the new animation transition from the value
|
|
137
|
+
* from lower tracks or from the setup pose value if no lower tracks key the property to the value keyed in the new animation.
|
|
138
|
+
*
|
|
139
|
+
* See <a href='https://esotericsoftware.com/spine-applying-animations#Empty-animations'>Empty animations</a> in the Spine
|
|
140
|
+
* Runtimes Guide. */
|
|
121
141
|
setEmptyAnimation(trackIndex: number, mixDuration?: number): TrackEntry;
|
|
122
142
|
/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
|
|
123
|
-
* {@link TrackEntry
|
|
124
|
-
* {@link
|
|
125
|
-
*
|
|
126
|
-
* See {@link
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
143
|
+
* {@link TrackEntry.mixDuration}. If the track has no entries, it is equivalent to calling
|
|
144
|
+
* {@link setEmptyAnimation}.
|
|
145
|
+
*
|
|
146
|
+
* See {@link setEmptyAnimation} and
|
|
147
|
+
* <a href='https://esotericsoftware.com/spine-applying-animations#Empty-animations'>Empty animations</a> in the Spine Runtimes
|
|
148
|
+
* Guide.
|
|
149
|
+
* @param delay If > 0, sets {@link TrackEntry.delay}. If <= 0, the delay set is the duration of the previous track entry minus
|
|
150
|
+
* any mix duration plus the specified `delay` (ie the mix ends at (when `delay` = 0) or before
|
|
151
|
+
* (when `delay` < 0) the previous track entry duration). If the previous entry is looping, its next loop
|
|
152
|
+
* completion is used instead of its duration.
|
|
131
153
|
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
132
|
-
* after the {@link AnimationStateListener
|
|
154
|
+
* after the {@link AnimationStateListener.dispose} event occurs. */
|
|
133
155
|
addEmptyAnimation(trackIndex: number, mixDuration?: number, delay?: number): TrackEntry;
|
|
134
|
-
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
|
|
135
|
-
|
|
156
|
+
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration.
|
|
157
|
+
*
|
|
158
|
+
* See <a href='https://esotericsoftware.com/spine-applying-animations#Empty-animations'>Empty animations</a> in the Spine
|
|
159
|
+
* Runtimes Guide. */
|
|
136
160
|
setEmptyAnimations(mixDuration?: number): void;
|
|
137
161
|
expandToIndex(index: number): TrackEntry | null;
|
|
138
162
|
/** @param last May be null. */
|
|
139
163
|
trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry | null): TrackEntry;
|
|
140
|
-
/** Removes
|
|
164
|
+
/** Removes {@link TrackEntry.next} and all entries after it for the specified entry. */
|
|
141
165
|
clearNext(entry: TrackEntry): void;
|
|
142
166
|
_animationsChanged(): void;
|
|
143
167
|
computeHold(entry: TrackEntry): void;
|
|
144
168
|
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
145
|
-
|
|
169
|
+
getTrack(trackIndex: number): TrackEntry | null;
|
|
146
170
|
/** Adds a listener to receive events for all track entries. */
|
|
147
171
|
addListener(listener: AnimationStateListener): void;
|
|
148
|
-
/** Removes the listener added with {@link
|
|
172
|
+
/** Removes the listener added with {@link addListener}. */
|
|
149
173
|
removeListener(listener: AnimationStateListener): void;
|
|
150
|
-
/** Removes all listeners added with {@link
|
|
174
|
+
/** Removes all listeners added with {@link addListener}. */
|
|
151
175
|
clearListeners(): void;
|
|
152
176
|
/** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
|
|
153
177
|
* {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
|
|
@@ -156,84 +180,94 @@ export declare class AnimationState {
|
|
|
156
180
|
}
|
|
157
181
|
/** Stores settings and other state for the playback of an animation on an {@link AnimationState} track.
|
|
158
182
|
*
|
|
159
|
-
* References to a track entry must not be kept after the {@link AnimationStateListener
|
|
183
|
+
* References to a track entry must not be kept after the {@link AnimationStateListener.dispose} event occurs. */
|
|
160
184
|
export declare class TrackEntry {
|
|
161
185
|
/** The animation to apply for this track entry. */
|
|
162
186
|
animation: Animation | null;
|
|
163
187
|
previous: TrackEntry | null;
|
|
164
188
|
/** The animation queued to start after this animation, or null. `next` makes up a linked list. */
|
|
165
189
|
next: TrackEntry | null;
|
|
166
|
-
/** The track entry for the previous animation when mixing
|
|
167
|
-
*
|
|
190
|
+
/** The track entry for the previous animation when mixing to this animation, or null if no mixing is currently occurring.
|
|
191
|
+
* When mixing from multiple animations, `mixingFrom` makes up a doubly linked list. */
|
|
168
192
|
mixingFrom: TrackEntry | null;
|
|
169
|
-
/** The track entry for the next animation when mixing from this animation
|
|
170
|
-
*
|
|
193
|
+
/** The track entry for the next animation when mixing from this animation, or null if no mixing is currently occurring.
|
|
194
|
+
* When mixing to multiple animations, `mixingTo` makes up a doubly linked list. */
|
|
171
195
|
mixingTo: TrackEntry | null;
|
|
172
196
|
/** The listener for events generated by this track entry, or null.
|
|
173
197
|
*
|
|
174
|
-
* A track entry returned from {@link AnimationState
|
|
175
|
-
* for the track, so the
|
|
198
|
+
* A track entry returned from {@link AnimationState.setAnimation} is already the current animation
|
|
199
|
+
* for the track, so the callback for listener {@link AnimationStateListener.start} will not be called. */
|
|
176
200
|
listener: AnimationStateListener | null;
|
|
177
201
|
/** The index of the track where this track entry is either current or queued.
|
|
178
202
|
*
|
|
179
|
-
* See {@link AnimationState
|
|
203
|
+
* See {@link AnimationState.getTrack}. */
|
|
180
204
|
trackIndex: number;
|
|
181
205
|
/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
182
206
|
* duration. */
|
|
183
207
|
loop: boolean;
|
|
184
|
-
/**
|
|
185
|
-
* of
|
|
186
|
-
*
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
|
|
190
|
-
* at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
|
|
191
|
-
* keys the property, only when a higher track also keys the property.
|
|
192
|
-
*
|
|
193
|
-
* Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
|
|
194
|
-
* previous animation. */
|
|
195
|
-
holdPrevious: boolean;
|
|
208
|
+
/** When true, timelines in this animation that support additive have their values added to the setup or current pose values
|
|
209
|
+
* instead of replacing them. Additive can be set for a new track entry only before {@link AnimationState.apply}
|
|
210
|
+
* is next called. */
|
|
211
|
+
additive: boolean;
|
|
212
|
+
/** If true, the animation will be applied in reverse. */
|
|
196
213
|
reverse: boolean;
|
|
214
|
+
/** If true, mixing rotation between tracks always uses the shortest rotation direction. If the rotation is animated, the
|
|
215
|
+
* shortest rotation direction may change during the mix.
|
|
216
|
+
*
|
|
217
|
+
* If false, the shortest rotation direction is remembered when the mix starts and the same direction is used for the rest
|
|
218
|
+
* of the mix. Defaults to false.
|
|
219
|
+
*
|
|
220
|
+
* See {@link resetRotationDirections}. */
|
|
197
221
|
shortestRotation: boolean;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
* timelines are not applied while this animation is being mixed
|
|
222
|
+
keepHold: boolean;
|
|
223
|
+
/** When the interpolated mix percentage is less than the `eventThreshold` , event timelines are applied while
|
|
224
|
+
* this animation is being mixed out. Defaults to 0, so event timelines are not applied while this animation is being mixed
|
|
225
|
+
* out. */
|
|
201
226
|
eventThreshold: number;
|
|
202
|
-
/** When the mix percentage
|
|
203
|
-
*
|
|
204
|
-
*
|
|
227
|
+
/** When the interpolated mix percentage is less than the `mixAttachmentThreshold`, attachment timelines are
|
|
228
|
+
* applied while this animation is being mixed out. Defaults to 0, so attachment timelines are not applied while this
|
|
229
|
+
* animation is being mixed out. */
|
|
205
230
|
mixAttachmentThreshold: number;
|
|
206
|
-
/** When
|
|
207
|
-
* Defaults to 0, so attachment timelines are
|
|
231
|
+
/** When the computed alpha is greater than `alphaAttachmentThreshold`, attachment timelines are applied. The
|
|
232
|
+
* computed alpha includes {@link alpha} and the interpolated mix percentage. Defaults to 0, so attachment timelines are
|
|
233
|
+
* always applied. */
|
|
208
234
|
alphaAttachmentThreshold: number;
|
|
209
|
-
/** When the mix percentage
|
|
210
|
-
*
|
|
211
|
-
*
|
|
235
|
+
/** When the interpolated mix percentage is less than the `mixAttachmentThreshold`, attachment timelines are
|
|
236
|
+
* applied while this animation is being mixed out. Defaults to 0, so attachment timelines are not applied while this
|
|
237
|
+
* animation is being mixed out. */
|
|
212
238
|
mixDrawOrderThreshold: number;
|
|
213
|
-
/**
|
|
239
|
+
/** The time in seconds for the first frame of this animation, both initially and after looping. Defaults to 0.
|
|
214
240
|
*
|
|
215
|
-
* When
|
|
216
|
-
*
|
|
241
|
+
* When setting `animationStart` time, {@link animationLast} can be set to the same value to avoid firing events
|
|
242
|
+
* from the start of the animation. */
|
|
217
243
|
animationStart: number;
|
|
218
|
-
/**
|
|
219
|
-
* loop back to {@link
|
|
244
|
+
/** The time in seconds for the last frame of this animation. Past this time, non-looping animations hold the pose at this
|
|
245
|
+
* time while looping animations will loop back to {@link animationStart}. Defaults to the {@link Animation.duration}. */
|
|
220
246
|
animationEnd: number;
|
|
221
|
-
/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers.
|
|
222
|
-
* animation is applied, event timelines will fire all events between the `animationLast` time (exclusive)
|
|
223
|
-
* `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this
|
|
224
|
-
* is applied. */
|
|
247
|
+
/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. For example, when
|
|
248
|
+
* this animation is applied, event timelines will fire all events between the `animationLast` time (exclusive)
|
|
249
|
+
* and `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this
|
|
250
|
+
* animation is applied. */
|
|
225
251
|
animationLast: number;
|
|
226
252
|
nextAnimationLast: number;
|
|
227
|
-
/** Seconds to postpone playing the animation. When this track entry is the current track entry,
|
|
228
|
-
* postpones incrementing the {@link
|
|
229
|
-
* the start of the previous animation to when this track entry will become the current track entry (ie when
|
|
230
|
-
* track entry {@link
|
|
253
|
+
/** Seconds to postpone playing the animation. Must be >= 0. When this track entry is the current track entry,
|
|
254
|
+
* `delay` postpones incrementing the {@link trackTime}. When this track entry is queued, `delay` is
|
|
255
|
+
* the time from the start of the previous animation to when this track entry will become the current track entry (ie when
|
|
256
|
+
* the previous track entry {@link trackTime} >= this track entry's `delay`).
|
|
231
257
|
*
|
|
232
|
-
* {@link
|
|
258
|
+
* {@link timeScale} affects the delay.
|
|
259
|
+
*
|
|
260
|
+
* When passing `delay` <= 0 to {@link AnimationState.addAnimation} this
|
|
261
|
+
* `delay` is set using a mix duration from {@link AnimationStateData}. To change the {@link mixDuration}
|
|
262
|
+
* afterward, use {@link setMixDuration} so this `delay` is adjusted. */
|
|
233
263
|
delay: number;
|
|
234
|
-
/**
|
|
235
|
-
* {@link
|
|
236
|
-
*
|
|
264
|
+
/** The time in seconds this track entry has been the current track entry, starting at 0 and increasing forever. Compare to
|
|
265
|
+
* {@link getAnimationTime}, which is always between {@link animationStart} and {@link animationEnd}.
|
|
266
|
+
*
|
|
267
|
+
* The track time can be set to start the animation at a time other than 0, without affecting looping. When doing so,
|
|
268
|
+
* {@link animationLast} can be set to the same value to avoid firing events from the start of the animation.
|
|
269
|
+
*
|
|
270
|
+
* To set the time an animation starts and loops, use {@link animationStart} and {@link animationEnd}. */
|
|
237
271
|
trackTime: number;
|
|
238
272
|
trackLast: number;
|
|
239
273
|
nextTrackLast: number;
|
|
@@ -242,88 +276,115 @@ export declare class TrackEntry {
|
|
|
242
276
|
* is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
|
|
243
277
|
* properties keyed by the animation are set to the setup pose and the track is cleared.
|
|
244
278
|
*
|
|
245
|
-
*
|
|
279
|
+
* Usually you want to use {@link AnimationState.addEmptyAnimation} rather than have the animation
|
|
246
280
|
* abruptly cease being applied. */
|
|
247
281
|
trackEnd: number;
|
|
248
282
|
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
|
|
249
283
|
* faster. Defaults to 1.
|
|
250
284
|
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
285
|
+
* Values < 0 are not supported. To play an animation in reverse, use {@link reverse}.
|
|
286
|
+
*
|
|
287
|
+
* {@link mixTime} is not affected by track entry time scale, so {@link mixDuration} may need to be adjusted to match the
|
|
288
|
+
* animation speed.
|
|
253
289
|
*
|
|
254
|
-
* When using {@link AnimationState
|
|
255
|
-
* {@link
|
|
256
|
-
*
|
|
290
|
+
* When using {@link AnimationState.addAnimation} with a `delay` <= 0, the
|
|
291
|
+
* {@link delay} is set using the mix duration from {@link AnimationState.data}, assuming time scale to be 1. If the time
|
|
292
|
+
* scale is not 1, the delay may need to be adjusted.
|
|
257
293
|
*
|
|
258
|
-
* See
|
|
294
|
+
* See {@link AnimationState.timeScale} to affect all animations. */
|
|
259
295
|
timeScale: number;
|
|
260
|
-
/** Values < 1 mix this animation with the skeleton's current pose (
|
|
261
|
-
* to 1, which overwrites the skeleton's current pose with this animation.
|
|
296
|
+
/** Values < 1 mix this animation with the skeleton's current pose (either the setup pose or the pose from lower tracks).
|
|
297
|
+
* Defaults to 1, which overwrites the skeleton's current pose with this animation.
|
|
262
298
|
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
299
|
+
* Alpha should be 1 on track 0.
|
|
300
|
+
*
|
|
301
|
+
* See {@link getAlphaAttachmentThreshold}. */
|
|
265
302
|
alpha: number;
|
|
266
|
-
/** Seconds from 0 to the {@link
|
|
267
|
-
* slightly more than `mixDuration` when the mix is complete. */
|
|
303
|
+
/** Seconds elapsed from 0 to the {@link mixDuration} when mixing from the previous animation to this animation. May
|
|
304
|
+
* be slightly more than `mixDuration` when the mix is complete. */
|
|
268
305
|
mixTime: number;
|
|
269
|
-
/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by
|
|
270
|
-
* {@link AnimationStateData
|
|
306
|
+
/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by
|
|
307
|
+
* {@link AnimationStateData.getMix} based on the animation before this animation (if any).
|
|
271
308
|
*
|
|
272
|
-
* A mix duration of 0 still
|
|
273
|
-
*
|
|
309
|
+
* A mix duration of 0 still needs to be applied one more time to mix out, so the the properties it was animating are
|
|
310
|
+
* reverted. A mix duration of 0 can be set at any time to end the mix on the next
|
|
311
|
+
* {@link AnimationState.update | update}.
|
|
274
312
|
*
|
|
275
313
|
* The `mixDuration` can be set manually rather than use the value from
|
|
276
|
-
* {@link AnimationStateData
|
|
277
|
-
* track entry only before {@link AnimationState
|
|
278
|
-
*
|
|
279
|
-
* When using {@link AnimationState
|
|
280
|
-
* {@link
|
|
281
|
-
* afterward
|
|
282
|
-
|
|
283
|
-
|
|
314
|
+
* {@link AnimationStateData.getMix}. In that case, the `mixDuration` can be set for a new
|
|
315
|
+
* track entry only before {@link AnimationState.update} is next called.
|
|
316
|
+
*
|
|
317
|
+
* When using {@link AnimationState.addAnimation} with a `delay` <= 0, the
|
|
318
|
+
* {@link getDelay} is set using the mix duration from {@link AnimationState.data}. If `mixDuration` is set
|
|
319
|
+
* afterward, the delay needs to be adjusted:
|
|
320
|
+
*
|
|
321
|
+
* <pre>
|
|
322
|
+
* entry.mixDuration = 0.25;<br>
|
|
323
|
+
* entry.delay = entry.previous.getTrackComplete() - entry.mixDuration + 0;
|
|
324
|
+
* </pre>
|
|
325
|
+
*
|
|
326
|
+
* Alternatively, use {@link setMixDuration} to set both the mix duration and recompute the delay:<br>
|
|
327
|
+
*
|
|
328
|
+
* <pre>
|
|
329
|
+
entry.setMixDuration(0.25f, 0); // mixDuration, delay
|
|
330
|
+
* </pre>
|
|
331
|
+
*/
|
|
332
|
+
mixDuration: number;
|
|
284
333
|
totalAlpha: number;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
*
|
|
294
|
-
|
|
334
|
+
mixInterpolation: Interpolation;
|
|
335
|
+
/** Sets both {@link getMixDuration} and {@link getDelay}.
|
|
336
|
+
* @param delay If > 0, sets {@link getDelay}. If <= 0, the delay set is the duration of the previous track entry minus
|
|
337
|
+
* the specified mix duration plus the specified `delay` (ie the mix ends at (when `delay` =
|
|
338
|
+
* 0) or before (when `delay` < 0) the previous track entry duration). If the previous entry is
|
|
339
|
+
* looping, its next loop completion is used instead of its duration. */
|
|
340
|
+
setMixDuration(mixDuration: number, delay?: number): void;
|
|
341
|
+
/** The interpolation to apply to the mix percentage ({@link mixTime} / {@link mixDuration}) when mixing from the previous
|
|
342
|
+
* animation to this animation. Defaults to linear. */
|
|
343
|
+
setMixInterpolation(mixInterpolation: Interpolation): void;
|
|
344
|
+
mix(): number;
|
|
345
|
+
/** For each timeline:
|
|
346
|
+
* - Bit 0, FIRST: 0 = mix from current pose, 1 = mix from setup pose. Timeline is first to set the property.
|
|
347
|
+
* - Bit 1, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
|
|
348
|
+
* set the property and the next entry (mixingTo) also sets it. When held, timelineHoldMix's mix controls how the hold fades
|
|
349
|
+
* out (for 3+ entry chains where the chain eventually stops setting the property). */
|
|
295
350
|
timelineMode: number[];
|
|
296
351
|
timelineHoldMix: TrackEntry[];
|
|
297
352
|
timelinesRotation: number[];
|
|
298
353
|
reset(): void;
|
|
299
|
-
/** Uses {@link
|
|
300
|
-
*
|
|
354
|
+
/** Uses {@link trackTime} to compute the `animationTime`, which is always between {@link animationStart} and
|
|
355
|
+
* {@link animationEnd}. When `trackTime` is 0, `animationTime` is equal to the
|
|
301
356
|
* `animationStart` time. */
|
|
302
357
|
getAnimationTime(): number;
|
|
303
358
|
setAnimationLast(animationLast: number): void;
|
|
304
359
|
/** Returns true if at least one loop has been completed.
|
|
305
360
|
*
|
|
306
|
-
* See {@link AnimationStateListener
|
|
361
|
+
* See {@link AnimationStateListener.complete}. */
|
|
307
362
|
isComplete(): boolean;
|
|
308
|
-
/**
|
|
309
|
-
* long way around when using {@link
|
|
363
|
+
/** When {@link shortestRotation} is false, this clears the directions for mixing this entry's rotation. This can be useful
|
|
364
|
+
* to avoid bones rotating the long way around when using {@link getAlpha} and starting animations on other tracks.
|
|
310
365
|
*
|
|
311
|
-
* Mixing
|
|
312
|
-
*
|
|
313
|
-
* way
|
|
314
|
-
*
|
|
366
|
+
* Mixing involves finding a rotation between two others. There are two possible solutions: the short or the long way
|
|
367
|
+
* around. When the two rotations change over time, which direction is the short or long way can also change. If the short
|
|
368
|
+
* way was always chosen, bones flip to the other side when that direction became the long way. TrackEntry chooses the short
|
|
369
|
+
* way the first time it is applied and remembers that direction. Resetting that direction makes it choose a new short way
|
|
370
|
+
* on the next apply. */
|
|
315
371
|
resetRotationDirections(): void;
|
|
372
|
+
/** If this track entry is non-looping, this is the track time in seconds when {@link animationEnd} is reached, or the
|
|
373
|
+
* current {@link trackTime} if it has already been reached.
|
|
374
|
+
*
|
|
375
|
+
* If this track entry is looping, this is the track time when this animation will reach its next {@link animationEnd} (the
|
|
376
|
+
* next loop completion). */
|
|
316
377
|
getTrackComplete(): number;
|
|
317
378
|
/** Returns true if this track entry has been applied at least once.
|
|
318
|
-
*
|
|
319
|
-
* See {@link AnimationState
|
|
379
|
+
*
|
|
380
|
+
* See {@link AnimationState.apply}. */
|
|
320
381
|
wasApplied(): boolean;
|
|
321
|
-
/** Returns true if there is a {@link
|
|
322
|
-
* {@link AnimationState
|
|
382
|
+
/** Returns true if there is a {@link next} track entry and it will become the current track entry during the next
|
|
383
|
+
* {@link AnimationState.update}. */
|
|
323
384
|
isNextReady(): boolean;
|
|
324
385
|
}
|
|
325
386
|
export declare class EventQueue {
|
|
326
|
-
objects: Array<
|
|
387
|
+
objects: Array<EventType | TrackEntry | Event>;
|
|
327
388
|
drainDisabled: boolean;
|
|
328
389
|
animState: AnimationState;
|
|
329
390
|
constructor(animState: AnimationState);
|
|
@@ -347,20 +408,34 @@ export declare enum EventType {
|
|
|
347
408
|
/** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
|
|
348
409
|
* events.
|
|
349
410
|
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
411
|
+
* TrackEntry events are collected during {@link AnimationState.update} and {@link AnimationState.apply} and
|
|
412
|
+
* fired only after those methods are finished.
|
|
413
|
+
*
|
|
414
|
+
* See {@link TrackEntry.listener} and
|
|
415
|
+
* {@link AnimationState.addListener}. */
|
|
352
416
|
export interface AnimationStateListener {
|
|
353
|
-
/** Invoked when this entry has been set as the current entry.
|
|
417
|
+
/** Invoked when this entry has been set as the current entry. {@link end} will occur when this entry will no
|
|
418
|
+
* longer be applied.
|
|
419
|
+
*
|
|
420
|
+
* When this event is triggered by calling {@link AnimationState.setAnimation}, take care not to
|
|
421
|
+
* call {@link AnimationState.update} until after the TrackEntry has been configured. */
|
|
354
422
|
start?: (entry: TrackEntry) => void;
|
|
355
423
|
/** Invoked when another entry has replaced this entry as the current entry. This entry may continue being applied for
|
|
356
424
|
* mixing. */
|
|
357
425
|
interrupt?: (entry: TrackEntry) => void;
|
|
358
|
-
/** Invoked when this entry
|
|
426
|
+
/** Invoked when this entry will never be applied again. This only occurs if this entry has previously been set as the
|
|
427
|
+
* current entry ({@link start} was invoked). */
|
|
359
428
|
end?: (entry: TrackEntry) => void;
|
|
360
429
|
/** Invoked when this entry will be disposed. This may occur without the entry ever being set as the current entry.
|
|
361
430
|
* References to the entry should not be kept after dispose is called, as it may be destroyed or reused. */
|
|
362
431
|
dispose?: (entry: TrackEntry) => void;
|
|
363
|
-
/** Invoked every time this entry's animation completes a loop.
|
|
432
|
+
/** Invoked every time this entry's animation completes a loop. This may occur during mixing (after
|
|
433
|
+
* {@link interrupt}).
|
|
434
|
+
*
|
|
435
|
+
* If this entry's {@link TrackEntry.mixingTo} is not null, this entry is mixing out (it is not the current entry).
|
|
436
|
+
*
|
|
437
|
+
* Because this event is triggered at the end of {@link AnimationState.apply}, any animations set in response to
|
|
438
|
+
* the event won't be applied until the next time the AnimationState is applied. */
|
|
364
439
|
complete?: (entry: TrackEntry) => void;
|
|
365
440
|
/** Invoked when this entry's animation triggers an event. */
|
|
366
441
|
event?: (entry: TrackEntry, event: Event) => void;
|
|
@@ -373,39 +448,9 @@ export declare abstract class AnimationStateAdapter implements AnimationStateLis
|
|
|
373
448
|
complete(entry: TrackEntry): void;
|
|
374
449
|
event(entry: TrackEntry, event: Event): void;
|
|
375
450
|
}
|
|
376
|
-
/** 1. A previously applied timeline has set this property.
|
|
377
|
-
*
|
|
378
|
-
* Result: Mix from the current pose to the timeline pose. */
|
|
379
451
|
export declare const SUBSEQUENT = 0;
|
|
380
|
-
/** 1. This is the first timeline to set this property.
|
|
381
|
-
* 2. The next track entry applied after this one does not have a timeline to set this property.
|
|
382
|
-
*
|
|
383
|
-
* Result: Mix from the setup pose to the timeline pose. */
|
|
384
452
|
export declare const FIRST = 1;
|
|
385
|
-
|
|
386
|
-
* 2) The next track entry to be applied does have a timeline to set this property.<br>
|
|
387
|
-
* 3) The next track entry after that one does not have a timeline to set this property.<br>
|
|
388
|
-
* Result: Mix from the current pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading
|
|
389
|
-
* animations that key the same property. A subsequent timeline will set this property using a mix. */
|
|
390
|
-
export declare const HOLD_SUBSEQUENT = 2;
|
|
391
|
-
/** 1) This is the first timeline to set this property.<br>
|
|
392
|
-
* 2) The next track entry to be applied does have a timeline to set this property.<br>
|
|
393
|
-
* 3) The next track entry after that one does not have a timeline to set this property.<br>
|
|
394
|
-
* Result: Mix from the setup pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading animations
|
|
395
|
-
* that key the same property. A subsequent timeline will set this property using a mix. */
|
|
453
|
+
export declare const HOLD = 2;
|
|
396
454
|
export declare const HOLD_FIRST = 3;
|
|
397
|
-
/** 1. This is the first timeline to set this property.
|
|
398
|
-
* 2. The next track entry to be applied does have a timeline to set this property.
|
|
399
|
-
* 3. The next track entry after that one does have a timeline to set this property.
|
|
400
|
-
* 4. timelineHoldMix stores the first subsequent track entry that does not have a timeline to set this property.
|
|
401
|
-
*
|
|
402
|
-
* Result: The same as HOLD except the mix percentage from the timelineHoldMix track entry is used. This handles when more than
|
|
403
|
-
* 2 track entries in a row have a timeline that sets the same property.
|
|
404
|
-
*
|
|
405
|
-
* Eg, A -> B -> C -> D where A, B, and C have a timeline setting same property, but D does not. When A is applied, to avoid
|
|
406
|
-
* "dipping" A is not mixed out, however D (the first entry that doesn't set the property) mixing in is used to mix out A
|
|
407
|
-
* (which affects B and C). Without using D to mix out, A would be applied fully until mixing completes, then snap into
|
|
408
|
-
* place. */
|
|
409
|
-
export declare const HOLD_MIX = 4;
|
|
410
455
|
export declare const SETUP = 1;
|
|
411
|
-
export declare const
|
|
456
|
+
export declare const RETAIN = 2;
|