mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[as3] Ported AnimationState changes
This commit is contained in:
parent
7637fdbefd
commit
721cbf0260
Binary file not shown.
@ -95,10 +95,8 @@ public class AnimationState {
|
|||||||
next = next.mixingFrom;
|
next = next.mixingFrom;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
updateMixingFrom(current, delta, true);
|
|
||||||
} else {
|
} else {
|
||||||
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;
|
||||||
@ -107,6 +105,7 @@ public class AnimationState {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateMixingFrom(current, delta);
|
||||||
|
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
@ -114,27 +113,22 @@ public class AnimationState {
|
|||||||
queue.drain();
|
queue.drain();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateMixingFrom (entry:TrackEntry, delta:Number, canEnd:Boolean):void {
|
private function updateMixingFrom (entry:TrackEntry, delta:Number):void {
|
||||||
var from:TrackEntry = entry.mixingFrom;
|
var from:TrackEntry = entry.mixingFrom;
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
|
updateMixingFrom(from, delta);
|
||||||
|
|
||||||
if (canEnd && entry.mixTime >= entry.mixDuration && entry.mixTime > 0) {
|
if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
|
||||||
|
entry.mixingFrom = null;
|
||||||
queue.end(from);
|
queue.end(from);
|
||||||
var newFrom:TrackEntry = 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:Number = delta * from.timeScale;
|
from.trackTime += delta * from.timeScale;
|
||||||
from.trackTime += mixingFromDelta;
|
entry.mixTime += delta * entry.timeScale;
|
||||||
entry.mixTime += mixingFromDelta;
|
|
||||||
|
|
||||||
updateMixingFrom(from, delta, canEnd && from.alpha == 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function apply (skeleton:Skeleton):void {
|
public function apply (skeleton:Skeleton):void {
|
||||||
@ -149,7 +143,10 @@ public class AnimationState {
|
|||||||
|
|
||||||
// Apply mixing from entries first.
|
// Apply mixing from entries first.
|
||||||
var mix:Number = current.alpha;
|
var mix:Number = current.alpha;
|
||||||
if (current.mixingFrom != null) mix *= applyMixingFrom(current, skeleton);
|
if (current.mixingFrom != null)
|
||||||
|
mix *= applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd)
|
||||||
|
mix = 0;
|
||||||
|
|
||||||
// Apply current entry.
|
// Apply current entry.
|
||||||
var animationLast:Number = current.animationLast, animationTime:Number = current.getAnimationTime();
|
var animationLast:Number = current.animationLast, animationTime:Number = current.getAnimationTime();
|
||||||
@ -388,11 +385,11 @@ public class AnimationState {
|
|||||||
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.
|
||||||
tracks[trackIndex] = null;
|
tracks[trackIndex] = current.mixingFrom;
|
||||||
queue.interrupt(current);
|
queue.interrupt(current);
|
||||||
queue.end(current);
|
queue.end(current);
|
||||||
disposeNext(current);
|
disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
} else
|
} else
|
||||||
disposeNext(current);
|
disposeNext(current);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user