@esotericsoftware/spine-core 4.1.2 → 4.1.6

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.
Files changed (96) hide show
  1. package/dist/Animation.d.ts +382 -382
  2. package/dist/Animation.js +2058 -2031
  3. package/dist/AnimationState.d.ts +396 -396
  4. package/dist/AnimationState.js +1083 -959
  5. package/dist/AnimationStateData.d.ts +51 -51
  6. package/dist/AnimationStateData.js +72 -70
  7. package/dist/AssetManagerBase.d.ts +74 -72
  8. package/dist/AssetManagerBase.js +304 -303
  9. package/dist/AtlasAttachmentLoader.d.ts +53 -53
  10. package/dist/AtlasAttachmentLoader.js +95 -94
  11. package/dist/Bone.d.ts +138 -138
  12. package/dist/Bone.js +340 -334
  13. package/dist/BoneData.d.ts +72 -72
  14. package/dist/BoneData.js +82 -74
  15. package/dist/ConstraintData.d.ts +35 -35
  16. package/dist/ConstraintData.js +36 -36
  17. package/dist/Event.d.ts +44 -44
  18. package/dist/Event.js +49 -42
  19. package/dist/EventData.d.ts +41 -41
  20. package/dist/EventData.js +44 -37
  21. package/dist/IkConstraint.d.ts +64 -64
  22. package/dist/IkConstraint.js +291 -285
  23. package/dist/IkConstraintData.d.ts +54 -54
  24. package/dist/IkConstraintData.js +56 -54
  25. package/dist/PathConstraint.d.ts +71 -71
  26. package/dist/PathConstraint.js +475 -469
  27. package/dist/PathConstraintData.d.ts +80 -80
  28. package/dist/PathConstraintData.js +84 -70
  29. package/dist/Skeleton.d.ts +152 -152
  30. package/dist/Skeleton.js +581 -563
  31. package/dist/SkeletonBinary.d.ts +68 -68
  32. package/dist/SkeletonBinary.js +1132 -1131
  33. package/dist/SkeletonBounds.d.ts +77 -77
  34. package/dist/SkeletonBounds.js +218 -218
  35. package/dist/SkeletonClipping.d.ts +50 -50
  36. package/dist/SkeletonClipping.js +323 -323
  37. package/dist/SkeletonData.d.ts +114 -114
  38. package/dist/SkeletonData.js +190 -167
  39. package/dist/SkeletonJson.d.ts +53 -53
  40. package/dist/SkeletonJson.js +954 -953
  41. package/dist/Skin.d.ts +71 -71
  42. package/dist/Skin.js +203 -201
  43. package/dist/Slot.d.ts +69 -69
  44. package/dist/Slot.js +97 -85
  45. package/dist/SlotData.d.ts +57 -57
  46. package/dist/SlotData.js +68 -55
  47. package/dist/Texture.d.ts +69 -69
  48. package/dist/Texture.js +72 -72
  49. package/dist/TextureAtlas.d.ts +65 -65
  50. package/dist/TextureAtlas.js +267 -246
  51. package/dist/TransformConstraint.d.ts +60 -60
  52. package/dist/TransformConstraint.js +246 -240
  53. package/dist/TransformConstraintData.d.ts +60 -60
  54. package/dist/TransformConstraintData.js +62 -60
  55. package/dist/Triangulator.d.ts +43 -43
  56. package/dist/Triangulator.js +243 -243
  57. package/dist/Updatable.d.ts +37 -37
  58. package/dist/Updatable.js +29 -29
  59. package/dist/Utils.d.ts +168 -168
  60. package/dist/Utils.js +403 -403
  61. package/dist/VertexEffect.d.ts +35 -35
  62. package/dist/VertexEffect.js +29 -29
  63. package/dist/attachments/Attachment.d.ts +72 -72
  64. package/dist/attachments/Attachment.js +149 -141
  65. package/dist/attachments/AttachmentLoader.d.ts +54 -54
  66. package/dist/attachments/AttachmentLoader.js +29 -29
  67. package/dist/attachments/BoundingBoxAttachment.d.ts +40 -40
  68. package/dist/attachments/BoundingBoxAttachment.js +47 -47
  69. package/dist/attachments/ClippingAttachment.d.ts +42 -42
  70. package/dist/attachments/ClippingAttachment.js +51 -48
  71. package/dist/attachments/HasTextureRegion.d.ts +44 -44
  72. package/dist/attachments/HasTextureRegion.js +29 -29
  73. package/dist/attachments/MeshAttachment.d.ts +79 -79
  74. package/dist/attachments/MeshAttachment.js +189 -167
  75. package/dist/attachments/PathAttachment.d.ts +47 -47
  76. package/dist/attachments/PathAttachment.js +59 -57
  77. package/dist/attachments/PointAttachment.d.ts +48 -48
  78. package/dist/attachments/PointAttachment.js +66 -63
  79. package/dist/attachments/RegionAttachment.d.ts +111 -111
  80. package/dist/attachments/RegionAttachment.js +204 -199
  81. package/dist/attachments/Sequence.d.ts +55 -55
  82. package/dist/attachments/Sequence.js +90 -90
  83. package/dist/attachments/index.d.ts +8 -8
  84. package/dist/attachments/index.js +8 -8
  85. package/dist/iife/spine-core.js +178 -8
  86. package/dist/iife/spine-core.js.map +2 -2
  87. package/dist/iife/spine-core.min.js +2 -2
  88. package/dist/index.d.ts +42 -42
  89. package/dist/index.js +42 -42
  90. package/dist/polyfills.d.ts +29 -29
  91. package/dist/polyfills.js +38 -38
  92. package/dist/vertexeffects/JitterEffect.d.ts +39 -39
  93. package/dist/vertexeffects/JitterEffect.js +45 -45
  94. package/dist/vertexeffects/SwirlEffect.d.ts +44 -44
  95. package/dist/vertexeffects/SwirlEffect.js +60 -60
  96. package/package.json +32 -32
@@ -1,396 +1,396 @@
1
- /******************************************************************************
2
- * Spine Runtimes License Agreement
3
- * Last updated September 24, 2021. Replaces all prior versions.
4
- *
5
- * Copyright (c) 2013-2021, Esoteric Software LLC
6
- *
7
- * Integration of the Spine Runtimes into software or otherwise creating
8
- * derivative works of the Spine Runtimes is permitted under the terms and
9
- * conditions of Section 2 of the Spine Editor License Agreement:
10
- * http://esotericsoftware.com/spine-editor-license
11
- *
12
- * Otherwise, it is permitted to integrate the Spine Runtimes into software
13
- * or otherwise create derivative works of the Spine Runtimes (collectively,
14
- * "Products"), provided that each user of the Products must obtain their own
15
- * Spine Editor license and redistribution of the Products in any form must
16
- * include this license and copyright notice.
17
- *
18
- * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
19
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
- * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
22
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
24
- * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
25
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
- * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
- *****************************************************************************/
29
- import { Animation, MixBlend, AttachmentTimeline, RotateTimeline } from "./Animation";
30
- import { AnimationStateData } from "./AnimationStateData";
31
- import { Skeleton } from "./Skeleton";
32
- import { Slot } from "./Slot";
33
- import { StringSet, Pool } from "./Utils";
34
- import { Event } from "./Event";
35
- /** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies
36
- * multiple animations on top of each other (layering).
37
- *
38
- * See [Applying Animations](http://esotericsoftware.com/spine-applying-animations/) in the Spine Runtimes Guide. */
39
- export declare class AnimationState {
40
- private static emptyAnimation;
41
- /** The AnimationStateData to look up mix durations. */
42
- data: AnimationStateData;
43
- /** The list of tracks that currently have animations, which may contain null entries. */
44
- tracks: TrackEntry[];
45
- /** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
46
- * or faster. Defaults to 1.
47
- *
48
- * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
49
- timeScale: number;
50
- unkeyedState: number;
51
- events: Event[];
52
- listeners: AnimationStateListener[];
53
- queue: EventQueue;
54
- propertyIDs: StringSet;
55
- animationsChanged: boolean;
56
- trackEntryPool: Pool<TrackEntry>;
57
- constructor(data: AnimationStateData);
58
- /** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
59
- update(delta: number): void;
60
- /** Returns true when all mixing from entries are complete. */
61
- updateMixingFrom(to: TrackEntry, delta: number): boolean;
62
- /** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
63
- * animation state can be applied to multiple skeletons to pose them identically.
64
- * @returns True if any animations were applied. */
65
- apply(skeleton: Skeleton): boolean;
66
- applyMixingFrom(to: TrackEntry, skeleton: Skeleton, blend: MixBlend): number;
67
- applyAttachmentTimeline(timeline: AttachmentTimeline, skeleton: Skeleton, time: number, blend: MixBlend, attachments: boolean): void;
68
- setAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string, attachments: boolean): void;
69
- applyRotateTimeline(timeline: RotateTimeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
70
- queueEvents(entry: TrackEntry, animationTime: number): void;
71
- /** Removes all animations from all tracks, leaving skeletons in their current pose.
72
- *
73
- * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
74
- * rather than leaving them in their current pose. */
75
- clearTracks(): void;
76
- /** Removes all animations from the track, leaving skeletons in their current pose.
77
- *
78
- * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
79
- * rather than leaving them in their current pose. */
80
- clearTrack(trackIndex: number): void;
81
- setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
82
- /** Sets an animation by name.
83
- *
84
- * See {@link #setAnimationWith()}. */
85
- setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
86
- /** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
87
- * applied to a skeleton, it is replaced (not mixed from).
88
- * @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
89
- * duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
90
- * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
91
- * after the {@link AnimationStateListener#dispose()} event occurs. */
92
- setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
93
- /** Queues an animation by name.
94
- *
95
- * See {@link #addAnimationWith()}. */
96
- addAnimation(trackIndex: number, animationName: string, loop?: boolean, delay?: number): TrackEntry;
97
- /** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
98
- * equivalent to calling {@link #setAnimationWith()}.
99
- * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
100
- * minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
101
- * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
102
- * previous entry is looping, its next loop completion is used instead of its duration.
103
- * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
104
- * after the {@link AnimationStateListener#dispose()} event occurs. */
105
- addAnimationWith(trackIndex: number, animation: Animation, loop?: boolean, delay?: number): TrackEntry;
106
- /** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
107
- * {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
108
- *
109
- * Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
110
- * {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
111
- * the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
112
- * transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
113
- * 0 still mixes out over one frame.
114
- *
115
- * Mixing in is done by first setting an empty animation, then adding an animation using
116
- * {@link #addAnimation()} and on the returned track entry, set the
117
- * {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
118
- * more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
119
- * setup pose value if no lower tracks key the property to the value keyed in the new animation. */
120
- setEmptyAnimation(trackIndex: number, mixDuration?: number): TrackEntry;
121
- /** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
122
- * {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
123
- * {@link #setEmptyAnimation()}.
124
- *
125
- * See {@link #setEmptyAnimation()}.
126
- * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
127
- * minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
128
- * before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
129
- * loop completion is used instead of its duration.
130
- * @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
131
- * after the {@link AnimationStateListener#dispose()} event occurs. */
132
- addEmptyAnimation(trackIndex: number, mixDuration?: number, delay?: number): TrackEntry;
133
- /** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
134
- * duration. */
135
- setEmptyAnimations(mixDuration?: number): void;
136
- expandToIndex(index: number): TrackEntry;
137
- /** @param last May be null. */
138
- trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
139
- /** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
140
- clearNext(entry: TrackEntry): void;
141
- _animationsChanged(): void;
142
- computeHold(entry: TrackEntry): void;
143
- /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
144
- getCurrent(trackIndex: number): TrackEntry;
145
- /** Adds a listener to receive events for all track entries. */
146
- addListener(listener: AnimationStateListener): void;
147
- /** Removes the listener added with {@link #addListener()}. */
148
- removeListener(listener: AnimationStateListener): void;
149
- /** Removes all listeners added with {@link #addListener()}. */
150
- clearListeners(): void;
151
- /** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
152
- * {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
153
- * are not wanted because new animations are being set. */
154
- clearListenerNotifications(): void;
155
- }
156
- /** Stores settings and other state for the playback of an animation on an {@link AnimationState} track.
157
- *
158
- * References to a track entry must not be kept after the {@link AnimationStateListener#dispose()} event occurs. */
159
- export declare class TrackEntry {
160
- /** The animation to apply for this track entry. */
161
- animation: Animation;
162
- previous: TrackEntry;
163
- /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
164
- next: TrackEntry;
165
- /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
166
- * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
167
- mixingFrom: TrackEntry;
168
- /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
169
- * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
170
- mixingTo: TrackEntry;
171
- /** The listener for events generated by this track entry, or null.
172
- *
173
- * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
174
- * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
175
- listener: AnimationStateListener;
176
- /** The index of the track where this track entry is either current or queued.
177
- *
178
- * See {@link AnimationState#getCurrent()}. */
179
- trackIndex: number;
180
- /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
181
- * duration. */
182
- loop: boolean;
183
- /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
184
- * of being mixed out.
185
- *
186
- * When mixing between animations that key the same property, if a lower track also keys that property then the value will
187
- * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
188
- * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
189
- * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
190
- * keys the property, only when a higher track also keys the property.
191
- *
192
- * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
193
- * previous animation. */
194
- holdPrevious: boolean;
195
- reverse: boolean;
196
- /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
197
- * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
198
- * timelines are not applied while this animation is being mixed out. */
199
- eventThreshold: number;
200
- /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
201
- * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
202
- * 0, so attachment timelines are not applied while this animation is being mixed out. */
203
- attachmentThreshold: number;
204
- /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
205
- * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
206
- * so draw order timelines are not applied while this animation is being mixed out. */
207
- drawOrderThreshold: number;
208
- /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
209
- *
210
- * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
211
- * value to prevent timeline keys before the start time from triggering. */
212
- animationStart: number;
213
- /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
214
- * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
215
- animationEnd: number;
216
- /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
217
- * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
218
- * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
219
- * is applied. */
220
- animationLast: number;
221
- nextAnimationLast: number;
222
- /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
223
- * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
224
- * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
225
- * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
226
- *
227
- * {@link #timeScale} affects the delay. */
228
- delay: number;
229
- /** Current time in seconds this track entry has been the current track entry. The track time determines
230
- * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
231
- * looping. */
232
- trackTime: number;
233
- trackLast: number;
234
- nextTrackLast: number;
235
- /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
236
- * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
237
- * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
238
- * properties keyed by the animation are set to the setup pose and the track is cleared.
239
- *
240
- * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
241
- * abruptly cease being applied. */
242
- trackEnd: number;
243
- /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
244
- * faster. Defaults to 1.
245
- *
246
- * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
247
- * match the animation speed.
248
- *
249
- * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
250
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
251
- * the time scale is not 1, the delay may need to be adjusted.
252
- *
253
- * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
254
- timeScale: number;
255
- /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
256
- * to 1, which overwrites the skeleton's current pose with this animation.
257
- *
258
- * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
259
- * use alpha on track 0 if the skeleton pose is from the last frame render. */
260
- alpha: number;
261
- /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
262
- * slightly more than `mixDuration` when the mix is complete. */
263
- mixTime: number;
264
- /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
265
- * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
266
- *
267
- * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
268
- * properties it was animating.
269
- *
270
- * The `mixDuration` can be set manually rather than use the value from
271
- * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
272
- * track entry only before {@link AnimationState#update(float)} is first called.
273
- *
274
- * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
275
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
276
- * afterward. */
277
- mixDuration: number;
278
- interruptAlpha: number;
279
- totalAlpha: number;
280
- /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
281
- * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
282
- * the values from the lower tracks.
283
- *
284
- * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
285
- * called. */
286
- mixBlend: MixBlend;
287
- timelineMode: number[];
288
- timelineHoldMix: TrackEntry[];
289
- timelinesRotation: number[];
290
- reset(): void;
291
- /** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
292
- * and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
293
- * `animationStart` time. */
294
- getAnimationTime(): number;
295
- setAnimationLast(animationLast: number): void;
296
- /** Returns true if at least one loop has been completed.
297
- *
298
- * See {@link AnimationStateListener#complete()}. */
299
- isComplete(): boolean;
300
- /** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
301
- * long way around when using {@link #alpha} and starting animations on other tracks.
302
- *
303
- * Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
304
- * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
305
- * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
306
- * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
307
- resetRotationDirections(): void;
308
- getTrackComplete(): number;
309
- }
310
- export declare class EventQueue {
311
- objects: Array<any>;
312
- drainDisabled: boolean;
313
- animState: AnimationState;
314
- constructor(animState: AnimationState);
315
- start(entry: TrackEntry): void;
316
- interrupt(entry: TrackEntry): void;
317
- end(entry: TrackEntry): void;
318
- dispose(entry: TrackEntry): void;
319
- complete(entry: TrackEntry): void;
320
- event(entry: TrackEntry, event: Event): void;
321
- drain(): void;
322
- clear(): void;
323
- }
324
- export declare enum EventType {
325
- start = 0,
326
- interrupt = 1,
327
- end = 2,
328
- dispose = 3,
329
- complete = 4,
330
- event = 5
331
- }
332
- /** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
333
- * events.
334
- *
335
- * See TrackEntry {@link TrackEntry#listener} and AnimationState
336
- * {@link AnimationState#addListener()}. */
337
- export interface AnimationStateListener {
338
- /** Invoked when this entry has been set as the current entry. */
339
- start?(entry: TrackEntry): void;
340
- /** Invoked when another entry has replaced this entry as the current entry. This entry may continue being applied for
341
- * mixing. */
342
- interrupt?(entry: TrackEntry): void;
343
- /** Invoked when this entry is no longer the current entry and will never be applied again. */
344
- end?(entry: TrackEntry): void;
345
- /** Invoked when this entry will be disposed. This may occur without the entry ever being set as the current entry.
346
- * References to the entry should not be kept after dispose is called, as it may be destroyed or reused. */
347
- dispose?(entry: TrackEntry): void;
348
- /** Invoked every time this entry's animation completes a loop. */
349
- complete?(entry: TrackEntry): void;
350
- /** Invoked when this entry's animation triggers an event. */
351
- event?(entry: TrackEntry, event: Event): void;
352
- }
353
- export declare abstract class AnimationStateAdapter implements AnimationStateListener {
354
- start(entry: TrackEntry): void;
355
- interrupt(entry: TrackEntry): void;
356
- end(entry: TrackEntry): void;
357
- dispose(entry: TrackEntry): void;
358
- complete(entry: TrackEntry): void;
359
- event(entry: TrackEntry, event: Event): void;
360
- }
361
- /** 1. A previously applied timeline has set this property.
362
- *
363
- * Result: Mix from the current pose to the timeline pose. */
364
- export declare const SUBSEQUENT = 0;
365
- /** 1. This is the first timeline to set this property.
366
- * 2. The next track entry applied after this one does not have a timeline to set this property.
367
- *
368
- * Result: Mix from the setup pose to the timeline pose. */
369
- export declare const FIRST = 1;
370
- /** 1) A previously applied timeline has set this property.<br>
371
- * 2) The next track entry to be applied does have a timeline to set this property.<br>
372
- * 3) The next track entry after that one does not have a timeline to set this property.<br>
373
- * Result: Mix from the current pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading
374
- * animations that key the same property. A subsequent timeline will set this property using a mix. */
375
- export declare const HOLD_SUBSEQUENT = 2;
376
- /** 1) This is the first timeline to set this property.<br>
377
- * 2) The next track entry to be applied does have a timeline to set this property.<br>
378
- * 3) The next track entry after that one does not have a timeline to set this property.<br>
379
- * Result: Mix from the setup pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading animations
380
- * that key the same property. A subsequent timeline will set this property using a mix. */
381
- export declare const HOLD_FIRST = 3;
382
- /** 1. This is the first timeline to set this property.
383
- * 2. The next track entry to be applied does have a timeline to set this property.
384
- * 3. The next track entry after that one does have a timeline to set this property.
385
- * 4. timelineHoldMix stores the first subsequent track entry that does not have a timeline to set this property.
386
- *
387
- * Result: The same as HOLD except the mix percentage from the timelineHoldMix track entry is used. This handles when more than
388
- * 2 track entries in a row have a timeline that sets the same property.
389
- *
390
- * 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
391
- * "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
392
- * (which affects B and C). Without using D to mix out, A would be applied fully until mixing completes, then snap into
393
- * place. */
394
- export declare const HOLD_MIX = 4;
395
- export declare const SETUP = 1;
396
- export declare const CURRENT = 2;
1
+ /******************************************************************************
2
+ * Spine Runtimes License Agreement
3
+ * Last updated September 24, 2021. Replaces all prior versions.
4
+ *
5
+ * Copyright (c) 2013-2021, Esoteric Software LLC
6
+ *
7
+ * Integration of the Spine Runtimes into software or otherwise creating
8
+ * derivative works of the Spine Runtimes is permitted under the terms and
9
+ * conditions of Section 2 of the Spine Editor License Agreement:
10
+ * http://esotericsoftware.com/spine-editor-license
11
+ *
12
+ * Otherwise, it is permitted to integrate the Spine Runtimes into software
13
+ * or otherwise create derivative works of the Spine Runtimes (collectively,
14
+ * "Products"), provided that each user of the Products must obtain their own
15
+ * Spine Editor license and redistribution of the Products in any form must
16
+ * include this license and copyright notice.
17
+ *
18
+ * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
19
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
24
+ * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
+ * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *****************************************************************************/
29
+ import { Animation, MixBlend, AttachmentTimeline, RotateTimeline } from "./Animation";
30
+ import { AnimationStateData } from "./AnimationStateData";
31
+ import { Skeleton } from "./Skeleton";
32
+ import { Slot } from "./Slot";
33
+ import { StringSet, Pool } from "./Utils";
34
+ import { Event } from "./Event";
35
+ /** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies
36
+ * multiple animations on top of each other (layering).
37
+ *
38
+ * See [Applying Animations](http://esotericsoftware.com/spine-applying-animations/) in the Spine Runtimes Guide. */
39
+ export declare class AnimationState {
40
+ private static emptyAnimation;
41
+ /** The AnimationStateData to look up mix durations. */
42
+ data: AnimationStateData;
43
+ /** The list of tracks that currently have animations, which may contain null entries. */
44
+ tracks: TrackEntry[];
45
+ /** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
46
+ * or faster. Defaults to 1.
47
+ *
48
+ * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
49
+ timeScale: number;
50
+ unkeyedState: number;
51
+ events: Event[];
52
+ listeners: AnimationStateListener[];
53
+ queue: EventQueue;
54
+ propertyIDs: StringSet;
55
+ animationsChanged: boolean;
56
+ trackEntryPool: Pool<TrackEntry>;
57
+ constructor(data: AnimationStateData);
58
+ /** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
59
+ update(delta: number): void;
60
+ /** Returns true when all mixing from entries are complete. */
61
+ updateMixingFrom(to: TrackEntry, delta: number): boolean;
62
+ /** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
63
+ * animation state can be applied to multiple skeletons to pose them identically.
64
+ * @returns True if any animations were applied. */
65
+ apply(skeleton: Skeleton): boolean;
66
+ applyMixingFrom(to: TrackEntry, skeleton: Skeleton, blend: MixBlend): number;
67
+ applyAttachmentTimeline(timeline: AttachmentTimeline, skeleton: Skeleton, time: number, blend: MixBlend, attachments: boolean): void;
68
+ setAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string, attachments: boolean): void;
69
+ applyRotateTimeline(timeline: RotateTimeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
70
+ queueEvents(entry: TrackEntry, animationTime: number): void;
71
+ /** Removes all animations from all tracks, leaving skeletons in their current pose.
72
+ *
73
+ * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
74
+ * rather than leaving them in their current pose. */
75
+ clearTracks(): void;
76
+ /** Removes all animations from the track, leaving skeletons in their current pose.
77
+ *
78
+ * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
79
+ * rather than leaving them in their current pose. */
80
+ clearTrack(trackIndex: number): void;
81
+ setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
82
+ /** Sets an animation by name.
83
+ *
84
+ * See {@link #setAnimationWith()}. */
85
+ setAnimation(trackIndex: number, animationName: string, loop?: boolean): TrackEntry;
86
+ /** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
87
+ * applied to a skeleton, it is replaced (not mixed from).
88
+ * @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
89
+ * duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
90
+ * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
91
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
92
+ setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
93
+ /** Queues an animation by name.
94
+ *
95
+ * See {@link #addAnimationWith()}. */
96
+ addAnimation(trackIndex: number, animationName: string, loop?: boolean, delay?: number): TrackEntry;
97
+ /** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
98
+ * equivalent to calling {@link #setAnimationWith()}.
99
+ * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
100
+ * minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
101
+ * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
102
+ * previous entry is looping, its next loop completion is used instead of its duration.
103
+ * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
104
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
105
+ addAnimationWith(trackIndex: number, animation: Animation, loop?: boolean, delay?: number): TrackEntry;
106
+ /** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
107
+ * {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
108
+ *
109
+ * Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
110
+ * {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
111
+ * the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
112
+ * transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
113
+ * 0 still mixes out over one frame.
114
+ *
115
+ * Mixing in is done by first setting an empty animation, then adding an animation using
116
+ * {@link #addAnimation()} and on the returned track entry, set the
117
+ * {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
118
+ * more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
119
+ * setup pose value if no lower tracks key the property to the value keyed in the new animation. */
120
+ setEmptyAnimation(trackIndex: number, mixDuration?: number): TrackEntry;
121
+ /** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
122
+ * {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
123
+ * {@link #setEmptyAnimation()}.
124
+ *
125
+ * See {@link #setEmptyAnimation()}.
126
+ * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
127
+ * minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
128
+ * before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
129
+ * loop completion is used instead of its duration.
130
+ * @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
131
+ * after the {@link AnimationStateListener#dispose()} event occurs. */
132
+ addEmptyAnimation(trackIndex: number, mixDuration?: number, delay?: number): TrackEntry;
133
+ /** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
134
+ * duration. */
135
+ setEmptyAnimations(mixDuration?: number): void;
136
+ expandToIndex(index: number): TrackEntry;
137
+ /** @param last May be null. */
138
+ trackEntry(trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry): TrackEntry;
139
+ /** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
140
+ clearNext(entry: TrackEntry): void;
141
+ _animationsChanged(): void;
142
+ computeHold(entry: TrackEntry): void;
143
+ /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
144
+ getCurrent(trackIndex: number): TrackEntry;
145
+ /** Adds a listener to receive events for all track entries. */
146
+ addListener(listener: AnimationStateListener): void;
147
+ /** Removes the listener added with {@link #addListener()}. */
148
+ removeListener(listener: AnimationStateListener): void;
149
+ /** Removes all listeners added with {@link #addListener()}. */
150
+ clearListeners(): void;
151
+ /** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
152
+ * {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
153
+ * are not wanted because new animations are being set. */
154
+ clearListenerNotifications(): void;
155
+ }
156
+ /** Stores settings and other state for the playback of an animation on an {@link AnimationState} track.
157
+ *
158
+ * References to a track entry must not be kept after the {@link AnimationStateListener#dispose()} event occurs. */
159
+ export declare class TrackEntry {
160
+ /** The animation to apply for this track entry. */
161
+ animation: Animation;
162
+ previous: TrackEntry;
163
+ /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
164
+ next: TrackEntry;
165
+ /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
166
+ * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
167
+ mixingFrom: TrackEntry;
168
+ /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
169
+ * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
170
+ mixingTo: TrackEntry;
171
+ /** The listener for events generated by this track entry, or null.
172
+ *
173
+ * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
174
+ * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
175
+ listener: AnimationStateListener;
176
+ /** The index of the track where this track entry is either current or queued.
177
+ *
178
+ * See {@link AnimationState#getCurrent()}. */
179
+ trackIndex: number;
180
+ /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
181
+ * duration. */
182
+ loop: boolean;
183
+ /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
184
+ * of being mixed out.
185
+ *
186
+ * When mixing between animations that key the same property, if a lower track also keys that property then the value will
187
+ * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
188
+ * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
189
+ * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
190
+ * keys the property, only when a higher track also keys the property.
191
+ *
192
+ * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
193
+ * previous animation. */
194
+ holdPrevious: boolean;
195
+ reverse: boolean;
196
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
197
+ * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
198
+ * timelines are not applied while this animation is being mixed out. */
199
+ eventThreshold: number;
200
+ /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
201
+ * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
202
+ * 0, so attachment timelines are not applied while this animation is being mixed out. */
203
+ attachmentThreshold: number;
204
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
205
+ * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
206
+ * so draw order timelines are not applied while this animation is being mixed out. */
207
+ drawOrderThreshold: number;
208
+ /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
209
+ *
210
+ * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
211
+ * value to prevent timeline keys before the start time from triggering. */
212
+ animationStart: number;
213
+ /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
214
+ * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
215
+ animationEnd: number;
216
+ /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
217
+ * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
218
+ * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
219
+ * is applied. */
220
+ animationLast: number;
221
+ nextAnimationLast: number;
222
+ /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
223
+ * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
224
+ * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
225
+ * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
226
+ *
227
+ * {@link #timeScale} affects the delay. */
228
+ delay: number;
229
+ /** Current time in seconds this track entry has been the current track entry. The track time determines
230
+ * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
231
+ * looping. */
232
+ trackTime: number;
233
+ trackLast: number;
234
+ nextTrackLast: number;
235
+ /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
236
+ * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
237
+ * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
238
+ * properties keyed by the animation are set to the setup pose and the track is cleared.
239
+ *
240
+ * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
241
+ * abruptly cease being applied. */
242
+ trackEnd: number;
243
+ /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
244
+ * faster. Defaults to 1.
245
+ *
246
+ * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
247
+ * match the animation speed.
248
+ *
249
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
250
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
251
+ * the time scale is not 1, the delay may need to be adjusted.
252
+ *
253
+ * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
254
+ timeScale: number;
255
+ /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
256
+ * to 1, which overwrites the skeleton's current pose with this animation.
257
+ *
258
+ * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
259
+ * use alpha on track 0 if the skeleton pose is from the last frame render. */
260
+ alpha: number;
261
+ /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
262
+ * slightly more than `mixDuration` when the mix is complete. */
263
+ mixTime: number;
264
+ /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
265
+ * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
266
+ *
267
+ * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
268
+ * properties it was animating.
269
+ *
270
+ * The `mixDuration` can be set manually rather than use the value from
271
+ * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
272
+ * track entry only before {@link AnimationState#update(float)} is first called.
273
+ *
274
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
275
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
276
+ * afterward. */
277
+ mixDuration: number;
278
+ interruptAlpha: number;
279
+ totalAlpha: number;
280
+ /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
281
+ * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
282
+ * the values from the lower tracks.
283
+ *
284
+ * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
285
+ * called. */
286
+ mixBlend: MixBlend;
287
+ timelineMode: number[];
288
+ timelineHoldMix: TrackEntry[];
289
+ timelinesRotation: number[];
290
+ reset(): void;
291
+ /** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
292
+ * and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
293
+ * `animationStart` time. */
294
+ getAnimationTime(): number;
295
+ setAnimationLast(animationLast: number): void;
296
+ /** Returns true if at least one loop has been completed.
297
+ *
298
+ * See {@link AnimationStateListener#complete()}. */
299
+ isComplete(): boolean;
300
+ /** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
301
+ * long way around when using {@link #alpha} and starting animations on other tracks.
302
+ *
303
+ * Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
304
+ * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
305
+ * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
306
+ * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
307
+ resetRotationDirections(): void;
308
+ getTrackComplete(): number;
309
+ }
310
+ export declare class EventQueue {
311
+ objects: Array<any>;
312
+ drainDisabled: boolean;
313
+ animState: AnimationState;
314
+ constructor(animState: AnimationState);
315
+ start(entry: TrackEntry): void;
316
+ interrupt(entry: TrackEntry): void;
317
+ end(entry: TrackEntry): void;
318
+ dispose(entry: TrackEntry): void;
319
+ complete(entry: TrackEntry): void;
320
+ event(entry: TrackEntry, event: Event): void;
321
+ drain(): void;
322
+ clear(): void;
323
+ }
324
+ export declare enum EventType {
325
+ start = 0,
326
+ interrupt = 1,
327
+ end = 2,
328
+ dispose = 3,
329
+ complete = 4,
330
+ event = 5
331
+ }
332
+ /** The interface to implement for receiving TrackEntry events. It is always safe to call AnimationState methods when receiving
333
+ * events.
334
+ *
335
+ * See TrackEntry {@link TrackEntry#listener} and AnimationState
336
+ * {@link AnimationState#addListener()}. */
337
+ export interface AnimationStateListener {
338
+ /** Invoked when this entry has been set as the current entry. */
339
+ start?(entry: TrackEntry): void;
340
+ /** Invoked when another entry has replaced this entry as the current entry. This entry may continue being applied for
341
+ * mixing. */
342
+ interrupt?(entry: TrackEntry): void;
343
+ /** Invoked when this entry is no longer the current entry and will never be applied again. */
344
+ end?(entry: TrackEntry): void;
345
+ /** Invoked when this entry will be disposed. This may occur without the entry ever being set as the current entry.
346
+ * References to the entry should not be kept after dispose is called, as it may be destroyed or reused. */
347
+ dispose?(entry: TrackEntry): void;
348
+ /** Invoked every time this entry's animation completes a loop. */
349
+ complete?(entry: TrackEntry): void;
350
+ /** Invoked when this entry's animation triggers an event. */
351
+ event?(entry: TrackEntry, event: Event): void;
352
+ }
353
+ export declare abstract class AnimationStateAdapter implements AnimationStateListener {
354
+ start(entry: TrackEntry): void;
355
+ interrupt(entry: TrackEntry): void;
356
+ end(entry: TrackEntry): void;
357
+ dispose(entry: TrackEntry): void;
358
+ complete(entry: TrackEntry): void;
359
+ event(entry: TrackEntry, event: Event): void;
360
+ }
361
+ /** 1. A previously applied timeline has set this property.
362
+ *
363
+ * Result: Mix from the current pose to the timeline pose. */
364
+ export declare const SUBSEQUENT = 0;
365
+ /** 1. This is the first timeline to set this property.
366
+ * 2. The next track entry applied after this one does not have a timeline to set this property.
367
+ *
368
+ * Result: Mix from the setup pose to the timeline pose. */
369
+ export declare const FIRST = 1;
370
+ /** 1) A previously applied timeline has set this property.<br>
371
+ * 2) The next track entry to be applied does have a timeline to set this property.<br>
372
+ * 3) The next track entry after that one does not have a timeline to set this property.<br>
373
+ * Result: Mix from the current pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading
374
+ * animations that key the same property. A subsequent timeline will set this property using a mix. */
375
+ export declare const HOLD_SUBSEQUENT = 2;
376
+ /** 1) This is the first timeline to set this property.<br>
377
+ * 2) The next track entry to be applied does have a timeline to set this property.<br>
378
+ * 3) The next track entry after that one does not have a timeline to set this property.<br>
379
+ * Result: Mix from the setup pose to the timeline pose, but do not mix out. This avoids "dipping" when crossfading animations
380
+ * that key the same property. A subsequent timeline will set this property using a mix. */
381
+ export declare const HOLD_FIRST = 3;
382
+ /** 1. This is the first timeline to set this property.
383
+ * 2. The next track entry to be applied does have a timeline to set this property.
384
+ * 3. The next track entry after that one does have a timeline to set this property.
385
+ * 4. timelineHoldMix stores the first subsequent track entry that does not have a timeline to set this property.
386
+ *
387
+ * Result: The same as HOLD except the mix percentage from the timelineHoldMix track entry is used. This handles when more than
388
+ * 2 track entries in a row have a timeline that sets the same property.
389
+ *
390
+ * 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
391
+ * "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
392
+ * (which affects B and C). Without using D to mix out, A would be applied fully until mixing completes, then snap into
393
+ * place. */
394
+ export declare const HOLD_MIX = 4;
395
+ export declare const SETUP = 1;
396
+ export declare const CURRENT = 2;