[as3] Ported 0 timeScale fix, see #1194.

This commit is contained in:
badlogic 2018-10-15 16:51:15 +02:00
parent 03e578642c
commit ed7b4eaaea
4 changed files with 8 additions and 1 deletions

View File

@ -135,7 +135,7 @@ package spine.animation {
from.trackLast = from.nextTrackLast; from.trackLast = from.nextTrackLast;
// Require mixTime > 0 to ensure the mixing from entry was applied at least once. // Require mixTime > 0 to ensure the mixing from entry was applied at least once.
if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) { if (to.mixTime > 0 && to.mixTime >= to.mixDuration) {
// Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame). // Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame).
if (from.totalAlpha == 0 || to.mixDuration == 0) { if (from.totalAlpha == 0 || to.mixDuration == 0) {
to.mixingFrom = from.mixingFrom; to.mixingFrom = from.mixingFrom;
@ -146,6 +146,13 @@ package spine.animation {
return finished; return finished;
} }
// If to has 0 timeScale and is not the first entry, remove the mix and apply it one more time to return to the setup pose.
if (to.timeScale == 0 && to.mixingTo != null) {
to.timeScale = 1;
to.mixTime = 0;
to.mixDuration = 0;
}
from.trackTime += delta * from.timeScale; from.trackTime += delta * from.timeScale;
to.mixTime += delta * to.timeScale; to.mixTime += delta * to.timeScale;
return false; return false;