@esotericsoftware/spine-core 4.2.117 → 4.3.1

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 (129) hide show
  1. package/dist/Animation.d.ts +426 -274
  2. package/dist/Animation.js +1174 -1210
  3. package/dist/AnimationState.d.ts +246 -201
  4. package/dist/AnimationState.js +508 -471
  5. package/dist/AnimationStateData.d.ts +12 -10
  6. package/dist/AnimationStateData.js +19 -20
  7. package/dist/AssetManagerBase.d.ts +27 -21
  8. package/dist/AssetManagerBase.js +67 -43
  9. package/dist/AtlasAttachmentLoader.d.ts +18 -12
  10. package/dist/AtlasAttachmentLoader.js +28 -39
  11. package/dist/Bone.d.ts +15 -109
  12. package/dist/Bone.js +22 -362
  13. package/dist/BoneData.d.ts +13 -28
  14. package/dist/BoneData.js +20 -29
  15. package/dist/BonePose.d.ts +132 -0
  16. package/dist/BonePose.js +456 -0
  17. package/dist/Constraint.d.ts +41 -0
  18. package/dist/Constraint.js +38 -0
  19. package/dist/ConstraintData.d.ts +16 -5
  20. package/dist/ConstraintData.js +15 -9
  21. package/dist/DrawOrder.d.ts +48 -0
  22. package/dist/DrawOrder.js +64 -0
  23. package/dist/Event.d.ts +11 -6
  24. package/dist/Event.js +10 -5
  25. package/dist/EventData.d.ts +10 -6
  26. package/dist/EventData.js +18 -7
  27. package/dist/IkConstraint.d.ts +23 -28
  28. package/dist/IkConstraint.js +122 -124
  29. package/dist/IkConstraintData.d.ts +14 -19
  30. package/dist/IkConstraintData.js +22 -23
  31. package/dist/IkConstraintPose.d.ts +49 -0
  32. package/dist/IkConstraintPose.js +55 -0
  33. package/dist/PathConstraint.d.ts +18 -23
  34. package/dist/PathConstraint.js +162 -139
  35. package/dist/PathConstraintData.d.ts +11 -14
  36. package/dist/PathConstraintData.js +14 -16
  37. package/dist/PathConstraintPose.d.ts +43 -0
  38. package/dist/PathConstraintPose.js +49 -0
  39. package/dist/Physics.d.ts +39 -0
  40. package/dist/Physics.js +41 -0
  41. package/dist/PhysicsConstraint.d.ts +26 -30
  42. package/dist/PhysicsConstraint.js +114 -94
  43. package/dist/PhysicsConstraintData.d.ts +28 -13
  44. package/dist/PhysicsConstraintData.js +35 -13
  45. package/dist/PhysicsConstraintPose.d.ts +47 -0
  46. package/dist/PhysicsConstraintPose.js +55 -0
  47. package/dist/Pose.d.ts +33 -0
  48. package/dist/Pose.js +30 -0
  49. package/dist/Posed.d.ts +58 -0
  50. package/dist/Posed.js +78 -0
  51. package/dist/PosedActive.d.ts +41 -0
  52. package/dist/{attachments/HasTextureRegion.js → PosedActive.js} +17 -2
  53. package/dist/PosedData.d.ts +40 -0
  54. package/dist/PosedData.js +45 -0
  55. package/dist/Skeleton.d.ts +110 -99
  56. package/dist/Skeleton.js +271 -449
  57. package/dist/SkeletonBinary.d.ts +1 -1
  58. package/dist/SkeletonBinary.js +655 -466
  59. package/dist/SkeletonBounds.d.ts +4 -4
  60. package/dist/SkeletonBounds.js +45 -46
  61. package/dist/SkeletonClipping.d.ts +26 -22
  62. package/dist/SkeletonClipping.js +654 -340
  63. package/dist/SkeletonData.d.ts +18 -35
  64. package/dist/SkeletonData.js +57 -97
  65. package/dist/SkeletonJson.d.ts +8 -6
  66. package/dist/SkeletonJson.js +895 -640
  67. package/dist/SkeletonRendererCore.d.ts +58 -0
  68. package/dist/SkeletonRendererCore.js +310 -0
  69. package/dist/Skin.d.ts +20 -16
  70. package/dist/Skin.js +58 -53
  71. package/dist/Slider.d.ts +46 -0
  72. package/dist/Slider.js +115 -0
  73. package/dist/SliderData.d.ts +58 -0
  74. package/dist/SliderData.js +59 -0
  75. package/dist/SliderPose.d.ts +37 -0
  76. package/dist/SliderPose.js +40 -0
  77. package/dist/Slot.d.ts +16 -38
  78. package/dist/Slot.js +37 -60
  79. package/dist/SlotData.d.ts +5 -12
  80. package/dist/SlotData.js +7 -15
  81. package/dist/SlotPose.d.ts +59 -0
  82. package/dist/SlotPose.js +81 -0
  83. package/dist/Texture.d.ts +1 -0
  84. package/dist/Texture.js +2 -1
  85. package/dist/TextureAtlas.d.ts +3 -3
  86. package/dist/TextureAtlas.js +49 -49
  87. package/dist/TransformConstraint.d.ts +16 -28
  88. package/dist/TransformConstraint.js +72 -209
  89. package/dist/TransformConstraintData.d.ts +108 -20
  90. package/dist/TransformConstraintData.js +274 -24
  91. package/dist/TransformConstraintPose.d.ts +45 -0
  92. package/dist/TransformConstraintPose.js +52 -0
  93. package/dist/Triangulator.d.ts +1 -1
  94. package/dist/Triangulator.js +91 -107
  95. package/dist/{Updatable.d.ts → Update.d.ts} +5 -12
  96. package/dist/Update.js +30 -0
  97. package/dist/Utils.d.ts +14 -3
  98. package/dist/Utils.js +80 -37
  99. package/dist/attachments/Attachment.d.ts +27 -19
  100. package/dist/attachments/Attachment.js +59 -35
  101. package/dist/attachments/AttachmentLoader.d.ts +14 -14
  102. package/dist/attachments/AttachmentLoader.js +1 -1
  103. package/dist/attachments/BoundingBoxAttachment.d.ts +1 -1
  104. package/dist/attachments/BoundingBoxAttachment.js +2 -2
  105. package/dist/attachments/ClippingAttachment.d.ts +10 -3
  106. package/dist/attachments/ClippingAttachment.js +12 -3
  107. package/dist/attachments/{HasTextureRegion.d.ts → HasSequence.d.ts} +11 -14
  108. package/dist/attachments/HasSequence.js +30 -0
  109. package/dist/attachments/MeshAttachment.d.ts +28 -35
  110. package/dist/attachments/MeshAttachment.js +85 -97
  111. package/dist/attachments/PathAttachment.d.ts +3 -3
  112. package/dist/attachments/PathAttachment.js +6 -6
  113. package/dist/attachments/PointAttachment.d.ts +11 -6
  114. package/dist/attachments/PointAttachment.js +8 -3
  115. package/dist/attachments/RegionAttachment.d.ts +25 -27
  116. package/dist/attachments/RegionAttachment.js +101 -113
  117. package/dist/attachments/Sequence.d.ts +31 -6
  118. package/dist/attachments/Sequence.js +79 -13
  119. package/dist/esm/spine-core.min.mjs +2 -2
  120. package/dist/esm/spine-core.mjs +7747 -6116
  121. package/dist/esm/spine-core.mjs.map +4 -4
  122. package/dist/iife/spine-core.js +7747 -6116
  123. package/dist/iife/spine-core.js.map +4 -4
  124. package/dist/iife/spine-core.min.js +2 -2
  125. package/dist/index.d.ts +32 -11
  126. package/dist/index.js +33 -12
  127. package/dist/polyfills.js +4 -5
  128. package/package.json +1 -1
  129. package/dist/Updatable.js +0 -30
@@ -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
- import { Animation, MixBlend, AttachmentTimeline, RotateTimeline } from "./Animation.js";
30
- import { AnimationStateData } from "./AnimationStateData.js";
31
- import { Skeleton } from "./Skeleton.js";
32
- import { Slot } from "./Slot.js";
33
- import { StringSet, Pool } from "./Utils.js";
34
- import { Event } from "./Event.js";
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/) in the Spine Runtimes Guide. */
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 _emptyAnimation: Animation;
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 currently have animations, which may contain null entries. */
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 TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
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
- propertyIDs: StringSet;
54
+ propertyIds: StringSet;
56
55
  animationsChanged: boolean;
57
56
  trackEntryPool: Pool<TrackEntry>;
58
57
  constructor(data: AnimationStateData);
59
- /** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
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. There are no side effects other than invoking listeners, so the
64
- * animation state can be applied to multiple skeletons to pose them identically.
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, blend: MixBlend): number;
68
- applyAttachmentTimeline(timeline: AttachmentTimeline, skeleton: Skeleton, time: number, blend: MixBlend, attachments: boolean): void;
69
- setAttachment(skeleton: Skeleton, slot: Slot, attachmentName: string | null, attachments: boolean): void;
70
- applyRotateTimeline(timeline: RotateTimeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
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
- * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
75
- * rather than leaving them in their current pose. */
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
- * It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
80
- * rather than leaving them in their current pose. */
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
- setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
85
+ setTrack(index: number, current: TrackEntry, interrupt: boolean): void;
83
86
  /** Sets an animation by name.
84
- *
85
- * See {@link #setAnimationWith()}. */
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. If the formerly current track entry was never
88
- * applied to a skeleton, it is replaced (not mixed from).
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#trackEnd} determines when the track is cleared.
91
- * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
92
- * after the {@link AnimationStateListener#dispose()} event occurs. */
93
- setAnimationWith(trackIndex: number, animation: Animation, loop?: boolean): TrackEntry;
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 #addAnimationWith()}. */
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 is empty, it is
99
- * equivalent to calling {@link #setAnimationWith()}.
100
- * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
101
- * minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
102
- * ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
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
- * @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
105
- * after the {@link AnimationStateListener#dispose()} event occurs. */
106
- addAnimationWith(trackIndex: number, animation: Animation, loop?: boolean, delay?: number): TrackEntry;
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#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
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 #setEmptyAnimation()},
111
- * {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
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 mixes out over one frame.
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 #addAnimation()} and on the returned track entry, set the
118
- * {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
119
- * more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
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#mixDuration}. If the track is empty, it is equivalent to calling
124
- * {@link #setEmptyAnimation()}.
125
- *
126
- * See {@link #setEmptyAnimation()}.
127
- * @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
128
- * minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
129
- * before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
130
- * loop completion is used instead of its duration.
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#dispose()} event occurs. */
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
- * duration. */
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 the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
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
- getCurrent(trackIndex: number): TrackEntry | null;
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 #addListener()}. */
172
+ /** Removes the listener added with {@link addListener}. */
149
173
  removeListener(listener: AnimationStateListener): void;
150
- /** Removes all listeners added with {@link #addListener()}. */
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#dispose()} event occurs. */
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 from the previous animation to this animation, or null if no
167
- * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
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 to the next animation, or null if no mixing is
170
- * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
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#setAnimation()} is already the current animation
175
- * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
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#getCurrent()}. */
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
- /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
185
- * of being mixed out.
186
- *
187
- * When mixing between animations that key the same property, if a lower track also keys that property then the value will
188
- * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
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
- /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
199
- * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
200
- * timelines are not applied while this animation is being mixed out. */
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 ({@link #mixtime} / {@link #mixDuration}) is less than the
203
- * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
204
- * 0, so attachment timelines are not applied while this animation is being mixed out. */
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 {@link #getAlpha()} is greater than <code>alphaAttachmentThreshold</code>, attachment timelines are applied.
207
- * Defaults to 0, so attachment timelines are always applied. */
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 ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
210
- * <code>mixDrawOrderThreshold</code>, draw order timelines are applied while this animation is being mixed out. Defaults to
211
- * 0, so draw order timelines are not applied while this animation is being mixed out. */
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
- /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
239
+ /** The time in seconds for the first frame of this animation, both initially and after looping. Defaults to 0.
214
240
  *
215
- * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
216
- * value to prevent timeline keys before the start time from triggering. */
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
- /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
219
- * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
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. Eg, when this
222
- * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
223
- * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
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, `delay`
228
- * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
229
- * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
230
- * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
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 #timeScale} affects the delay. */
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
- /** Current time in seconds this track entry has been the current track entry. The track time determines
235
- * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
236
- * looping. */
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
- * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
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
- * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
252
- * match the animation speed.
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#addAnimation()} with a `delay` <= 0, note the
255
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
256
- * the time scale is not 1, the delay may need to be adjusted.
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 AnimationState {@link AnimationState#timeScale} for affecting all animations. */
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 (usually the pose resulting from lower tracks). Defaults
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
- * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
264
- * use alpha on track 0 if the skeleton pose is from the last frame render. */
299
+ * Alpha should be 1 on track 0.
300
+ *
301
+ * See {@link getAlphaAttachmentThreshold}. */
265
302
  alpha: number;
266
- /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
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 AnimationStateData
270
- * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
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 mixes out over one frame to provide the track entry being mixed out a chance to revert the
273
- * properties it was animating.
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#getMix()}. In that case, the `mixDuration` can be set for a new
277
- * track entry only before {@link AnimationState#update(float)} is first called.
278
- *
279
- * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
280
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
281
- * afterward. */
282
- _mixDuration: number;
283
- interruptAlpha: number;
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
- get mixDuration(): number;
286
- set mixDuration(mixDuration: number);
287
- setMixDurationWithDelay(mixDuration: number, delay: number): void;
288
- /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
289
- * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
290
- * the values from the lower tracks.
291
- *
292
- * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
293
- * called. */
294
- mixBlend: MixBlend;
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 #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
300
- * and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
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#complete()}. */
361
+ * See {@link AnimationStateListener.complete}. */
307
362
  isComplete(): boolean;
308
- /** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
309
- * long way around when using {@link #alpha} and starting animations on other tracks.
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 with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
312
- * the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
313
- * way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
314
- * long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
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
- * <p>
319
- * See {@link AnimationState#apply(Skeleton)}. */
379
+ *
380
+ * See {@link AnimationState.apply}. */
320
381
  wasApplied(): boolean;
321
- /** Returns true if there is a {@link #getNext()} track entry and it will become the current track entry during the next
322
- * {@link AnimationState#update(float)}. */
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<any>;
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
- * See TrackEntry {@link TrackEntry#listener} and AnimationState
351
- * {@link AnimationState#addListener()}. */
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 is no longer the current entry and will never be applied again. */
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
- /** 1) A previously applied timeline has set this property.<br>
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 CURRENT = 2;
456
+ export declare const RETAIN = 2;