mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Store timeline ids inside set in Animation for O(1) lookup. See #1462.
This commit is contained in:
parent
1902286db1
commit
18eb242df6
3
spine-ts/build/spine-all.d.ts
vendored
3
spine-ts/build/spine-all.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
|||||||
class Animation {
|
class Animation {
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline>;
|
||||||
|
timelineIds: Array<boolean>;
|
||||||
duration: number;
|
duration: number;
|
||||||
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
||||||
|
hasTimeline(id: number): boolean;
|
||||||
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||||
@ -281,7 +283,6 @@ declare module spine {
|
|||||||
_animationsChanged(): void;
|
_animationsChanged(): void;
|
||||||
computeHold(entry: TrackEntry): void;
|
computeHold(entry: TrackEntry): void;
|
||||||
computeNotLast(entry: TrackEntry): void;
|
computeNotLast(entry: TrackEntry): void;
|
||||||
hasTimeline(entry: TrackEntry, id: number): boolean;
|
|
||||||
getCurrent(trackIndex: number): TrackEntry;
|
getCurrent(trackIndex: number): TrackEntry;
|
||||||
addListener(listener: AnimationStateListener2): void;
|
addListener(listener: AnimationStateListener2): void;
|
||||||
removeListener(listener: AnimationStateListener2): void;
|
removeListener(listener: AnimationStateListener2): void;
|
||||||
|
|||||||
@ -21,8 +21,14 @@ var spine;
|
|||||||
throw new Error("timelines cannot be null.");
|
throw new Error("timelines cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timelines = timelines;
|
this.timelines = timelines;
|
||||||
|
this.timelineIds = [];
|
||||||
|
for (var i = 0; i < timelines.length; i++)
|
||||||
|
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
Animation.prototype.hasTimeline = function (id) {
|
||||||
|
return this.timelineIds[id] == true;
|
||||||
|
};
|
||||||
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
throw new Error("skeleton cannot be null.");
|
throw new Error("skeleton cannot be null.");
|
||||||
@ -1885,12 +1891,12 @@ var spine;
|
|||||||
if (!propertyIDs.add(id))
|
if (!propertyIDs.add(id))
|
||||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||||
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
||||||
|| timeline instanceof spine.EventTimeline || !this.hasTimeline(to, id)) {
|
|| timeline instanceof spine.EventTimeline || !to.animation.hasTimeline(id)) {
|
||||||
timelineMode[i] = AnimationState.FIRST;
|
timelineMode[i] = AnimationState.FIRST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||||
if (this.hasTimeline(next, id))
|
if (next.animation.hasTimeline(id))
|
||||||
continue;
|
continue;
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||||
@ -1916,13 +1922,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
AnimationState.prototype.hasTimeline = function (entry, id) {
|
|
||||||
var timelines = entry.animation.timelines;
|
|
||||||
for (var i = 0, n = timelines.length; i < n; i++)
|
|
||||||
if (timelines[i].getPropertyId() == id)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
AnimationState.prototype.getCurrent = function (trackIndex) {
|
AnimationState.prototype.getCurrent = function (trackIndex) {
|
||||||
if (trackIndex >= this.tracks.length)
|
if (trackIndex >= this.tracks.length)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
3
spine-ts/build/spine-canvas.d.ts
vendored
3
spine-ts/build/spine-canvas.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
|||||||
class Animation {
|
class Animation {
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline>;
|
||||||
|
timelineIds: Array<boolean>;
|
||||||
duration: number;
|
duration: number;
|
||||||
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
||||||
|
hasTimeline(id: number): boolean;
|
||||||
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||||
@ -281,7 +283,6 @@ declare module spine {
|
|||||||
_animationsChanged(): void;
|
_animationsChanged(): void;
|
||||||
computeHold(entry: TrackEntry): void;
|
computeHold(entry: TrackEntry): void;
|
||||||
computeNotLast(entry: TrackEntry): void;
|
computeNotLast(entry: TrackEntry): void;
|
||||||
hasTimeline(entry: TrackEntry, id: number): boolean;
|
|
||||||
getCurrent(trackIndex: number): TrackEntry;
|
getCurrent(trackIndex: number): TrackEntry;
|
||||||
addListener(listener: AnimationStateListener2): void;
|
addListener(listener: AnimationStateListener2): void;
|
||||||
removeListener(listener: AnimationStateListener2): void;
|
removeListener(listener: AnimationStateListener2): void;
|
||||||
|
|||||||
@ -21,8 +21,14 @@ var spine;
|
|||||||
throw new Error("timelines cannot be null.");
|
throw new Error("timelines cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timelines = timelines;
|
this.timelines = timelines;
|
||||||
|
this.timelineIds = [];
|
||||||
|
for (var i = 0; i < timelines.length; i++)
|
||||||
|
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
Animation.prototype.hasTimeline = function (id) {
|
||||||
|
return this.timelineIds[id] == true;
|
||||||
|
};
|
||||||
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
throw new Error("skeleton cannot be null.");
|
throw new Error("skeleton cannot be null.");
|
||||||
@ -1885,12 +1891,12 @@ var spine;
|
|||||||
if (!propertyIDs.add(id))
|
if (!propertyIDs.add(id))
|
||||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||||
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
||||||
|| timeline instanceof spine.EventTimeline || !this.hasTimeline(to, id)) {
|
|| timeline instanceof spine.EventTimeline || !to.animation.hasTimeline(id)) {
|
||||||
timelineMode[i] = AnimationState.FIRST;
|
timelineMode[i] = AnimationState.FIRST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||||
if (this.hasTimeline(next, id))
|
if (next.animation.hasTimeline(id))
|
||||||
continue;
|
continue;
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||||
@ -1916,13 +1922,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
AnimationState.prototype.hasTimeline = function (entry, id) {
|
|
||||||
var timelines = entry.animation.timelines;
|
|
||||||
for (var i = 0, n = timelines.length; i < n; i++)
|
|
||||||
if (timelines[i].getPropertyId() == id)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
AnimationState.prototype.getCurrent = function (trackIndex) {
|
AnimationState.prototype.getCurrent = function (trackIndex) {
|
||||||
if (trackIndex >= this.tracks.length)
|
if (trackIndex >= this.tracks.length)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
3
spine-ts/build/spine-core.d.ts
vendored
3
spine-ts/build/spine-core.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
|||||||
class Animation {
|
class Animation {
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline>;
|
||||||
|
timelineIds: Array<boolean>;
|
||||||
duration: number;
|
duration: number;
|
||||||
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
||||||
|
hasTimeline(id: number): boolean;
|
||||||
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||||
@ -281,7 +283,6 @@ declare module spine {
|
|||||||
_animationsChanged(): void;
|
_animationsChanged(): void;
|
||||||
computeHold(entry: TrackEntry): void;
|
computeHold(entry: TrackEntry): void;
|
||||||
computeNotLast(entry: TrackEntry): void;
|
computeNotLast(entry: TrackEntry): void;
|
||||||
hasTimeline(entry: TrackEntry, id: number): boolean;
|
|
||||||
getCurrent(trackIndex: number): TrackEntry;
|
getCurrent(trackIndex: number): TrackEntry;
|
||||||
addListener(listener: AnimationStateListener2): void;
|
addListener(listener: AnimationStateListener2): void;
|
||||||
removeListener(listener: AnimationStateListener2): void;
|
removeListener(listener: AnimationStateListener2): void;
|
||||||
|
|||||||
@ -21,8 +21,14 @@ var spine;
|
|||||||
throw new Error("timelines cannot be null.");
|
throw new Error("timelines cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timelines = timelines;
|
this.timelines = timelines;
|
||||||
|
this.timelineIds = [];
|
||||||
|
for (var i = 0; i < timelines.length; i++)
|
||||||
|
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
Animation.prototype.hasTimeline = function (id) {
|
||||||
|
return this.timelineIds[id] == true;
|
||||||
|
};
|
||||||
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
throw new Error("skeleton cannot be null.");
|
throw new Error("skeleton cannot be null.");
|
||||||
@ -1885,12 +1891,12 @@ var spine;
|
|||||||
if (!propertyIDs.add(id))
|
if (!propertyIDs.add(id))
|
||||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||||
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
||||||
|| timeline instanceof spine.EventTimeline || !this.hasTimeline(to, id)) {
|
|| timeline instanceof spine.EventTimeline || !to.animation.hasTimeline(id)) {
|
||||||
timelineMode[i] = AnimationState.FIRST;
|
timelineMode[i] = AnimationState.FIRST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||||
if (this.hasTimeline(next, id))
|
if (next.animation.hasTimeline(id))
|
||||||
continue;
|
continue;
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||||
@ -1916,13 +1922,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
AnimationState.prototype.hasTimeline = function (entry, id) {
|
|
||||||
var timelines = entry.animation.timelines;
|
|
||||||
for (var i = 0, n = timelines.length; i < n; i++)
|
|
||||||
if (timelines[i].getPropertyId() == id)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
AnimationState.prototype.getCurrent = function (trackIndex) {
|
AnimationState.prototype.getCurrent = function (trackIndex) {
|
||||||
if (trackIndex >= this.tracks.length)
|
if (trackIndex >= this.tracks.length)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
3
spine-ts/build/spine-player.d.ts
vendored
3
spine-ts/build/spine-player.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
|||||||
class Animation {
|
class Animation {
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline>;
|
||||||
|
timelineIds: Array<boolean>;
|
||||||
duration: number;
|
duration: number;
|
||||||
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
||||||
|
hasTimeline(id: number): boolean;
|
||||||
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||||
@ -281,7 +283,6 @@ declare module spine {
|
|||||||
_animationsChanged(): void;
|
_animationsChanged(): void;
|
||||||
computeHold(entry: TrackEntry): void;
|
computeHold(entry: TrackEntry): void;
|
||||||
computeNotLast(entry: TrackEntry): void;
|
computeNotLast(entry: TrackEntry): void;
|
||||||
hasTimeline(entry: TrackEntry, id: number): boolean;
|
|
||||||
getCurrent(trackIndex: number): TrackEntry;
|
getCurrent(trackIndex: number): TrackEntry;
|
||||||
addListener(listener: AnimationStateListener2): void;
|
addListener(listener: AnimationStateListener2): void;
|
||||||
removeListener(listener: AnimationStateListener2): void;
|
removeListener(listener: AnimationStateListener2): void;
|
||||||
|
|||||||
@ -21,8 +21,14 @@ var spine;
|
|||||||
throw new Error("timelines cannot be null.");
|
throw new Error("timelines cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timelines = timelines;
|
this.timelines = timelines;
|
||||||
|
this.timelineIds = [];
|
||||||
|
for (var i = 0; i < timelines.length; i++)
|
||||||
|
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
Animation.prototype.hasTimeline = function (id) {
|
||||||
|
return this.timelineIds[id] == true;
|
||||||
|
};
|
||||||
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
throw new Error("skeleton cannot be null.");
|
throw new Error("skeleton cannot be null.");
|
||||||
@ -1885,12 +1891,12 @@ var spine;
|
|||||||
if (!propertyIDs.add(id))
|
if (!propertyIDs.add(id))
|
||||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||||
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
||||||
|| timeline instanceof spine.EventTimeline || !this.hasTimeline(to, id)) {
|
|| timeline instanceof spine.EventTimeline || !to.animation.hasTimeline(id)) {
|
||||||
timelineMode[i] = AnimationState.FIRST;
|
timelineMode[i] = AnimationState.FIRST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||||
if (this.hasTimeline(next, id))
|
if (next.animation.hasTimeline(id))
|
||||||
continue;
|
continue;
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||||
@ -1916,13 +1922,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
AnimationState.prototype.hasTimeline = function (entry, id) {
|
|
||||||
var timelines = entry.animation.timelines;
|
|
||||||
for (var i = 0, n = timelines.length; i < n; i++)
|
|
||||||
if (timelines[i].getPropertyId() == id)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
AnimationState.prototype.getCurrent = function (trackIndex) {
|
AnimationState.prototype.getCurrent = function (trackIndex) {
|
||||||
if (trackIndex >= this.tracks.length)
|
if (trackIndex >= this.tracks.length)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
3
spine-ts/build/spine-threejs.d.ts
vendored
3
spine-ts/build/spine-threejs.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
|||||||
class Animation {
|
class Animation {
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline>;
|
||||||
|
timelineIds: Array<boolean>;
|
||||||
duration: number;
|
duration: number;
|
||||||
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
||||||
|
hasTimeline(id: number): boolean;
|
||||||
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||||
@ -281,7 +283,6 @@ declare module spine {
|
|||||||
_animationsChanged(): void;
|
_animationsChanged(): void;
|
||||||
computeHold(entry: TrackEntry): void;
|
computeHold(entry: TrackEntry): void;
|
||||||
computeNotLast(entry: TrackEntry): void;
|
computeNotLast(entry: TrackEntry): void;
|
||||||
hasTimeline(entry: TrackEntry, id: number): boolean;
|
|
||||||
getCurrent(trackIndex: number): TrackEntry;
|
getCurrent(trackIndex: number): TrackEntry;
|
||||||
addListener(listener: AnimationStateListener2): void;
|
addListener(listener: AnimationStateListener2): void;
|
||||||
removeListener(listener: AnimationStateListener2): void;
|
removeListener(listener: AnimationStateListener2): void;
|
||||||
|
|||||||
@ -21,8 +21,14 @@ var spine;
|
|||||||
throw new Error("timelines cannot be null.");
|
throw new Error("timelines cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timelines = timelines;
|
this.timelines = timelines;
|
||||||
|
this.timelineIds = [];
|
||||||
|
for (var i = 0; i < timelines.length; i++)
|
||||||
|
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
Animation.prototype.hasTimeline = function (id) {
|
||||||
|
return this.timelineIds[id] == true;
|
||||||
|
};
|
||||||
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
throw new Error("skeleton cannot be null.");
|
throw new Error("skeleton cannot be null.");
|
||||||
@ -1885,12 +1891,12 @@ var spine;
|
|||||||
if (!propertyIDs.add(id))
|
if (!propertyIDs.add(id))
|
||||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||||
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
||||||
|| timeline instanceof spine.EventTimeline || !this.hasTimeline(to, id)) {
|
|| timeline instanceof spine.EventTimeline || !to.animation.hasTimeline(id)) {
|
||||||
timelineMode[i] = AnimationState.FIRST;
|
timelineMode[i] = AnimationState.FIRST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||||
if (this.hasTimeline(next, id))
|
if (next.animation.hasTimeline(id))
|
||||||
continue;
|
continue;
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||||
@ -1916,13 +1922,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
AnimationState.prototype.hasTimeline = function (entry, id) {
|
|
||||||
var timelines = entry.animation.timelines;
|
|
||||||
for (var i = 0, n = timelines.length; i < n; i++)
|
|
||||||
if (timelines[i].getPropertyId() == id)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
AnimationState.prototype.getCurrent = function (trackIndex) {
|
AnimationState.prototype.getCurrent = function (trackIndex) {
|
||||||
if (trackIndex >= this.tracks.length)
|
if (trackIndex >= this.tracks.length)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
3
spine-ts/build/spine-webgl.d.ts
vendored
3
spine-ts/build/spine-webgl.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
|||||||
class Animation {
|
class Animation {
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline>;
|
||||||
|
timelineIds: Array<boolean>;
|
||||||
duration: number;
|
duration: number;
|
||||||
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
constructor(name: string, timelines: Array<Timeline>, duration: number);
|
||||||
|
hasTimeline(id: number): boolean;
|
||||||
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
apply(skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection): void;
|
||||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||||
@ -281,7 +283,6 @@ declare module spine {
|
|||||||
_animationsChanged(): void;
|
_animationsChanged(): void;
|
||||||
computeHold(entry: TrackEntry): void;
|
computeHold(entry: TrackEntry): void;
|
||||||
computeNotLast(entry: TrackEntry): void;
|
computeNotLast(entry: TrackEntry): void;
|
||||||
hasTimeline(entry: TrackEntry, id: number): boolean;
|
|
||||||
getCurrent(trackIndex: number): TrackEntry;
|
getCurrent(trackIndex: number): TrackEntry;
|
||||||
addListener(listener: AnimationStateListener2): void;
|
addListener(listener: AnimationStateListener2): void;
|
||||||
removeListener(listener: AnimationStateListener2): void;
|
removeListener(listener: AnimationStateListener2): void;
|
||||||
|
|||||||
@ -21,8 +21,14 @@ var spine;
|
|||||||
throw new Error("timelines cannot be null.");
|
throw new Error("timelines cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timelines = timelines;
|
this.timelines = timelines;
|
||||||
|
this.timelineIds = [];
|
||||||
|
for (var i = 0; i < timelines.length; i++)
|
||||||
|
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
Animation.prototype.hasTimeline = function (id) {
|
||||||
|
return this.timelineIds[id] == true;
|
||||||
|
};
|
||||||
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
Animation.prototype.apply = function (skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
throw new Error("skeleton cannot be null.");
|
throw new Error("skeleton cannot be null.");
|
||||||
@ -1885,12 +1891,12 @@ var spine;
|
|||||||
if (!propertyIDs.add(id))
|
if (!propertyIDs.add(id))
|
||||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||||
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
else if (to == null || timeline instanceof spine.AttachmentTimeline || timeline instanceof spine.DrawOrderTimeline
|
||||||
|| timeline instanceof spine.EventTimeline || !this.hasTimeline(to, id)) {
|
|| timeline instanceof spine.EventTimeline || !to.animation.hasTimeline(id)) {
|
||||||
timelineMode[i] = AnimationState.FIRST;
|
timelineMode[i] = AnimationState.FIRST;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||||
if (this.hasTimeline(next, id))
|
if (next.animation.hasTimeline(id))
|
||||||
continue;
|
continue;
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||||
@ -1916,13 +1922,6 @@ var spine;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
AnimationState.prototype.hasTimeline = function (entry, id) {
|
|
||||||
var timelines = entry.animation.timelines;
|
|
||||||
for (var i = 0, n = timelines.length; i < n; i++)
|
|
||||||
if (timelines[i].getPropertyId() == id)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
AnimationState.prototype.getCurrent = function (trackIndex) {
|
AnimationState.prototype.getCurrent = function (trackIndex) {
|
||||||
if (trackIndex >= this.tracks.length)
|
if (trackIndex >= this.tracks.length)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -31,6 +31,7 @@ module spine {
|
|||||||
export class Animation {
|
export class Animation {
|
||||||
name: string;
|
name: string;
|
||||||
timelines: Array<Timeline>;
|
timelines: Array<Timeline>;
|
||||||
|
timelineIds: Array<boolean>;
|
||||||
duration: number;
|
duration: number;
|
||||||
|
|
||||||
constructor (name: string, timelines: Array<Timeline>, duration: number) {
|
constructor (name: string, timelines: Array<Timeline>, duration: number) {
|
||||||
@ -38,9 +39,16 @@ module spine {
|
|||||||
if (timelines == null) throw new Error("timelines cannot be null.");
|
if (timelines == null) throw new Error("timelines cannot be null.");
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timelines = timelines;
|
this.timelines = timelines;
|
||||||
|
this.timelineIds = [];
|
||||||
|
for (var i = 0; i < timelines.length; i++)
|
||||||
|
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasTimeline (id: number) {
|
||||||
|
return this.timelineIds[id] == true;
|
||||||
|
}
|
||||||
|
|
||||||
apply (skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {
|
apply (skeleton: Skeleton, lastTime: number, time: number, loop: boolean, events: Array<Event>, alpha: number, blend: MixBlend, direction: MixDirection) {
|
||||||
if (skeleton == null) throw new Error("skeleton cannot be null.");
|
if (skeleton == null) throw new Error("skeleton cannot be null.");
|
||||||
|
|
||||||
|
|||||||
@ -632,11 +632,11 @@ module spine {
|
|||||||
if (!propertyIDs.add(id))
|
if (!propertyIDs.add(id))
|
||||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||||
else if (to == null || timeline instanceof AttachmentTimeline || timeline instanceof DrawOrderTimeline
|
else if (to == null || timeline instanceof AttachmentTimeline || timeline instanceof DrawOrderTimeline
|
||||||
|| timeline instanceof EventTimeline || !this.hasTimeline(to, id)) {
|
|| timeline instanceof EventTimeline || !to.animation.hasTimeline(id)) {
|
||||||
timelineMode[i] = AnimationState.FIRST;
|
timelineMode[i] = AnimationState.FIRST;
|
||||||
} else {
|
} else {
|
||||||
for (let next = to.mixingTo; next != null; next = next.mixingTo) {
|
for (let next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||||
if (this.hasTimeline(next, id)) continue;
|
if (next.animation.hasTimeline(id)) continue;
|
||||||
if (entry.mixDuration > 0) {
|
if (entry.mixDuration > 0) {
|
||||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||||
timelineDipMix[i] = next;
|
timelineDipMix[i] = next;
|
||||||
@ -663,13 +663,6 @@ module spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasTimeline (entry: TrackEntry, id: number) : boolean {
|
|
||||||
let timelines = entry.animation.timelines;
|
|
||||||
for (let i = 0, n = timelines.length; i < n; i++)
|
|
||||||
if (timelines[i].getPropertyId() == id) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
getCurrent (trackIndex: number) {
|
getCurrent (trackIndex: number) {
|
||||||
if (trackIndex >= this.tracks.length) return null;
|
if (trackIndex >= this.tracks.length) return null;
|
||||||
return this.tracks[trackIndex];
|
return this.tracks[trackIndex];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user