mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
[ts] Merge fix for #2003, fix ping pong reverse in Sequencetimeline
# Conflicts: # spine-ts/package-lock.json # spine-ts/package.json # spine-ts/spine-canvas/package.json # spine-ts/spine-core/package.json # spine-ts/spine-core/src/Slot.ts # spine-ts/spine-core/src/attachments/MeshAttachment.ts # spine-ts/spine-core/src/attachments/RegionAttachment.ts # spine-ts/spine-player/package.json # spine-ts/spine-threejs/package.json # spine-ts/spine-webgl/package.json
This commit is contained in:
commit
ced0771c37
@ -42,8 +42,8 @@ import { SequenceMode, SequenceModeValues } from "./attachments/Sequence";
|
|||||||
export class Animation {
|
export class Animation {
|
||||||
/** The animation's name, which is unique across all animations in the skeleton. */
|
/** The animation's name, which is unique across all animations in the skeleton. */
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline> = null;
|
||||||
timelineIds: StringSet;
|
timelineIds: StringSet = null;
|
||||||
|
|
||||||
/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
|
/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
|
||||||
duration: number;
|
duration: number;
|
||||||
@ -155,8 +155,8 @@ const Property = {
|
|||||||
|
|
||||||
/** The interface for all timelines. */
|
/** The interface for all timelines. */
|
||||||
export abstract class Timeline {
|
export abstract class Timeline {
|
||||||
propertyIds: string[];
|
propertyIds: string[] = null;
|
||||||
frames: NumberArrayLike;
|
frames: NumberArrayLike = null;
|
||||||
|
|
||||||
constructor (frameCount: number, propertyIds: string[]) {
|
constructor (frameCount: number, propertyIds: string[]) {
|
||||||
this.propertyIds = propertyIds;
|
this.propertyIds = propertyIds;
|
||||||
@ -208,7 +208,7 @@ export interface SlotTimeline {
|
|||||||
|
|
||||||
/** The base class for timelines that use interpolation between key frame values. */
|
/** The base class for timelines that use interpolation between key frame values. */
|
||||||
export abstract class CurveTimeline extends Timeline {
|
export abstract class CurveTimeline extends Timeline {
|
||||||
protected curves: NumberArrayLike; // type, x, y, ...
|
protected curves: NumberArrayLike = null; // type, x, y, ...
|
||||||
|
|
||||||
constructor (frameCount: number, bezierCount: number, propertyIds: string[]) {
|
constructor (frameCount: number, bezierCount: number, propertyIds: string[]) {
|
||||||
super(frameCount, propertyIds);
|
super(frameCount, propertyIds);
|
||||||
@ -1430,10 +1430,10 @@ export class DeformTimeline extends CurveTimeline implements SlotTimeline {
|
|||||||
slotIndex = 0;
|
slotIndex = 0;
|
||||||
|
|
||||||
/** The attachment that will be deformed. */
|
/** The attachment that will be deformed. */
|
||||||
attachment: VertexAttachment;
|
attachment: VertexAttachment = null;
|
||||||
|
|
||||||
/** The vertices for each key frame. */
|
/** The vertices for each key frame. */
|
||||||
vertices: Array<NumberArrayLike>;
|
vertices: Array<NumberArrayLike> = null;
|
||||||
|
|
||||||
constructor (frameCount: number, bezierCount: number, slotIndex: number, attachment: VertexAttachment) {
|
constructor (frameCount: number, bezierCount: number, slotIndex: number, attachment: VertexAttachment) {
|
||||||
super(frameCount, bezierCount, [
|
super(frameCount, bezierCount, [
|
||||||
@ -1685,7 +1685,7 @@ export class EventTimeline extends Timeline {
|
|||||||
static propertyIds = ["" + Property.event];
|
static propertyIds = ["" + Property.event];
|
||||||
|
|
||||||
/** The event for each key frame. */
|
/** The event for each key frame. */
|
||||||
events: Array<Event>;
|
events: Array<Event> = null;
|
||||||
|
|
||||||
constructor (frameCount: number) {
|
constructor (frameCount: number) {
|
||||||
super(frameCount, EventTimeline.propertyIds);
|
super(frameCount, EventTimeline.propertyIds);
|
||||||
@ -1738,7 +1738,7 @@ export class DrawOrderTimeline extends Timeline {
|
|||||||
static propertyIds = ["" + Property.drawOrder];
|
static propertyIds = ["" + Property.drawOrder];
|
||||||
|
|
||||||
/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
|
/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
|
||||||
drawOrders: Array<Array<number>>;
|
drawOrders: Array<Array<number>> = null;
|
||||||
|
|
||||||
constructor (frameCount: number) {
|
constructor (frameCount: number) {
|
||||||
super(frameCount, DrawOrderTimeline.propertyIds);
|
super(frameCount, DrawOrderTimeline.propertyIds);
|
||||||
@ -1784,7 +1784,7 @@ export class DrawOrderTimeline extends Timeline {
|
|||||||
* {@link IkConstraint#bendDirection}, {@link IkConstraint#stretch}, and {@link IkConstraint#compress}. */
|
* {@link IkConstraint#bendDirection}, {@link IkConstraint#stretch}, and {@link IkConstraint#compress}. */
|
||||||
export class IkConstraintTimeline extends CurveTimeline {
|
export class IkConstraintTimeline extends CurveTimeline {
|
||||||
/** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */
|
/** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */
|
||||||
ikConstraintIndex: number;
|
ikConstraintIndex: number = 0;
|
||||||
|
|
||||||
constructor (frameCount: number, bezierCount: number, ikConstraintIndex: number) {
|
constructor (frameCount: number, bezierCount: number, ikConstraintIndex: number) {
|
||||||
super(frameCount, bezierCount, [
|
super(frameCount, bezierCount, [
|
||||||
@ -1882,7 +1882,7 @@ export class IkConstraintTimeline extends CurveTimeline {
|
|||||||
* {@link TransformConstraint#scaleMix}, and {@link TransformConstraint#shearMix}. */
|
* {@link TransformConstraint#scaleMix}, and {@link TransformConstraint#shearMix}. */
|
||||||
export class TransformConstraintTimeline extends CurveTimeline {
|
export class TransformConstraintTimeline extends CurveTimeline {
|
||||||
/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
|
/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
|
||||||
transformConstraintIndex: number;
|
transformConstraintIndex: number = 0;
|
||||||
|
|
||||||
constructor (frameCount: number, bezierCount: number, transformConstraintIndex: number) {
|
constructor (frameCount: number, bezierCount: number, transformConstraintIndex: number) {
|
||||||
super(frameCount, bezierCount, [
|
super(frameCount, bezierCount, [
|
||||||
@ -1995,7 +1995,7 @@ export class TransformConstraintTimeline extends CurveTimeline {
|
|||||||
/** Changes a path constraint's {@link PathConstraint#position}. */
|
/** Changes a path constraint's {@link PathConstraint#position}. */
|
||||||
export class PathConstraintPositionTimeline extends CurveTimeline1 {
|
export class PathConstraintPositionTimeline extends CurveTimeline1 {
|
||||||
/** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */
|
/** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */
|
||||||
pathConstraintIndex: number;
|
pathConstraintIndex: number = 0;
|
||||||
|
|
||||||
constructor (frameCount: number, bezierCount: number, pathConstraintIndex: number) {
|
constructor (frameCount: number, bezierCount: number, pathConstraintIndex: number) {
|
||||||
super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
|
super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
|
||||||
@ -2218,16 +2218,23 @@ export class SequenceTimeline extends Timeline implements SlotTimeline {
|
|||||||
case SequenceMode.loop:
|
case SequenceMode.loop:
|
||||||
index %= count;
|
index %= count;
|
||||||
break;
|
break;
|
||||||
case SequenceMode.pingpong:
|
case SequenceMode.pingpong: {
|
||||||
let n = (count << 1) - 2;
|
let n = (count << 1) - 2;
|
||||||
index %= n;
|
index %= n;
|
||||||
if (index >= count) index = n - index;
|
if (index >= count) index = n - index;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SequenceMode.onceReverse:
|
case SequenceMode.onceReverse:
|
||||||
index = Math.max(count - 1 - index, 0);
|
index = Math.max(count - 1 - index, 0);
|
||||||
break;
|
break;
|
||||||
case SequenceMode.loopReverse:
|
case SequenceMode.loopReverse:
|
||||||
index = count - 1 - (index % count);
|
index = count - 1 - (index % count);
|
||||||
|
break;
|
||||||
|
case SequenceMode.pingpongReverse: {
|
||||||
|
let n = (count << 1) - 2;
|
||||||
|
index = (index + count - 1) % n;
|
||||||
|
if (index >= count) index = n - index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
slot.sequenceIndex = index;
|
slot.sequenceIndex = index;
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export class AnimationState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The AnimationStateData to look up mix durations. */
|
/** 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. */
|
/** The list of tracks that currently have animations, which may contain null entries. */
|
||||||
tracks = new Array<TrackEntry>();
|
tracks = new Array<TrackEntry>();
|
||||||
@ -645,6 +645,7 @@ export class AnimationState {
|
|||||||
/** @param last May be null. */
|
/** @param last May be null. */
|
||||||
trackEntry (trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry) {
|
trackEntry (trackIndex: number, animation: Animation, loop: boolean, last: TrackEntry) {
|
||||||
let entry = this.trackEntryPool.obtain();
|
let entry = this.trackEntryPool.obtain();
|
||||||
|
entry.reset();
|
||||||
entry.trackIndex = trackIndex;
|
entry.trackIndex = trackIndex;
|
||||||
entry.animation = animation;
|
entry.animation = animation;
|
||||||
entry.loop = loop;
|
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. */
|
* References to a track entry must not be kept after the {@link AnimationStateListener#dispose()} event occurs. */
|
||||||
export class TrackEntry {
|
export class TrackEntry {
|
||||||
/** The animation to apply for this track entry. */
|
/** 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. */
|
/** 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
|
/** 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. */
|
* 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
|
/** 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. */
|
* 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.
|
/** The listener for events generated by this track entry, or null.
|
||||||
*
|
*
|
||||||
* A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
|
* 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. */
|
* 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.
|
/** The index of the track where this track entry is either current or queued.
|
||||||
*
|
*
|
||||||
* See {@link AnimationState#getCurrent()}. */
|
* 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
|
/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
||||||
* duration. */
|
* 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
|
/** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
|
||||||
* of being mixed out.
|
* 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
|
* Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
|
||||||
* previous animation. */
|
* previous animation. */
|
||||||
holdPrevious: boolean;
|
holdPrevious: boolean = false;
|
||||||
|
|
||||||
reverse: boolean;
|
reverse: boolean = false;
|
||||||
|
|
||||||
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
|
/** 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
|
* `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. */
|
* 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
|
/** 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
|
* `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. */
|
* 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
|
/** 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,
|
* `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. */
|
* 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.
|
/** 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
|
* 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. */
|
* 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
|
/** 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}. */
|
* 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
|
/** 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
|
* 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
|
* `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
|
||||||
* is applied. */
|
* 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`
|
/** 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
|
* 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`).
|
* track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
|
||||||
*
|
*
|
||||||
* {@link #timeScale} affects the 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
|
/** 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
|
* {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
|
||||||
* looping. */
|
* 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
|
/** 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
|
* 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
|
* It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
|
||||||
* abruptly cease being applied. */
|
* 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
|
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
|
||||||
* faster. Defaults to 1.
|
* faster. Defaults to 1.
|
||||||
@ -891,18 +892,18 @@ export class TrackEntry {
|
|||||||
* the time scale is not 1, the delay may need to be adjusted.
|
* the time scale is not 1, the delay may need to be adjusted.
|
||||||
*
|
*
|
||||||
* See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
|
* 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
|
/** 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.
|
* 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
|
* 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. */
|
* 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
|
/** 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. */
|
* 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
|
/** 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).
|
* {@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
|
* 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
|
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
|
||||||
* afterward. */
|
* 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
|
/** 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
|
* 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 {
|
export class EventQueue {
|
||||||
objects: Array<any> = [];
|
objects: Array<any> = [];
|
||||||
drainDisabled = false;
|
drainDisabled = false;
|
||||||
animState: AnimationState;
|
animState: AnimationState = null;
|
||||||
|
|
||||||
constructor (animState: AnimationState) {
|
constructor (animState: AnimationState) {
|
||||||
this.animState = animState;
|
this.animState = animState;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ import { StringMap } from "./Utils";
|
|||||||
/** Stores mix (crossfade) durations to be applied when {@link AnimationState} animations are changed. */
|
/** Stores mix (crossfade) durations to be applied when {@link AnimationState} animations are changed. */
|
||||||
export class AnimationStateData {
|
export class AnimationStateData {
|
||||||
/** The SkeletonData to look up animations when they are specified by name. */
|
/** The SkeletonData to look up animations when they are specified by name. */
|
||||||
skeletonData: SkeletonData;
|
skeletonData: SkeletonData = null;
|
||||||
|
|
||||||
animationToMixTime: StringMap<number> = {};
|
animationToMixTime: StringMap<number> = {};
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import { TextureAtlas } from "./TextureAtlas";
|
|||||||
import { Disposable, StringMap } from "./Utils";
|
import { Disposable, StringMap } from "./Utils";
|
||||||
|
|
||||||
export class AssetManagerBase implements Disposable {
|
export class AssetManagerBase implements Disposable {
|
||||||
private pathPrefix: string;
|
private pathPrefix: string = null;
|
||||||
private textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture;
|
private textureLoader: (image: HTMLImageElement | ImageBitmap) => Texture;
|
||||||
private downloader: Downloader;
|
private downloader: Downloader;
|
||||||
private assets: StringMap<any> = {};
|
private assets: StringMap<any> = {};
|
||||||
|
|||||||
@ -43,7 +43,7 @@ import { Sequence } from "./attachments/Sequence"
|
|||||||
* See [Loading skeleton data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the
|
* See [Loading skeleton data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the
|
||||||
* Spine Runtimes Guide. */
|
* Spine Runtimes Guide. */
|
||||||
export class AtlasAttachmentLoader implements AttachmentLoader {
|
export class AtlasAttachmentLoader implements AttachmentLoader {
|
||||||
atlas: TextureAtlas;
|
atlas: TextureAtlas = null;
|
||||||
|
|
||||||
constructor (atlas: TextureAtlas) {
|
constructor (atlas: TextureAtlas) {
|
||||||
this.atlas = atlas;
|
this.atlas = atlas;
|
||||||
|
|||||||
@ -39,13 +39,13 @@ import { MathUtils, Vector2 } from "./Utils";
|
|||||||
* constraint or application code modifies the world transform after it was computed from the local transform. */
|
* constraint or application code modifies the world transform after it was computed from the local transform. */
|
||||||
export class Bone implements Updatable {
|
export class Bone implements Updatable {
|
||||||
/** The bone's setup pose data. */
|
/** The bone's setup pose data. */
|
||||||
data: BoneData;
|
data: BoneData = null;
|
||||||
|
|
||||||
/** The skeleton this bone belongs to. */
|
/** The skeleton this bone belongs to. */
|
||||||
skeleton: Skeleton;
|
skeleton: Skeleton = null;
|
||||||
|
|
||||||
/** The parent bone, or null if this is the root bone. */
|
/** The parent bone, or null if this is the root bone. */
|
||||||
parent: Bone;
|
parent: Bone = null;
|
||||||
|
|
||||||
/** The immediate children of this bone. */
|
/** The immediate children of this bone. */
|
||||||
children = new Array<Bone>();
|
children = new Array<Bone>();
|
||||||
|
|||||||
@ -32,16 +32,16 @@ import { Color } from "./Utils";
|
|||||||
/** Stores the setup pose for a {@link Bone}. */
|
/** Stores the setup pose for a {@link Bone}. */
|
||||||
export class BoneData {
|
export class BoneData {
|
||||||
/** The index of the bone in {@link Skeleton#getBones()}. */
|
/** The index of the bone in {@link Skeleton#getBones()}. */
|
||||||
index: number;
|
index: number = 0;
|
||||||
|
|
||||||
/** The name of the bone, which is unique across all bones in the skeleton. */
|
/** The name of the bone, which is unique across all bones in the skeleton. */
|
||||||
name: string;
|
name: string = null;
|
||||||
|
|
||||||
/** @returns May be null. */
|
/** @returns May be null. */
|
||||||
parent: BoneData;
|
parent: BoneData = null;
|
||||||
|
|
||||||
/** The bone's length. */
|
/** The bone's length. */
|
||||||
length: number;
|
length: number = 0;
|
||||||
|
|
||||||
/** The local x translation. */
|
/** The local x translation. */
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|||||||
@ -35,13 +35,13 @@ import { EventData } from "./EventData";
|
|||||||
* AnimationStateListener {@link AnimationStateListener#event()}, and
|
* AnimationStateListener {@link AnimationStateListener#event()}, and
|
||||||
* [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
|
* [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
|
||||||
export class Event {
|
export class Event {
|
||||||
data: EventData;
|
data: EventData = null;
|
||||||
intValue: number;
|
intValue: number = 0;
|
||||||
floatValue: number;
|
floatValue: number = 0;
|
||||||
stringValue: string;
|
stringValue: string = null;
|
||||||
time: number;
|
time: number = 0;
|
||||||
volume: number;
|
volume: number = 0;
|
||||||
balance: number;
|
balance: number = 0;
|
||||||
|
|
||||||
constructor (time: number, data: EventData) {
|
constructor (time: number, data: EventData) {
|
||||||
if (!data) throw new Error("data cannot be null.");
|
if (!data) throw new Error("data cannot be null.");
|
||||||
|
|||||||
@ -31,13 +31,13 @@
|
|||||||
*
|
*
|
||||||
* See [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
|
* See [Events](http://esotericsoftware.com/spine-events) in the Spine User Guide. */
|
||||||
export class EventData {
|
export class EventData {
|
||||||
name: string;
|
name: string = null;
|
||||||
intValue: number;
|
intValue: number = 0;
|
||||||
floatValue: number;
|
floatValue: number = 0;
|
||||||
stringValue: string;
|
stringValue: string = null;
|
||||||
audioPath: string;
|
audioPath: string = null;
|
||||||
volume: number;
|
volume: number = 0;
|
||||||
balance: number;
|
balance: number = 0;
|
||||||
|
|
||||||
constructor (name: string) {
|
constructor (name: string) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@ -40,13 +40,13 @@ import { MathUtils } from "./Utils";
|
|||||||
* See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */
|
* See [IK constraints](http://esotericsoftware.com/spine-ik-constraints) in the Spine User Guide. */
|
||||||
export class IkConstraint implements Updatable {
|
export class IkConstraint implements Updatable {
|
||||||
/** The IK constraint's setup pose data. */
|
/** The IK constraint's setup pose data. */
|
||||||
data: IkConstraintData;
|
data: IkConstraintData = null;
|
||||||
|
|
||||||
/** The bones that will be modified by this IK constraint. */
|
/** The bones that will be modified by this IK constraint. */
|
||||||
bones: Array<Bone>;
|
bones: Array<Bone> = null;
|
||||||
|
|
||||||
/** The bone that is the IK target. */
|
/** The bone that is the IK target. */
|
||||||
target: Bone;
|
target: Bone = null;
|
||||||
|
|
||||||
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
||||||
bendDirection = 0;
|
bendDirection = 0;
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export class IkConstraintData extends ConstraintData {
|
|||||||
bones = new Array<BoneData>();
|
bones = new Array<BoneData>();
|
||||||
|
|
||||||
/** The bone that is the IK target. */
|
/** The bone that is the IK target. */
|
||||||
target: BoneData;
|
target: BoneData = null;
|
||||||
|
|
||||||
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
||||||
bendDirection = 1;
|
bendDirection = 1;
|
||||||
|
|||||||
@ -45,13 +45,13 @@ export class PathConstraint implements Updatable {
|
|||||||
static epsilon = 0.00001;
|
static epsilon = 0.00001;
|
||||||
|
|
||||||
/** The path constraint's setup pose data. */
|
/** The path constraint's setup pose data. */
|
||||||
data: PathConstraintData;
|
data: PathConstraintData = null;
|
||||||
|
|
||||||
/** The bones that will be modified by this path constraint. */
|
/** The bones that will be modified by this path constraint. */
|
||||||
bones: Array<Bone>;
|
bones: Array<Bone> = null;
|
||||||
|
|
||||||
/** The slot whose path attachment will be used to constrained the bones. */
|
/** The slot whose path attachment will be used to constrained the bones. */
|
||||||
target: Slot;
|
target: Slot = null;
|
||||||
|
|
||||||
/** The position along the path. */
|
/** The position along the path. */
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|||||||
@ -41,25 +41,25 @@ export class PathConstraintData extends ConstraintData {
|
|||||||
bones = new Array<BoneData>();
|
bones = new Array<BoneData>();
|
||||||
|
|
||||||
/** The slot whose path attachment will be used to constrained the bones. */
|
/** The slot whose path attachment will be used to constrained the bones. */
|
||||||
target: SlotData;
|
target: SlotData = null;
|
||||||
|
|
||||||
/** The mode for positioning the first bone on the path. */
|
/** The mode for positioning the first bone on the path. */
|
||||||
positionMode: PositionMode;
|
positionMode: PositionMode = null;
|
||||||
|
|
||||||
/** The mode for positioning the bones after the first bone on the path. */
|
/** The mode for positioning the bones after the first bone on the path. */
|
||||||
spacingMode: SpacingMode;
|
spacingMode: SpacingMode = null;
|
||||||
|
|
||||||
/** The mode for adjusting the rotation of the bones. */
|
/** The mode for adjusting the rotation of the bones. */
|
||||||
rotateMode: RotateMode;
|
rotateMode: RotateMode = null;
|
||||||
|
|
||||||
/** An offset added to the constrained bone rotation. */
|
/** An offset added to the constrained bone rotation. */
|
||||||
offsetRotation: number;
|
offsetRotation: number = 0;
|
||||||
|
|
||||||
/** The position along the path. */
|
/** The position along the path. */
|
||||||
position: number;
|
position: number = 0;
|
||||||
|
|
||||||
/** The spacing between bones. */
|
/** The spacing between bones. */
|
||||||
spacing: number;
|
spacing: number = 0;
|
||||||
|
|
||||||
mixRotate = 0;
|
mixRotate = 0;
|
||||||
mixX = 0;
|
mixX = 0;
|
||||||
|
|||||||
@ -46,34 +46,34 @@ import { Color, Utils, MathUtils, Vector2, NumberArrayLike } from "./Utils";
|
|||||||
* See [Instance objects](http://esotericsoftware.com/spine-runtime-architecture#Instance-objects) in the Spine Runtimes Guide. */
|
* See [Instance objects](http://esotericsoftware.com/spine-runtime-architecture#Instance-objects) in the Spine Runtimes Guide. */
|
||||||
export class Skeleton {
|
export class Skeleton {
|
||||||
/** The skeleton's setup pose data. */
|
/** The skeleton's setup pose data. */
|
||||||
data: SkeletonData;
|
data: SkeletonData = null;
|
||||||
|
|
||||||
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
||||||
bones: Array<Bone>;
|
bones: Array<Bone> = null;
|
||||||
|
|
||||||
/** The skeleton's slots. */
|
/** The skeleton's slots. */
|
||||||
slots: Array<Slot>;
|
slots: Array<Slot> = null;
|
||||||
|
|
||||||
/** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */
|
/** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */
|
||||||
drawOrder: Array<Slot>;
|
drawOrder: Array<Slot> = null;
|
||||||
|
|
||||||
/** The skeleton's IK constraints. */
|
/** The skeleton's IK constraints. */
|
||||||
ikConstraints: Array<IkConstraint>;
|
ikConstraints: Array<IkConstraint> = null;
|
||||||
|
|
||||||
/** The skeleton's transform constraints. */
|
/** The skeleton's transform constraints. */
|
||||||
transformConstraints: Array<TransformConstraint>;
|
transformConstraints: Array<TransformConstraint> = null;
|
||||||
|
|
||||||
/** The skeleton's path constraints. */
|
/** The skeleton's path constraints. */
|
||||||
pathConstraints: Array<PathConstraint>;
|
pathConstraints: Array<PathConstraint> = null;
|
||||||
|
|
||||||
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
||||||
_updateCache = new Array<Updatable>();
|
_updateCache = new Array<Updatable>();
|
||||||
|
|
||||||
/** The skeleton's current skin. May be null. */
|
/** The skeleton's current skin. May be null. */
|
||||||
skin: Skin;
|
skin: Skin = null;
|
||||||
|
|
||||||
/** The color to tint all the skeleton's attachments. */
|
/** The color to tint all the skeleton's attachments. */
|
||||||
color: Color;
|
color: Color = null;
|
||||||
|
|
||||||
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
|
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
|
||||||
* inheritance. */
|
* inheritance. */
|
||||||
|
|||||||
@ -56,7 +56,7 @@ export class SkeletonBinary {
|
|||||||
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
|
||||||
attachmentLoader: AttachmentLoader;
|
attachmentLoader: AttachmentLoader = null;
|
||||||
private linkedMeshes = new Array<LinkedMesh>();
|
private linkedMeshes = new Array<LinkedMesh>();
|
||||||
|
|
||||||
constructor (attachmentLoader: AttachmentLoader) {
|
constructor (attachmentLoader: AttachmentLoader) {
|
||||||
|
|||||||
@ -43,7 +43,7 @@ import { TransformConstraintData } from "./TransformConstraintData";
|
|||||||
export class SkeletonData {
|
export class SkeletonData {
|
||||||
|
|
||||||
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
|
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
|
||||||
name: string;
|
name: string = null;
|
||||||
|
|
||||||
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
||||||
bones = new Array<BoneData>(); // Ordered parents first.
|
bones = new Array<BoneData>(); // Ordered parents first.
|
||||||
@ -56,7 +56,7 @@ export class SkeletonData {
|
|||||||
*
|
*
|
||||||
* See {@link Skeleton#getAttachmentByName()}.
|
* See {@link Skeleton#getAttachmentByName()}.
|
||||||
* May be null. */
|
* May be null. */
|
||||||
defaultSkin: Skin;
|
defaultSkin: Skin = null;
|
||||||
|
|
||||||
/** The skeleton's events. */
|
/** The skeleton's events. */
|
||||||
events = new Array<EventData>();
|
events = new Array<EventData>();
|
||||||
@ -74,32 +74,32 @@ export class SkeletonData {
|
|||||||
pathConstraints = new Array<PathConstraintData>();
|
pathConstraints = new Array<PathConstraintData>();
|
||||||
|
|
||||||
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
||||||
x: number;
|
x: number = 0;
|
||||||
|
|
||||||
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
||||||
y: number;
|
y: number = 0;
|
||||||
|
|
||||||
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
|
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
|
||||||
width: number;
|
width: number = 0;
|
||||||
|
|
||||||
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
|
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
|
||||||
height: number;
|
height: number = 0;
|
||||||
|
|
||||||
/** The Spine version used to export the skeleton data, or null. */
|
/** The Spine version used to export the skeleton data, or null. */
|
||||||
version: string;
|
version: string = null;
|
||||||
|
|
||||||
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
|
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
|
||||||
hash: string;
|
hash: string = null;
|
||||||
|
|
||||||
// Nonessential
|
// Nonessential
|
||||||
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
|
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
|
||||||
fps = 0;
|
fps = 0;
|
||||||
|
|
||||||
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
||||||
imagesPath: string;
|
imagesPath: string = null;
|
||||||
|
|
||||||
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
||||||
audioPath: string;
|
audioPath: string = null;
|
||||||
|
|
||||||
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
|
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
|
||||||
* multiple times.
|
* multiple times.
|
||||||
|
|||||||
@ -51,7 +51,7 @@ import { HasTextureRegion } from "./attachments/HasTextureRegion";
|
|||||||
* [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine
|
* [JSON and binary data](http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data) in the Spine
|
||||||
* Runtimes Guide. */
|
* Runtimes Guide. */
|
||||||
export class SkeletonJson {
|
export class SkeletonJson {
|
||||||
attachmentLoader: AttachmentLoader;
|
attachmentLoader: AttachmentLoader = null;
|
||||||
|
|
||||||
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
||||||
* runtime than were used in Spine.
|
* runtime than were used in Spine.
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import { StringMap } from "./Utils";
|
|||||||
|
|
||||||
/** Stores an entry in the skin consisting of the slot index, name, and attachment **/
|
/** Stores an entry in the skin consisting of the slot index, name, and attachment **/
|
||||||
export class SkinEntry {
|
export class SkinEntry {
|
||||||
constructor (public slotIndex: number, public name: string, public attachment: Attachment) { }
|
constructor (public slotIndex: number = 0, public name: string = null, public attachment: Attachment = null) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Stores attachments by slot index and attachment name.
|
/** Stores attachments by slot index and attachment name.
|
||||||
@ -45,7 +45,7 @@ export class SkinEntry {
|
|||||||
* [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide. */
|
* [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide. */
|
||||||
export class Skin {
|
export class Skin {
|
||||||
/** The skin's name, which is unique across all skins in the skeleton. */
|
/** The skin's name, which is unique across all skins in the skeleton. */
|
||||||
name: string;
|
name: string = null;
|
||||||
|
|
||||||
attachments = new Array<StringMap<Attachment>>();
|
attachments = new Array<StringMap<Attachment>>();
|
||||||
bones = Array<BoneData>();
|
bones = Array<BoneData>();
|
||||||
|
|||||||
@ -38,22 +38,22 @@ import { Color } from "./Utils";
|
|||||||
* across multiple skeletons. */
|
* across multiple skeletons. */
|
||||||
export class Slot {
|
export class Slot {
|
||||||
/** The slot's setup pose data. */
|
/** The slot's setup pose data. */
|
||||||
data: SlotData;
|
data: SlotData = null;
|
||||||
|
|
||||||
/** The bone this slot belongs to. */
|
/** The bone this slot belongs to. */
|
||||||
bone: Bone;
|
bone: Bone = null;
|
||||||
|
|
||||||
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
|
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
|
||||||
* color tinting. */
|
* color tinting. */
|
||||||
color: Color;
|
color: Color = null;
|
||||||
|
|
||||||
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
|
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
|
||||||
* color's alpha is not used. */
|
* color's alpha is not used. */
|
||||||
darkColor: Color;
|
darkColor: Color = null;
|
||||||
|
|
||||||
attachment: Attachment;
|
attachment: Attachment = null;
|
||||||
|
|
||||||
attachmentState: number;
|
attachmentState: number = 0;
|
||||||
|
|
||||||
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
|
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
|
||||||
* {@link Sequence#getSetupIndex()}. */
|
* {@link Sequence#getSetupIndex()}. */
|
||||||
|
|||||||
@ -33,13 +33,13 @@ import { Color } from "./Utils";
|
|||||||
/** Stores the setup pose for a {@link Slot}. */
|
/** Stores the setup pose for a {@link Slot}. */
|
||||||
export class SlotData {
|
export class SlotData {
|
||||||
/** The index of the slot in {@link Skeleton#getSlots()}. */
|
/** The index of the slot in {@link Skeleton#getSlots()}. */
|
||||||
index: number;
|
index: number = 0;
|
||||||
|
|
||||||
/** The name of the slot, which is unique across all slots in the skeleton. */
|
/** The name of the slot, which is unique across all slots in the skeleton. */
|
||||||
name: string;
|
name: string = null;
|
||||||
|
|
||||||
/** The bone this slot belongs to. */
|
/** The bone this slot belongs to. */
|
||||||
boneData: BoneData;
|
boneData: BoneData = null;
|
||||||
|
|
||||||
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
|
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
|
||||||
* color tinting. */
|
* color tinting. */
|
||||||
@ -47,13 +47,13 @@ export class SlotData {
|
|||||||
|
|
||||||
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
|
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
|
||||||
* color's alpha is not used. */
|
* color's alpha is not used. */
|
||||||
darkColor: Color;
|
darkColor: Color = null;
|
||||||
|
|
||||||
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
||||||
attachmentName: string;
|
attachmentName: string = null;
|
||||||
|
|
||||||
/** The blend mode for drawing the slot's attachment. */
|
/** The blend mode for drawing the slot's attachment. */
|
||||||
blendMode: BlendMode;
|
blendMode: BlendMode = null;
|
||||||
|
|
||||||
constructor (index: number, name: string, boneData: BoneData) {
|
constructor (index: number, name: string, boneData: BoneData) {
|
||||||
if (index < 0) throw new Error("index must be >= 0.");
|
if (index < 0) throw new Error("index must be >= 0.");
|
||||||
|
|||||||
@ -198,7 +198,7 @@ export class TextureAtlas implements Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TextureAtlasReader {
|
class TextureAtlasReader {
|
||||||
lines: Array<string>;
|
lines: Array<string> = null;
|
||||||
index: number = 0;
|
index: number = 0;
|
||||||
|
|
||||||
constructor (text: string) {
|
constructor (text: string) {
|
||||||
@ -233,15 +233,15 @@ class TextureAtlasReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TextureAtlasPage {
|
export class TextureAtlasPage {
|
||||||
name: string;
|
name: string = null;
|
||||||
minFilter: TextureFilter = TextureFilter.Nearest;
|
minFilter: TextureFilter = TextureFilter.Nearest;
|
||||||
magFilter: TextureFilter = TextureFilter.Nearest;
|
magFilter: TextureFilter = TextureFilter.Nearest;
|
||||||
uWrap: TextureWrap = TextureWrap.ClampToEdge;
|
uWrap: TextureWrap = TextureWrap.ClampToEdge;
|
||||||
vWrap: TextureWrap = TextureWrap.ClampToEdge;
|
vWrap: TextureWrap = TextureWrap.ClampToEdge;
|
||||||
texture: Texture;
|
texture: Texture = null;
|
||||||
width: number;
|
width: number = 0;
|
||||||
height: number;
|
height: number = 0;
|
||||||
pma: boolean;
|
pma: boolean = false;
|
||||||
|
|
||||||
setTexture (texture: Texture) {
|
setTexture (texture: Texture) {
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
@ -251,16 +251,16 @@ export class TextureAtlasPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TextureAtlasRegion extends TextureRegion {
|
export class TextureAtlasRegion extends TextureRegion {
|
||||||
page: TextureAtlasPage;
|
page: TextureAtlasPage = null;
|
||||||
name: string;
|
name: string = null;
|
||||||
x: number;
|
x: number = 0;
|
||||||
y: number;
|
y: number = 0;
|
||||||
offsetX: number;
|
offsetX: number = 0;
|
||||||
offsetY: number;
|
offsetY: number = 0;
|
||||||
originalWidth: number;
|
originalWidth: number = 0;
|
||||||
originalHeight: number;
|
originalHeight: number = 0;
|
||||||
index: number;
|
index: number = 0;
|
||||||
degrees: number;
|
degrees: number = 0;
|
||||||
names: string[];
|
names: string[] = null;
|
||||||
values: number[][];
|
values: number[][] = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,13 +41,13 @@ import { Vector2, MathUtils } from "./Utils";
|
|||||||
export class TransformConstraint implements Updatable {
|
export class TransformConstraint implements Updatable {
|
||||||
|
|
||||||
/** The transform constraint's setup pose data. */
|
/** The transform constraint's setup pose data. */
|
||||||
data: TransformConstraintData;
|
data: TransformConstraintData = null;
|
||||||
|
|
||||||
/** The bones that will be modified by this transform constraint. */
|
/** The bones that will be modified by this transform constraint. */
|
||||||
bones: Array<Bone>;
|
bones: Array<Bone> = null;
|
||||||
|
|
||||||
/** The target bone whose world transform will be copied to the constrained bones. */
|
/** The target bone whose world transform will be copied to the constrained bones. */
|
||||||
target: Bone;
|
target: Bone = null;
|
||||||
|
|
||||||
mixRotate = 0; mixX = 0; mixY = 0; mixScaleX = 0; mixScaleY = 0; mixShearY = 0;
|
mixRotate = 0; mixX = 0; mixY = 0; mixScaleX = 0; mixScaleY = 0; mixShearY = 0;
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export class TransformConstraintData extends ConstraintData {
|
|||||||
bones = new Array<BoneData>();
|
bones = new Array<BoneData>();
|
||||||
|
|
||||||
/** The target bone whose world transform will be copied to the constrained bones. */
|
/** The target bone whose world transform will be copied to the constrained bones. */
|
||||||
target: BoneData;
|
target: BoneData = null;
|
||||||
|
|
||||||
mixRotate = 0;
|
mixRotate = 0;
|
||||||
mixX = 0;
|
mixX = 0;
|
||||||
|
|||||||
@ -53,12 +53,12 @@ export abstract class VertexAttachment extends Attachment {
|
|||||||
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
|
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
|
||||||
* the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
|
* the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
|
||||||
* if this attachment has no weights. */
|
* if this attachment has no weights. */
|
||||||
bones: Array<number>;
|
bones: Array<number> = null;
|
||||||
|
|
||||||
/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
|
/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
|
||||||
* entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
|
* entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
|
||||||
* each vertex. */
|
* each vertex. */
|
||||||
vertices: NumberArrayLike;
|
vertices: NumberArrayLike = null;
|
||||||
|
|
||||||
/** The maximum number of world vertex values that can be output by
|
/** The maximum number of world vertex values that can be output by
|
||||||
* {@link #computeWorldVertices()} using the `count` parameter. */
|
* {@link #computeWorldVertices()} using the `count` parameter. */
|
||||||
|
|||||||
@ -35,7 +35,7 @@ import { VertexAttachment, Attachment } from "./Attachment";
|
|||||||
export class ClippingAttachment extends VertexAttachment {
|
export class ClippingAttachment extends VertexAttachment {
|
||||||
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
||||||
* the skeleton's rendering. */
|
* the skeleton's rendering. */
|
||||||
endSlot: SlotData;
|
endSlot: SlotData = null;
|
||||||
|
|
||||||
// Nonessential.
|
// Nonessential.
|
||||||
/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
|
/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
|
||||||
|
|||||||
@ -40,41 +40,41 @@ import { Slot } from "../Slot";
|
|||||||
*
|
*
|
||||||
* See [Mesh attachments](http://esotericsoftware.com/spine-meshes) in the Spine User Guide. */
|
* See [Mesh attachments](http://esotericsoftware.com/spine-meshes) in the Spine User Guide. */
|
||||||
export class MeshAttachment extends VertexAttachment implements HasTextureRegion {
|
export class MeshAttachment extends VertexAttachment implements HasTextureRegion {
|
||||||
region: TextureRegion;
|
region: TextureRegion = null;
|
||||||
|
|
||||||
/** The name of the texture region for this attachment. */
|
/** The name of the texture region for this attachment. */
|
||||||
path: string;
|
path: string = null;
|
||||||
|
|
||||||
/** The UV pair for each vertex, normalized within the texture region. */
|
/** The UV pair for each vertex, normalized within the texture region. */
|
||||||
regionUVs: NumberArrayLike;
|
regionUVs: NumberArrayLike = null;
|
||||||
|
|
||||||
/** The UV pair for each vertex, normalized within the entire texture.
|
/** The UV pair for each vertex, normalized within the entire texture.
|
||||||
*
|
*
|
||||||
* See {@link #updateUVs}. */
|
* See {@link #updateUVs}. */
|
||||||
uvs: NumberArrayLike;
|
uvs: NumberArrayLike = null;
|
||||||
|
|
||||||
/** Triplets of vertex indices which describe the mesh's triangulation. */
|
/** Triplets of vertex indices which describe the mesh's triangulation. */
|
||||||
triangles: Array<number>;
|
triangles: Array<number> = null;
|
||||||
|
|
||||||
/** The color to tint the mesh. */
|
/** The color to tint the mesh. */
|
||||||
color = new Color(1, 1, 1, 1);
|
color = new Color(1, 1, 1, 1);
|
||||||
|
|
||||||
/** The width of the mesh's image. Available only when nonessential data was exported. */
|
/** The width of the mesh's image. Available only when nonessential data was exported. */
|
||||||
width: number;
|
width: number = 0;
|
||||||
|
|
||||||
/** The height of the mesh's image. Available only when nonessential data was exported. */
|
/** The height of the mesh's image. Available only when nonessential data was exported. */
|
||||||
height: number;
|
height: number = 0;
|
||||||
|
|
||||||
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
|
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
|
||||||
hullLength: number;
|
hullLength: number = 0;
|
||||||
|
|
||||||
/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
|
/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
|
||||||
* nonessential data was exported. Triangulation is not performed at runtime. */
|
* nonessential data was exported. Triangulation is not performed at runtime. */
|
||||||
edges: Array<number>;
|
edges: Array<number> = null;
|
||||||
|
|
||||||
private parentMesh: MeshAttachment;
|
private parentMesh: MeshAttachment = null;
|
||||||
|
|
||||||
sequence: Sequence;
|
sequence: Sequence = null;
|
||||||
|
|
||||||
tempColor = new Color(0, 0, 0, 0);
|
tempColor = new Color(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import { VertexAttachment, Attachment } from "./Attachment";
|
|||||||
export class PathAttachment extends VertexAttachment {
|
export class PathAttachment extends VertexAttachment {
|
||||||
|
|
||||||
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
||||||
lengths: Array<number>;
|
lengths: Array<number> = null;
|
||||||
|
|
||||||
/** If true, the start and end knots are connected. */
|
/** If true, the start and end knots are connected. */
|
||||||
closed = false;
|
closed = false;
|
||||||
|
|||||||
@ -37,7 +37,9 @@ import { VertexAttachment, Attachment } from "./Attachment";
|
|||||||
*
|
*
|
||||||
* See [Point Attachments](http://esotericsoftware.com/spine-point-attachments) in the Spine User Guide. */
|
* See [Point Attachments](http://esotericsoftware.com/spine-point-attachments) in the Spine User Guide. */
|
||||||
export class PointAttachment extends VertexAttachment {
|
export class PointAttachment extends VertexAttachment {
|
||||||
x: number; y: number; rotation: number;
|
x: number = 0;
|
||||||
|
y: number = 0;
|
||||||
|
rotation: number = 0;
|
||||||
|
|
||||||
/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
|
/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
|
||||||
* are not usually rendered at runtime. */
|
* are not usually rendered at runtime. */
|
||||||
|
|||||||
@ -64,11 +64,11 @@ export class RegionAttachment extends Attachment implements HasTextureRegion {
|
|||||||
color = new Color(1, 1, 1, 1);
|
color = new Color(1, 1, 1, 1);
|
||||||
|
|
||||||
/** The name of the texture region for this attachment. */
|
/** The name of the texture region for this attachment. */
|
||||||
path: string;
|
path: string = null;
|
||||||
|
|
||||||
private rendererObject: any;
|
private rendererObject: any = null;
|
||||||
region: TextureRegion;
|
region: TextureRegion = null;
|
||||||
sequence: Sequence;
|
sequence: Sequence = null;
|
||||||
|
|
||||||
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
|
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -12,6 +12,8 @@
|
|||||||
],
|
],
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node"
|
||||||
|
/*"strictNullChecks": true,
|
||||||
|
"strictPropertyInitialization": true*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +63,14 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches. <seealso cref="Spine.Unity.SpineAtlasAsset.CreateRuntimeInstance(TextAsset, Material[], bool)"/></summary>
|
/// Creates a runtime AtlasAsset. Only providing the textures is slower
|
||||||
|
/// because it has to search for atlas page matches.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textures">An array of all textures referenced in the provided <c>atlasText</c>
|
||||||
|
/// atlas asset JSON file. When procedurally creating textures, each <c>Texture.name</c>
|
||||||
|
/// needs to be set to the atlas page texture filename without the .png extension,
|
||||||
|
/// e.g. 'my_skeleton' if the png filename listed in the atlas asset file is 'my_skeleton.png'.</param>
|
||||||
|
/// <seealso cref="Spine.Unity.SpineAtlasAsset.CreateRuntimeInstance(TextAsset, Material[], bool)"/>
|
||||||
public static SpineAtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Material materialPropertySource, bool initialize) {
|
public static SpineAtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Material materialPropertySource, bool initialize) {
|
||||||
// Get atlas page names.
|
// Get atlas page names.
|
||||||
string atlasString = atlasText.text;
|
string atlasString = atlasText.text;
|
||||||
@ -103,7 +110,12 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches. <seealso cref="Spine.Unity.AtlasAssetBase.CreateRuntimeInstance(TextAsset, Material[], bool)"/></summary>
|
/// Creates a runtime AtlasAsset. Only providing the textures is slower because it has to search for atlas page matches.
|
||||||
|
/// <param name="textures">An array of all textures referenced in the provided <c>atlasText</c>
|
||||||
|
/// atlas asset JSON file. When procedurally creating textures, each <c>Texture.name</c>
|
||||||
|
/// needs to be set to the atlas page texture filename without the .png extension,
|
||||||
|
/// e.g. 'my_skeleton' if the png filename listed in the atlas asset file is 'my_skeleton.png'.</param>
|
||||||
|
/// <seealso cref="Spine.Unity.AtlasAssetBase.CreateRuntimeInstance(TextAsset, Material[], bool)"/></summary>
|
||||||
public static SpineAtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Shader shader, bool initialize) {
|
public static SpineAtlasAsset CreateRuntimeInstance (TextAsset atlasText, Texture2D[] textures, Shader shader, bool initialize) {
|
||||||
if (shader == null)
|
if (shader == null)
|
||||||
shader = Shader.Find("Spine/Skeleton");
|
shader = Shader.Find("Spine/Skeleton");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user