diff --git a/spine-as3/spine-as3-example/lib/spine-as3.swc b/spine-as3/spine-as3-example/lib/spine-as3.swc index 833fe9a59..98d9d5883 100644 Binary files a/spine-as3/spine-as3-example/lib/spine-as3.swc and b/spine-as3/spine-as3-example/lib/spine-as3.swc differ diff --git a/spine-as3/spine-as3/src/spine/animation/AnimationState.as b/spine-as3/spine-as3/src/spine/animation/AnimationState.as index 2c1cc65f9..b75f935af 100644 --- a/spine-as3/spine-as3/src/spine/animation/AnimationState.as +++ b/spine-as3/spine-as3/src/spine/animation/AnimationState.as @@ -300,29 +300,36 @@ package spine.animation { var rotateTimeline : RotateTimeline = RotateTimeline(timeline); var frames : Vector. = rotateTimeline.frames; var bone : Bone = skeleton.bones[rotateTimeline.boneIndex]; + var r1 : Number, r2 : Number; if (time < frames[0]) { - if (blend == MixBlend.setup) bone.rotation = bone.data.rotation; - return; + switch (blend) { + case MixBlend.setup: + bone.rotation = bone.data.rotation; + default: + return; + case MixBlend.first: + r1 = bone.rotation; + r2 = bone.data.rotation; + } + } else { + r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation; + if (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame. + r2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION]; + else { + // Interpolate between the previous frame and the current frame. + var frame : int = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES); + var prevRotation : Number = frames[frame + RotateTimeline.PREV_ROTATION]; + var frameTime : Number = frames[frame]; + var percent : Number = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime)); + + r2 = frames[frame + RotateTimeline.ROTATION] - prevRotation; + r2 -= (16384 - int((16384.499999999996 - r2 / 360))) * 360; + r2 = prevRotation + r2 * percent + bone.data.rotation; + r2 -= (16384 - int((16384.499999999996 - r2 / 360))) * 360; + } } - var r2 : Number; - if (time >= frames[frames.length - RotateTimeline.ENTRIES]) // Time is after last frame. - r2 = bone.data.rotation + frames[frames.length + RotateTimeline.PREV_ROTATION]; - else { - // Interpolate between the previous frame and the current frame. - var frame : int = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES); - var prevRotation : Number = frames[frame + RotateTimeline.PREV_ROTATION]; - var frameTime : Number = frames[frame]; - var percent : Number = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime)); - - r2 = frames[frame + RotateTimeline.ROTATION] - prevRotation; - r2 -= (16384 - int((16384.499999999996 - r2 / 360))) * 360; - r2 = prevRotation + r2 * percent + bone.data.rotation; - 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. - var r1 : Number = blend == MixBlend.setup ? bone.data.rotation : bone.rotation; + // Mix between rotations using the direction of the shortest route on the first frame while detecting crosses. var total : Number, diff : Number = r2 - r1; diff -= (16384 - int((16384.499999999996 - diff / 360))) * 360; if (diff == 0) { diff --git a/spine-starling/spine-starling-example/lib/spine-as3.swc b/spine-starling/spine-starling-example/lib/spine-as3.swc index 833fe9a59..98d9d5883 100644 Binary files a/spine-starling/spine-starling-example/lib/spine-as3.swc and b/spine-starling/spine-starling-example/lib/spine-as3.swc differ diff --git a/spine-starling/spine-starling/lib/spine-as3.swc b/spine-starling/spine-starling/lib/spine-as3.swc index 833fe9a59..98d9d5883 100644 Binary files a/spine-starling/spine-starling/lib/spine-as3.swc and b/spine-starling/spine-starling/lib/spine-as3.swc differ