mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
[as3] Fixed AnimationState not respecting MixBlend.first for rotate timelines. See #1274.
This commit is contained in:
parent
19e5edc94b
commit
fd51eee47f
Binary file not shown.
@ -300,12 +300,19 @@ package spine.animation {
|
|||||||
var rotateTimeline : RotateTimeline = RotateTimeline(timeline);
|
var rotateTimeline : RotateTimeline = RotateTimeline(timeline);
|
||||||
var frames : Vector.<Number> = rotateTimeline.frames;
|
var frames : Vector.<Number> = rotateTimeline.frames;
|
||||||
var bone : Bone = skeleton.bones[rotateTimeline.boneIndex];
|
var bone : Bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||||
|
var r1 : Number, r2 : Number;
|
||||||
if (time < frames[0]) {
|
if (time < frames[0]) {
|
||||||
if (blend == MixBlend.setup) bone.rotation = bone.data.rotation;
|
switch (blend) {
|
||||||
|
case MixBlend.setup:
|
||||||
|
bone.rotation = bone.data.rotation;
|
||||||
|
default:
|
||||||
return;
|
return;
|
||||||
|
case MixBlend.first:
|
||||||
|
r1 = bone.rotation;
|
||||||
|
r2 = bone.data.rotation;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
var r2 : Number;
|
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||||
if (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame.
|
if (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame.
|
||||||
r2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION];
|
r2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION];
|
||||||
else {
|
else {
|
||||||
@ -320,9 +327,9 @@ package spine.animation {
|
|||||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||||
r2 -= (16384 - int((16384.499999999996 - r2 / 360))) * 360;
|
r2 -= (16384 - int((16384.499999999996 - r2 / 360))) * 360;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
||||||
var r1 : Number = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
|
||||||
var total : Number, diff : Number = r2 - r1;
|
var total : Number, diff : Number = r2 - r1;
|
||||||
diff -= (16384 - int((16384.499999999996 - diff / 360))) * 360;
|
diff -= (16384 - int((16384.499999999996 - diff / 360))) * 360;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user