Skip to content

Commit

Permalink
Only use mixAlpha for multiple mixing.
Browse files Browse the repository at this point in the history
closes #871
  • Loading branch information
NathanSweet committed Apr 7, 2017
1 parent 160c491 commit f8ea8e9
Showing 1 changed file with 14 additions and 14 deletions.
Expand Up @@ -387,21 +387,21 @@ private void setCurrent (int index, TrackEntry current, boolean interrupt) {

TrackEntry mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
// A mix was interrupted, mix from the closest animation.
if (!multipleMixing && from.mixTime / from.mixDuration < 0.5f && mixingFrom.animation != emptyAnimation) {
current.mixingFrom = 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.
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
if (multipleMixing) {
// The interrupted mix will mix out from its current percentage to zero.
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
} else {
// A mix was interrupted, mix from the closest animation.
if (from.mixTime / from.mixDuration < 0.5f && mixingFrom.animation != emptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}

// End the other animation after it is applied one last time.
if (!multipleMixing) {
// End the other animation after it is applied one last time.
from.mixAlpha = 0;
from.mixTime = 0;
from.mixDuration = 0;
Expand Down

0 comments on commit f8ea8e9

Please sign in to comment.