Only use mixAlpha for multiple mixing.

closes #871
This commit is contained in:
Nathan Sweet 2017-04-07 11:14:25 +09:00
parent 160c491d90
commit f8ea8e99ca

View File

@ -387,21 +387,21 @@ public class AnimationState {
TrackEntry mixingFrom = from.mixingFrom; TrackEntry mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
// A mix was interrupted, mix from the closest animation. if (multipleMixing) {
if (!multipleMixing && from.mixTime / from.mixDuration < 0.5f && mixingFrom.animation != emptyAnimation) { // The interrupted mix will mix out from its current percentage to zero.
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from; } else {
mixingFrom.mixTime = from.mixDuration - from.mixTime; // A mix was interrupted, mix from the closest animation.
mixingFrom.mixDuration = from.mixDuration; if (from.mixTime / from.mixDuration < 0.5f && mixingFrom.animation != emptyAnimation) {
from.mixingFrom = null; current.mixingFrom = mixingFrom;
from = mixingFrom; mixingFrom.mixingFrom = from;
} mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
// The interrupted mix will mix out from its current percentage to zero. // End the other animation after it is applied one last time.
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
// End the other animation after it is applied one last time.
if (!multipleMixing) {
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;