|
@@ -46,7 +46,7 @@ export class AnimationState {
|
|
|
}
|
|
|
|
|
|
/** The AnimationStateData to look up mix durations. */
|
|
|
- data: AnimationStateData;
|
|
|
+ data: AnimationStateData = null;
|
|
|
|
|
|
/** The list of tracks that currently have animations, which may contain null entries. */
|
|
|
tracks = new Array<TrackEntry>();
|
|
@@ -645,6 +645,7 @@ export class AnimationState {
|
|
|
/** @param last May be null. */
|
|
|
trackEntry (trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry) {
|
|
|
let entry = this.trackEntryPool.obtain();
|
|
|
+ entry.reset();
|
|
|
entry.trackIndex = trackIndex;
|
|
|
entry.animation = animation;
|
|
|
entry.loop = loop;
|
|
@@ -777,35 +778,35 @@ export class AnimationState {
|
|
|
* References to a track entry must not be kept after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
|
export class TrackEntry {
|
|
|
/** The animation to apply for this track entry. */
|
|
|
- animation: Animation;
|
|
|
+ animation: Animation = null;
|
|
|
|
|
|
- previous: TrackEntry;
|
|
|
+ previous: TrackEntry = null;
|
|
|
|
|
|
/** The animation queued to start after this animation, or null. `next` makes up a linked list. */
|
|
|
- next: TrackEntry;
|
|
|
+ next: TrackEntry = null;
|
|
|
|
|
|
/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
|
|
|
* mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
|
|
|
- mixingFrom: TrackEntry;
|
|
|
+ mixingFrom: TrackEntry = null;
|
|
|
|
|
|
/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
|
|
|
* currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
|
|
|
- mixingTo: TrackEntry;
|
|
|
+ mixingTo: TrackEntry = null;
|
|
|
|
|
|
/** The listener for events generated by this track entry, or null.
|
|
|
*
|
|
|
* A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
|
|
|
* for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
|
|
|
- listener: AnimationStateListener;
|
|
|
+ listener: AnimationStateListener = null;
|
|
|
|
|
|
/** The index of the track where this track entry is either current or queued.
|
|
|
*
|
|
|
* See {@link AnimationState#getCurrent()}. */
|
|
|
- trackIndex: number;
|
|
|
+ trackIndex: number = 0;
|
|
|
|
|
|
/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
|
* duration. */
|
|
|
- loop: boolean;
|
|
|
+ loop: boolean = false;
|
|
|
|
|
|
/** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
|
|
|
* of being mixed out.
|
|
@@ -818,43 +819,43 @@ export class TrackEntry {
|
|
|
*
|
|
|
* Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
|
|
|
* previous animation. */
|
|
|
- holdPrevious: boolean;
|
|
|
+ holdPrevious: boolean = false;
|
|
|
|
|
|
- reverse: boolean;
|
|
|
+ reverse: boolean = false;
|
|
|
|
|
|
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
|
|
|
* `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
|
|
|
* timelines are not applied while this animation is being mixed out. */
|
|
|
- eventThreshold: number;
|
|
|
+ eventThreshold: number = 0;
|
|
|
|
|
|
/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
|
|
|
* `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
|
|
|
* 0, so attachment timelines are not applied while this animation is being mixed out. */
|
|
|
- attachmentThreshold: number;
|
|
|
+ attachmentThreshold: number = 0;
|
|
|
|
|
|
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
|
|
|
* `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
|
|
|
* so draw order timelines are not applied while this animation is being mixed out. */
|
|
|
- drawOrderThreshold: number;
|
|
|
+ drawOrderThreshold: number = 0;
|
|
|
|
|
|
/** Seconds when this animation starts, both initially and after looping. Defaults to 0.
|
|
|
*
|
|
|
* When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
|
|
|
* value to prevent timeline keys before the start time from triggering. */
|
|
|
- animationStart: number;
|
|
|
+ animationStart: number = 0;
|
|
|
|
|
|
/** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
|
|
|
* loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
|
|
|
- animationEnd: number;
|
|
|
+ animationEnd: number = 0;
|
|
|
|
|
|
|
|
|
/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
|
|
|
* animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
|
|
|
* `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
|
|
|
* is applied. */
|
|
|
- animationLast: number;
|
|
|
+ animationLast: number = 0;
|
|
|
|
|
|
- nextAnimationLast: number;
|
|
|
+ nextAnimationLast: number = 0;
|
|
|
|
|
|
/** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
|
|
|
* postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
|
|
@@ -862,14 +863,14 @@ export class TrackEntry {
|
|
|
* track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
|
|
|
*
|
|
|
* {@link #timeScale} affects the delay. */
|
|
|
- delay: number;
|
|
|
+ delay: number = 0;
|
|
|
|
|
|
/** Current time in seconds this track entry has been the current track entry. The track time determines
|
|
|
* {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
|
|
|
* looping. */
|
|
|
- trackTime: number;
|
|
|
+ trackTime: number = 0;
|
|
|
|
|
|
- trackLast: number; nextTrackLast: number;
|
|
|
+ trackLast: number = 0; nextTrackLast: number = 0;
|
|
|
|
|
|
/** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
|
|
|
* value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
|
|
@@ -878,7 +879,7 @@ export class TrackEntry {
|
|
|
*
|
|
|
* It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
|
|
|
* abruptly cease being applied. */
|
|
|
- trackEnd: number;
|
|
|
+ trackEnd: number = 0;
|
|
|
|
|
|
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
|
|
|
* faster. Defaults to 1.
|
|
@@ -891,18 +892,18 @@ export class TrackEntry {
|
|
|
* the time scale is not 1, the delay may need to be adjusted.
|
|
|
*
|
|
|
* See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
|
|
|
- timeScale: number;
|
|
|
+ timeScale: number = 0;
|
|
|
|
|
|
/** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
|
|
|
* to 1, which overwrites the skeleton's current pose with this animation.
|
|
|
*
|
|
|
* Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
|
|
|
* use alpha on track 0 if the skeleton pose is from the last frame render. */
|
|
|
- alpha: number;
|
|
|
+ alpha: number = 0;
|
|
|
|
|
|
/** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
|
|
|
* slightly more than `mixDuration` when the mix is complete. */
|
|
|
- mixTime: number;
|
|
|
+ mixTime: number = 0;
|
|
|
|
|
|
/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
|
|
|
* {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
|
|
@@ -917,7 +918,7 @@ export class TrackEntry {
|
|
|
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
|
|
|
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
|
|
|
* afterward. */
|
|
|
- mixDuration: number; interruptAlpha: number; totalAlpha: number;
|
|
|
+ mixDuration: number = 0; interruptAlpha: number = 0; totalAlpha: number = 0;
|
|
|
|
|
|
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
|
* replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
|
|
@@ -990,7 +991,7 @@ export class TrackEntry {
|
|
|
export class EventQueue {
|
|
|
objects: Array<any> = [];
|
|
|
drainDisabled = false;
|
|
|
- animState: AnimationState;
|
|
|
+ animState: AnimationState = null;
|
|
|
|
|
|
constructor (animState: AnimationState) {
|
|
|
this.animState = animState;
|