mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[ts] Ported AnimationState changes
This commit is contained in:
parent
a73c5084b5
commit
a7fe570148
@ -64,8 +64,8 @@ bool SpineboyExample::init () {
|
|||||||
log("%d event: %s, %d, %f, %s", entry->trackIndex, event->data->name, event->intValue, event->floatValue, event->stringValue);
|
log("%d event: %s, %d, %f, %s", entry->trackIndex, event->data->name, event->intValue, event->floatValue, event->stringValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
skeletonNode->setMix("walk", "jump", 0.2f);
|
skeletonNode->setMix("walk", "jump", 0.4);
|
||||||
skeletonNode->setMix("jump", "run", 0.2f);
|
skeletonNode->setMix("jump", "run", 0.4);
|
||||||
skeletonNode->setAnimation(0, "walk", true);
|
skeletonNode->setAnimation(0, "walk", true);
|
||||||
spTrackEntry* jumpEntry = skeletonNode->addAnimation(0, "jump", false, 3);
|
spTrackEntry* jumpEntry = skeletonNode->addAnimation(0, "jump", false, 3);
|
||||||
skeletonNode->addAnimation(0, "run", true);
|
skeletonNode->addAnimation(0, "run", true);
|
||||||
|
|||||||
2
spine-ts/build/spine-all.d.ts
vendored
2
spine-ts/build/spine-all.d.ts
vendored
@ -302,7 +302,7 @@ declare module spine {
|
|||||||
trackEntryPool: Pool<TrackEntry>;
|
trackEntryPool: Pool<TrackEntry>;
|
||||||
constructor(data: AnimationStateData);
|
constructor(data: AnimationStateData);
|
||||||
update(delta: number): void;
|
update(delta: number): void;
|
||||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
updateMixingFrom(entry: TrackEntry, delta: number): void;
|
||||||
apply(skeleton: Skeleton): void;
|
apply(skeleton: Skeleton): void;
|
||||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||||
|
|||||||
@ -1330,10 +1330,8 @@ var spine;
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks[i] = null;
|
tracks[i] = null;
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
@ -1341,30 +1339,25 @@ var spine;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.updateMixingFrom(current, delta);
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
this.queue.drain();
|
this.queue.drain();
|
||||||
};
|
};
|
||||||
AnimationState.prototype.updateMixingFrom = function (entry, delta, canEnd) {
|
AnimationState.prototype.updateMixingFrom = function (entry, delta) {
|
||||||
var from = entry.mixingFrom;
|
var from = entry.mixingFrom;
|
||||||
if (from == null)
|
if (from == null)
|
||||||
return;
|
return;
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
this.updateMixingFrom(from, delta);
|
||||||
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
this.queue.end(from);
|
this.queue.end(from);
|
||||||
var newFrom = from.mixingFrom;
|
return;
|
||||||
entry.mixingFrom = newFrom;
|
|
||||||
if (newFrom == null)
|
|
||||||
return;
|
|
||||||
entry.mixTime = from.mixTime;
|
|
||||||
entry.mixDuration = from.mixDuration;
|
|
||||||
from = newFrom;
|
|
||||||
}
|
}
|
||||||
from.animationLast = from.nextAnimationLast;
|
from.animationLast = from.nextAnimationLast;
|
||||||
from.trackLast = from.nextTrackLast;
|
from.trackLast = from.nextTrackLast;
|
||||||
var mixingFromDelta = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * from.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
this.updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
};
|
};
|
||||||
AnimationState.prototype.apply = function (skeleton) {
|
AnimationState.prototype.apply = function (skeleton) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
@ -1380,6 +1373,8 @@ var spine;
|
|||||||
var mix = current.alpha;
|
var mix = current.alpha;
|
||||||
if (current.mixingFrom != null)
|
if (current.mixingFrom != null)
|
||||||
mix *= this.applyMixingFrom(current, skeleton);
|
mix *= this.applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
var timelineCount = current.animation.timelines.length;
|
var timelineCount = current.animation.timelines.length;
|
||||||
var timelines = current.animation.timelines;
|
var timelines = current.animation.timelines;
|
||||||
@ -1591,11 +1586,11 @@ var spine;
|
|||||||
var current = this.expandToIndex(trackIndex);
|
var current = this.expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = current.mixingFrom;
|
||||||
this.queue.interrupt(current);
|
this.queue.interrupt(current);
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
|
|||||||
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
@ -302,7 +302,7 @@ declare module spine {
|
|||||||
trackEntryPool: Pool<TrackEntry>;
|
trackEntryPool: Pool<TrackEntry>;
|
||||||
constructor(data: AnimationStateData);
|
constructor(data: AnimationStateData);
|
||||||
update(delta: number): void;
|
update(delta: number): void;
|
||||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
updateMixingFrom(entry: TrackEntry, delta: number): void;
|
||||||
apply(skeleton: Skeleton): void;
|
apply(skeleton: Skeleton): void;
|
||||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||||
|
|||||||
@ -1330,10 +1330,8 @@ var spine;
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks[i] = null;
|
tracks[i] = null;
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
@ -1341,30 +1339,25 @@ var spine;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.updateMixingFrom(current, delta);
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
this.queue.drain();
|
this.queue.drain();
|
||||||
};
|
};
|
||||||
AnimationState.prototype.updateMixingFrom = function (entry, delta, canEnd) {
|
AnimationState.prototype.updateMixingFrom = function (entry, delta) {
|
||||||
var from = entry.mixingFrom;
|
var from = entry.mixingFrom;
|
||||||
if (from == null)
|
if (from == null)
|
||||||
return;
|
return;
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
this.updateMixingFrom(from, delta);
|
||||||
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
this.queue.end(from);
|
this.queue.end(from);
|
||||||
var newFrom = from.mixingFrom;
|
return;
|
||||||
entry.mixingFrom = newFrom;
|
|
||||||
if (newFrom == null)
|
|
||||||
return;
|
|
||||||
entry.mixTime = from.mixTime;
|
|
||||||
entry.mixDuration = from.mixDuration;
|
|
||||||
from = newFrom;
|
|
||||||
}
|
}
|
||||||
from.animationLast = from.nextAnimationLast;
|
from.animationLast = from.nextAnimationLast;
|
||||||
from.trackLast = from.nextTrackLast;
|
from.trackLast = from.nextTrackLast;
|
||||||
var mixingFromDelta = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * from.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
this.updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
};
|
};
|
||||||
AnimationState.prototype.apply = function (skeleton) {
|
AnimationState.prototype.apply = function (skeleton) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
@ -1380,6 +1373,8 @@ var spine;
|
|||||||
var mix = current.alpha;
|
var mix = current.alpha;
|
||||||
if (current.mixingFrom != null)
|
if (current.mixingFrom != null)
|
||||||
mix *= this.applyMixingFrom(current, skeleton);
|
mix *= this.applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
var timelineCount = current.animation.timelines.length;
|
var timelineCount = current.animation.timelines.length;
|
||||||
var timelines = current.animation.timelines;
|
var timelines = current.animation.timelines;
|
||||||
@ -1591,11 +1586,11 @@ var spine;
|
|||||||
var current = this.expandToIndex(trackIndex);
|
var current = this.expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = current.mixingFrom;
|
||||||
this.queue.interrupt(current);
|
this.queue.interrupt(current);
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
|
|||||||
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
@ -214,7 +214,7 @@ declare module spine {
|
|||||||
trackEntryPool: Pool<TrackEntry>;
|
trackEntryPool: Pool<TrackEntry>;
|
||||||
constructor(data: AnimationStateData);
|
constructor(data: AnimationStateData);
|
||||||
update(delta: number): void;
|
update(delta: number): void;
|
||||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
updateMixingFrom(entry: TrackEntry, delta: number): void;
|
||||||
apply(skeleton: Skeleton): void;
|
apply(skeleton: Skeleton): void;
|
||||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||||
|
|||||||
@ -983,10 +983,8 @@ var spine;
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks[i] = null;
|
tracks[i] = null;
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
@ -994,30 +992,25 @@ var spine;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.updateMixingFrom(current, delta);
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
this.queue.drain();
|
this.queue.drain();
|
||||||
};
|
};
|
||||||
AnimationState.prototype.updateMixingFrom = function (entry, delta, canEnd) {
|
AnimationState.prototype.updateMixingFrom = function (entry, delta) {
|
||||||
var from = entry.mixingFrom;
|
var from = entry.mixingFrom;
|
||||||
if (from == null)
|
if (from == null)
|
||||||
return;
|
return;
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
this.updateMixingFrom(from, delta);
|
||||||
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
this.queue.end(from);
|
this.queue.end(from);
|
||||||
var newFrom = from.mixingFrom;
|
return;
|
||||||
entry.mixingFrom = newFrom;
|
|
||||||
if (newFrom == null)
|
|
||||||
return;
|
|
||||||
entry.mixTime = from.mixTime;
|
|
||||||
entry.mixDuration = from.mixDuration;
|
|
||||||
from = newFrom;
|
|
||||||
}
|
}
|
||||||
from.animationLast = from.nextAnimationLast;
|
from.animationLast = from.nextAnimationLast;
|
||||||
from.trackLast = from.nextTrackLast;
|
from.trackLast = from.nextTrackLast;
|
||||||
var mixingFromDelta = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * from.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
this.updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
};
|
};
|
||||||
AnimationState.prototype.apply = function (skeleton) {
|
AnimationState.prototype.apply = function (skeleton) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
@ -1033,6 +1026,8 @@ var spine;
|
|||||||
var mix = current.alpha;
|
var mix = current.alpha;
|
||||||
if (current.mixingFrom != null)
|
if (current.mixingFrom != null)
|
||||||
mix *= this.applyMixingFrom(current, skeleton);
|
mix *= this.applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
var timelineCount = current.animation.timelines.length;
|
var timelineCount = current.animation.timelines.length;
|
||||||
var timelines = current.animation.timelines;
|
var timelines = current.animation.timelines;
|
||||||
@ -1244,11 +1239,11 @@ var spine;
|
|||||||
var current = this.expandToIndex(trackIndex);
|
var current = this.expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = current.mixingFrom;
|
||||||
this.queue.interrupt(current);
|
this.queue.interrupt(current);
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
|
|||||||
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
@ -214,7 +214,7 @@ declare module spine {
|
|||||||
trackEntryPool: Pool<TrackEntry>;
|
trackEntryPool: Pool<TrackEntry>;
|
||||||
constructor(data: AnimationStateData);
|
constructor(data: AnimationStateData);
|
||||||
update(delta: number): void;
|
update(delta: number): void;
|
||||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
updateMixingFrom(entry: TrackEntry, delta: number): void;
|
||||||
apply(skeleton: Skeleton): void;
|
apply(skeleton: Skeleton): void;
|
||||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||||
|
|||||||
@ -983,10 +983,8 @@ var spine;
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks[i] = null;
|
tracks[i] = null;
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
@ -994,30 +992,25 @@ var spine;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.updateMixingFrom(current, delta);
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
this.queue.drain();
|
this.queue.drain();
|
||||||
};
|
};
|
||||||
AnimationState.prototype.updateMixingFrom = function (entry, delta, canEnd) {
|
AnimationState.prototype.updateMixingFrom = function (entry, delta) {
|
||||||
var from = entry.mixingFrom;
|
var from = entry.mixingFrom;
|
||||||
if (from == null)
|
if (from == null)
|
||||||
return;
|
return;
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
this.updateMixingFrom(from, delta);
|
||||||
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
this.queue.end(from);
|
this.queue.end(from);
|
||||||
var newFrom = from.mixingFrom;
|
return;
|
||||||
entry.mixingFrom = newFrom;
|
|
||||||
if (newFrom == null)
|
|
||||||
return;
|
|
||||||
entry.mixTime = from.mixTime;
|
|
||||||
entry.mixDuration = from.mixDuration;
|
|
||||||
from = newFrom;
|
|
||||||
}
|
}
|
||||||
from.animationLast = from.nextAnimationLast;
|
from.animationLast = from.nextAnimationLast;
|
||||||
from.trackLast = from.nextTrackLast;
|
from.trackLast = from.nextTrackLast;
|
||||||
var mixingFromDelta = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * from.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
this.updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
};
|
};
|
||||||
AnimationState.prototype.apply = function (skeleton) {
|
AnimationState.prototype.apply = function (skeleton) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
@ -1033,6 +1026,8 @@ var spine;
|
|||||||
var mix = current.alpha;
|
var mix = current.alpha;
|
||||||
if (current.mixingFrom != null)
|
if (current.mixingFrom != null)
|
||||||
mix *= this.applyMixingFrom(current, skeleton);
|
mix *= this.applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
var timelineCount = current.animation.timelines.length;
|
var timelineCount = current.animation.timelines.length;
|
||||||
var timelines = current.animation.timelines;
|
var timelines = current.animation.timelines;
|
||||||
@ -1244,11 +1239,11 @@ var spine;
|
|||||||
var current = this.expandToIndex(trackIndex);
|
var current = this.expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = current.mixingFrom;
|
||||||
this.queue.interrupt(current);
|
this.queue.interrupt(current);
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
|
|||||||
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
@ -214,7 +214,7 @@ declare module spine {
|
|||||||
trackEntryPool: Pool<TrackEntry>;
|
trackEntryPool: Pool<TrackEntry>;
|
||||||
constructor(data: AnimationStateData);
|
constructor(data: AnimationStateData);
|
||||||
update(delta: number): void;
|
update(delta: number): void;
|
||||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
updateMixingFrom(entry: TrackEntry, delta: number): void;
|
||||||
apply(skeleton: Skeleton): void;
|
apply(skeleton: Skeleton): void;
|
||||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||||
|
|||||||
@ -983,10 +983,8 @@ var spine;
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks[i] = null;
|
tracks[i] = null;
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
@ -994,30 +992,25 @@ var spine;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.updateMixingFrom(current, delta);
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
this.queue.drain();
|
this.queue.drain();
|
||||||
};
|
};
|
||||||
AnimationState.prototype.updateMixingFrom = function (entry, delta, canEnd) {
|
AnimationState.prototype.updateMixingFrom = function (entry, delta) {
|
||||||
var from = entry.mixingFrom;
|
var from = entry.mixingFrom;
|
||||||
if (from == null)
|
if (from == null)
|
||||||
return;
|
return;
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
this.updateMixingFrom(from, delta);
|
||||||
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
this.queue.end(from);
|
this.queue.end(from);
|
||||||
var newFrom = from.mixingFrom;
|
return;
|
||||||
entry.mixingFrom = newFrom;
|
|
||||||
if (newFrom == null)
|
|
||||||
return;
|
|
||||||
entry.mixTime = from.mixTime;
|
|
||||||
entry.mixDuration = from.mixDuration;
|
|
||||||
from = newFrom;
|
|
||||||
}
|
}
|
||||||
from.animationLast = from.nextAnimationLast;
|
from.animationLast = from.nextAnimationLast;
|
||||||
from.trackLast = from.nextTrackLast;
|
from.trackLast = from.nextTrackLast;
|
||||||
var mixingFromDelta = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * from.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
this.updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
};
|
};
|
||||||
AnimationState.prototype.apply = function (skeleton) {
|
AnimationState.prototype.apply = function (skeleton) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
@ -1033,6 +1026,8 @@ var spine;
|
|||||||
var mix = current.alpha;
|
var mix = current.alpha;
|
||||||
if (current.mixingFrom != null)
|
if (current.mixingFrom != null)
|
||||||
mix *= this.applyMixingFrom(current, skeleton);
|
mix *= this.applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
var timelineCount = current.animation.timelines.length;
|
var timelineCount = current.animation.timelines.length;
|
||||||
var timelines = current.animation.timelines;
|
var timelines = current.animation.timelines;
|
||||||
@ -1244,11 +1239,11 @@ var spine;
|
|||||||
var current = this.expandToIndex(trackIndex);
|
var current = this.expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = current.mixingFrom;
|
||||||
this.queue.interrupt(current);
|
this.queue.interrupt(current);
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
spine-ts/build/spine-widget.d.ts
vendored
2
spine-ts/build/spine-widget.d.ts
vendored
@ -214,7 +214,7 @@ declare module spine {
|
|||||||
trackEntryPool: Pool<TrackEntry>;
|
trackEntryPool: Pool<TrackEntry>;
|
||||||
constructor(data: AnimationStateData);
|
constructor(data: AnimationStateData);
|
||||||
update(delta: number): void;
|
update(delta: number): void;
|
||||||
updateMixingFrom(entry: TrackEntry, delta: number, canEnd: boolean): void;
|
updateMixingFrom(entry: TrackEntry, delta: number): void;
|
||||||
apply(skeleton: Skeleton): void;
|
apply(skeleton: Skeleton): void;
|
||||||
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
applyMixingFrom(entry: TrackEntry, skeleton: Skeleton): number;
|
||||||
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
applyRotateTimeline(timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean, timelinesRotation: Array<number>, i: number, firstFrame: boolean): void;
|
||||||
|
|||||||
@ -983,10 +983,8 @@ var spine;
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks[i] = null;
|
tracks[i] = null;
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
@ -994,30 +992,25 @@ var spine;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.updateMixingFrom(current, delta);
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
this.queue.drain();
|
this.queue.drain();
|
||||||
};
|
};
|
||||||
AnimationState.prototype.updateMixingFrom = function (entry, delta, canEnd) {
|
AnimationState.prototype.updateMixingFrom = function (entry, delta) {
|
||||||
var from = entry.mixingFrom;
|
var from = entry.mixingFrom;
|
||||||
if (from == null)
|
if (from == null)
|
||||||
return;
|
return;
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
this.updateMixingFrom(from, delta);
|
||||||
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
this.queue.end(from);
|
this.queue.end(from);
|
||||||
var newFrom = from.mixingFrom;
|
return;
|
||||||
entry.mixingFrom = newFrom;
|
|
||||||
if (newFrom == null)
|
|
||||||
return;
|
|
||||||
entry.mixTime = from.mixTime;
|
|
||||||
entry.mixDuration = from.mixDuration;
|
|
||||||
from = newFrom;
|
|
||||||
}
|
}
|
||||||
from.animationLast = from.nextAnimationLast;
|
from.animationLast = from.nextAnimationLast;
|
||||||
from.trackLast = from.nextTrackLast;
|
from.trackLast = from.nextTrackLast;
|
||||||
var mixingFromDelta = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * from.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
this.updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
};
|
};
|
||||||
AnimationState.prototype.apply = function (skeleton) {
|
AnimationState.prototype.apply = function (skeleton) {
|
||||||
if (skeleton == null)
|
if (skeleton == null)
|
||||||
@ -1033,6 +1026,8 @@ var spine;
|
|||||||
var mix = current.alpha;
|
var mix = current.alpha;
|
||||||
if (current.mixingFrom != null)
|
if (current.mixingFrom != null)
|
||||||
mix *= this.applyMixingFrom(current, skeleton);
|
mix *= this.applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
var animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
var timelineCount = current.animation.timelines.length;
|
var timelineCount = current.animation.timelines.length;
|
||||||
var timelines = current.animation.timelines;
|
var timelines = current.animation.timelines;
|
||||||
@ -1244,11 +1239,11 @@ var spine;
|
|||||||
var current = this.expandToIndex(trackIndex);
|
var current = this.expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = current.mixingFrom;
|
||||||
this.queue.interrupt(current);
|
this.queue.interrupt(current);
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -81,9 +81,7 @@ module spine {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
} else {
|
} else {
|
||||||
this.updateMixingFrom(current, delta, true);
|
|
||||||
// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
|
// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks[i] = null;
|
tracks[i] = null;
|
||||||
@ -92,6 +90,7 @@ module spine {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.updateMixingFrom(current, delta);
|
||||||
|
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
@ -99,27 +98,22 @@ module spine {
|
|||||||
this.queue.drain();
|
this.queue.drain();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMixingFrom (entry: TrackEntry, delta: number, canEnd: boolean) {
|
updateMixingFrom (entry: TrackEntry, delta: number) {
|
||||||
let from = entry.mixingFrom;
|
let from = entry.mixingFrom;
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
this.updateMixingFrom(from, delta);
|
||||||
|
|
||||||
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
this.queue.end(from);
|
this.queue.end(from);
|
||||||
let newFrom = from.mixingFrom;
|
return;
|
||||||
entry.mixingFrom = newFrom;
|
|
||||||
if (newFrom == null) return;
|
|
||||||
entry.mixTime = from.mixTime;
|
|
||||||
entry.mixDuration = from.mixDuration;
|
|
||||||
from = newFrom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
from.animationLast = from.nextAnimationLast;
|
from.animationLast = from.nextAnimationLast;
|
||||||
from.trackLast = from.nextTrackLast;
|
from.trackLast = from.nextTrackLast;
|
||||||
let mixingFromDelta = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * from.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
|
|
||||||
this.updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply (skeleton: Skeleton) {
|
apply (skeleton: Skeleton) {
|
||||||
@ -135,7 +129,10 @@ module spine {
|
|||||||
|
|
||||||
// Apply mixing from entries first.
|
// Apply mixing from entries first.
|
||||||
let mix = current.alpha;
|
let mix = current.alpha;
|
||||||
if (current.mixingFrom != null) mix *= this.applyMixingFrom(current, skeleton);
|
if (current.mixingFrom != null)
|
||||||
|
mix *= this.applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
|
|
||||||
// Apply current entry.
|
// Apply current entry.
|
||||||
let animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
let animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
@ -369,11 +366,11 @@ module spine {
|
|||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
// Don't mix from an entry that was never applied.
|
// Don't mix from an entry that was never applied.
|
||||||
this.tracks[trackIndex] = null;
|
this.tracks[trackIndex] = current.mixingFrom;
|
||||||
this.queue.interrupt(current);
|
this.queue.interrupt(current);
|
||||||
this.queue.end(current);
|
this.queue.end(current);
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
} else
|
} else
|
||||||
this.disposeNext(current);
|
this.disposeNext(current);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,8 +116,17 @@ function loadSkeleton (name, initialAnimation, premultipliedAlpha, skin) {
|
|||||||
var bounds = calculateBounds(skeleton);
|
var bounds = calculateBounds(skeleton);
|
||||||
|
|
||||||
// Create an AnimationState, and set the initial animation in looping mode.
|
// Create an AnimationState, and set the initial animation in looping mode.
|
||||||
var animationState = new spine.AnimationState(new spine.AnimationStateData(skeleton.data));
|
animationStateData = new spine.AnimationStateData(skeleton.data);
|
||||||
animationState.setAnimation(0, initialAnimation, true);
|
var animationState = new spine.AnimationState(animationStateData);
|
||||||
|
if (name == "spineboy") {
|
||||||
|
animationStateData.setMix("walk", "jump", 0.4)
|
||||||
|
animationStateData.setMix("jump", "run", 0.4);
|
||||||
|
animationState.setAnimation(0, "walk", true);
|
||||||
|
var jumpEntry = animationState.addAnimation(0, "jump", false, 3);
|
||||||
|
animationState.addAnimation(0, "run", true);
|
||||||
|
} else {
|
||||||
|
animationState.setAnimation(0, initialAnimation, true);
|
||||||
|
}
|
||||||
animationState.addListener({
|
animationState.addListener({
|
||||||
start: function(track) {
|
start: function(track) {
|
||||||
console.log("Animation on track " + track.trackIndex + " started");
|
console.log("Animation on track " + track.trackIndex + " started");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user