[as3] Port of commit 8290353. Fix for hold previous on 3+ animations causing dipping. See #1738.

This commit is contained in:
badlogic 2020-08-13 14:47:43 +02:00
parent 0f8ffd6ba6
commit bde827e66a
3 changed files with 15 additions and 5 deletions

View File

@ -39,8 +39,9 @@ package spine.animation {
public class AnimationState { public class AnimationState {
public static var SUBSEQUENT : int = 0; public static var SUBSEQUENT : int = 0;
public static var FIRST : int = 1; public static var FIRST : int = 1;
public static var HOLD : int = 2; public static var HOLD_SUBSEQUENT : int = 2;
public static var HOLD_MIX : int = 3; public static var HOLD_FIRST : int = 3;
public static var HOLD_MIX : int = 4;
public static var SETUP : int = 1; public static var SETUP : int = 1;
public static var CURRENT : int = 2; public static var CURRENT : int = 2;
@ -281,7 +282,11 @@ package spine.animation {
timelineBlend = MixBlend.setup; timelineBlend = MixBlend.setup;
alpha = alphaMix; alpha = alphaMix;
break; break;
case HOLD: case HOLD_SUBSEQUENT:
timelineBlend = blend;
alpha = alphaHold;
break;
case HOLD_FIRST:
timelineBlend = MixBlend.setup; timelineBlend = MixBlend.setup;
alpha = alphaHold; alpha = alphaHold;
break; break;
@ -664,8 +669,13 @@ package spine.animation {
var i : int = 0; var i : int = 0;
if (to != null && to.holdPrevious) { if (to != null && to.holdPrevious) {
for (i = 0; i < timelinesCount; i++) { for (i = 0; i < timelinesCount; i++) {
if (!propertyIDs[timelines[i].getPropertyId().toString()]) {
timelineMode[i] = HOLD_FIRST;
} else {
timelineMode[i] = HOLD_SUBSEQUENT;
}
propertyIDs[timelines[i].getPropertyId().toString()] = true; propertyIDs[timelines[i].getPropertyId().toString()] = true;
timelineMode[i] = HOLD;
} }
return; return;
} }
@ -692,7 +702,7 @@ package spine.animation {
} }
break; break;
} }
timelineMode[i] = AnimationState.HOLD; timelineMode[i] = AnimationState.HOLD_FIRST;
} }
} }
} }