mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[ts] Store timeline ids inside set in Animation for O(1) lookup. See #1462.
This commit is contained in:
parent
ecd1d67c25
commit
67650c9b79
2
spine-ts/build/spine-all.d.ts
vendored
2
spine-ts/build/spine-all.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
||||
class Animation {
|
||||
name: string;
|
||||
timelines: Array<Timeline>;
|
||||
timelineIds: Array<boolean>;
|
||||
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;
|
||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||
|
||||
@ -21,8 +21,14 @@ var spine;
|
||||
throw new Error("timelines cannot be null.");
|
||||
this.name = name;
|
||||
this.timelines = timelines;
|
||||
this.timelineIds = [];
|
||||
for (var i = 0; i < timelines.length; i++)
|
||||
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||
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) {
|
||||
if (skeleton == null)
|
||||
throw new Error("skeleton cannot be null.");
|
||||
@ -1885,12 +1891,12 @@ var spine;
|
||||
if (!propertyIDs.add(id))
|
||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||
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;
|
||||
}
|
||||
else {
|
||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||
if (this.hasTimeline(next, id))
|
||||
if (next.animation.hasTimeline(id))
|
||||
continue;
|
||||
if (entry.mixDuration > 0) {
|
||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-canvas.d.ts
vendored
2
spine-ts/build/spine-canvas.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
||||
class Animation {
|
||||
name: string;
|
||||
timelines: Array<Timeline>;
|
||||
timelineIds: Array<boolean>;
|
||||
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;
|
||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||
|
||||
@ -21,8 +21,14 @@ var spine;
|
||||
throw new Error("timelines cannot be null.");
|
||||
this.name = name;
|
||||
this.timelines = timelines;
|
||||
this.timelineIds = [];
|
||||
for (var i = 0; i < timelines.length; i++)
|
||||
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||
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) {
|
||||
if (skeleton == null)
|
||||
throw new Error("skeleton cannot be null.");
|
||||
@ -1885,12 +1891,12 @@ var spine;
|
||||
if (!propertyIDs.add(id))
|
||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||
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;
|
||||
}
|
||||
else {
|
||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||
if (this.hasTimeline(next, id))
|
||||
if (next.animation.hasTimeline(id))
|
||||
continue;
|
||||
if (entry.mixDuration > 0) {
|
||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-core.d.ts
vendored
2
spine-ts/build/spine-core.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
||||
class Animation {
|
||||
name: string;
|
||||
timelines: Array<Timeline>;
|
||||
timelineIds: Array<boolean>;
|
||||
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;
|
||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||
|
||||
@ -21,8 +21,14 @@ var spine;
|
||||
throw new Error("timelines cannot be null.");
|
||||
this.name = name;
|
||||
this.timelines = timelines;
|
||||
this.timelineIds = [];
|
||||
for (var i = 0; i < timelines.length; i++)
|
||||
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||
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) {
|
||||
if (skeleton == null)
|
||||
throw new Error("skeleton cannot be null.");
|
||||
@ -1885,12 +1891,12 @@ var spine;
|
||||
if (!propertyIDs.add(id))
|
||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||
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;
|
||||
}
|
||||
else {
|
||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||
if (this.hasTimeline(next, id))
|
||||
if (next.animation.hasTimeline(id))
|
||||
continue;
|
||||
if (entry.mixDuration > 0) {
|
||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-player.d.ts
vendored
2
spine-ts/build/spine-player.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
||||
class Animation {
|
||||
name: string;
|
||||
timelines: Array<Timeline>;
|
||||
timelineIds: Array<boolean>;
|
||||
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;
|
||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||
|
||||
@ -21,8 +21,14 @@ var spine;
|
||||
throw new Error("timelines cannot be null.");
|
||||
this.name = name;
|
||||
this.timelines = timelines;
|
||||
this.timelineIds = [];
|
||||
for (var i = 0; i < timelines.length; i++)
|
||||
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||
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) {
|
||||
if (skeleton == null)
|
||||
throw new Error("skeleton cannot be null.");
|
||||
@ -1885,12 +1891,12 @@ var spine;
|
||||
if (!propertyIDs.add(id))
|
||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||
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;
|
||||
}
|
||||
else {
|
||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||
if (this.hasTimeline(next, id))
|
||||
if (next.animation.hasTimeline(id))
|
||||
continue;
|
||||
if (entry.mixDuration > 0) {
|
||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-threejs.d.ts
vendored
2
spine-ts/build/spine-threejs.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
||||
class Animation {
|
||||
name: string;
|
||||
timelines: Array<Timeline>;
|
||||
timelineIds: Array<boolean>;
|
||||
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;
|
||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||
|
||||
@ -21,8 +21,14 @@ var spine;
|
||||
throw new Error("timelines cannot be null.");
|
||||
this.name = name;
|
||||
this.timelines = timelines;
|
||||
this.timelineIds = [];
|
||||
for (var i = 0; i < timelines.length; i++)
|
||||
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||
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) {
|
||||
if (skeleton == null)
|
||||
throw new Error("skeleton cannot be null.");
|
||||
@ -1885,12 +1891,12 @@ var spine;
|
||||
if (!propertyIDs.add(id))
|
||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||
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;
|
||||
}
|
||||
else {
|
||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||
if (this.hasTimeline(next, id))
|
||||
if (next.animation.hasTimeline(id))
|
||||
continue;
|
||||
if (entry.mixDuration > 0) {
|
||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-webgl.d.ts
vendored
2
spine-ts/build/spine-webgl.d.ts
vendored
@ -2,8 +2,10 @@ declare module spine {
|
||||
class Animation {
|
||||
name: string;
|
||||
timelines: Array<Timeline>;
|
||||
timelineIds: Array<boolean>;
|
||||
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;
|
||||
static binarySearch(values: ArrayLike<number>, target: number, step?: number): number;
|
||||
static linearSearch(values: ArrayLike<number>, target: number, step: number): number;
|
||||
|
||||
@ -21,8 +21,14 @@ var spine;
|
||||
throw new Error("timelines cannot be null.");
|
||||
this.name = name;
|
||||
this.timelines = timelines;
|
||||
this.timelineIds = [];
|
||||
for (var i = 0; i < timelines.length; i++)
|
||||
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||
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) {
|
||||
if (skeleton == null)
|
||||
throw new Error("skeleton cannot be null.");
|
||||
@ -1885,12 +1891,12 @@ var spine;
|
||||
if (!propertyIDs.add(id))
|
||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||
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;
|
||||
}
|
||||
else {
|
||||
for (var next = to.mixingTo; next != null; next = next.mixingTo) {
|
||||
if (this.hasTimeline(next, id))
|
||||
if (next.animation.hasTimeline(id))
|
||||
continue;
|
||||
if (entry.mixDuration > 0) {
|
||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -31,6 +31,7 @@ module spine {
|
||||
export class Animation {
|
||||
name: string;
|
||||
timelines: Array<Timeline>;
|
||||
timelineIds: Array<boolean>;
|
||||
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.");
|
||||
this.name = name;
|
||||
this.timelines = timelines;
|
||||
this.timelineIds = [];
|
||||
for (var i = 0; i < timelines.length; i++)
|
||||
this.timelineIds[timelines[i].getPropertyId()] = true;
|
||||
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) {
|
||||
if (skeleton == null) throw new Error("skeleton cannot be null.");
|
||||
|
||||
|
||||
@ -632,11 +632,11 @@ module spine {
|
||||
if (!propertyIDs.add(id))
|
||||
timelineMode[i] = AnimationState.SUBSEQUENT;
|
||||
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;
|
||||
} else {
|
||||
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) {
|
||||
timelineMode[i] = AnimationState.HOLD_MIX;
|
||||
timelineDipMix[i] = next;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user