mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-13 02:28:44 +08:00
Merge branch '3.7' into 3.8-beta
This commit is contained in:
commit
833f8551f4
Binary file not shown.
@ -300,29 +300,36 @@ package spine.animation {
|
||||
var rotateTimeline : RotateTimeline = RotateTimeline(timeline);
|
||||
var frames : Vector.<Number> = 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) {
|
||||
|
||||
@ -538,30 +538,36 @@ void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline*
|
||||
frames = rotateTimeline->frames;
|
||||
bone = skeleton->bones[rotateTimeline->boneIndex];
|
||||
if (time < frames[0]) {
|
||||
if (blend == SP_MIX_BLEND_SETUP) {
|
||||
bone->rotation = bone->data->rotation;
|
||||
switch (blend) {
|
||||
case SP_MIX_BLEND_SETUP:
|
||||
bone->rotation = bone->data->rotation;
|
||||
default:
|
||||
return;
|
||||
case SP_MIX_BLEND_FIRST:
|
||||
r1 = bone->rotation;
|
||||
r2 = bone->data->rotation;
|
||||
}
|
||||
return; /* Time is before first frame. */
|
||||
}
|
||||
} else {
|
||||
r1 = blend == SP_MIX_BLEND_SETUP ? bone->data->rotation : bone->rotation;
|
||||
if (time >= frames[rotateTimeline->framesCount - ROTATE_ENTRIES]) /* Time is after last frame. */
|
||||
r2 = bone->data->rotation + frames[rotateTimeline->framesCount + ROTATE_PREV_ROTATION];
|
||||
else {
|
||||
/* Interpolate between the previous frame and the current frame. */
|
||||
frame = _spCurveTimeline_binarySearch(frames, rotateTimeline->framesCount, time, ROTATE_ENTRIES);
|
||||
prevRotation = frames[frame + ROTATE_PREV_ROTATION];
|
||||
frameTime = frames[frame];
|
||||
percent = spCurveTimeline_getCurvePercent(SUPER(rotateTimeline), (frame >> 1) - 1,
|
||||
1 - (time - frameTime) /
|
||||
(frames[frame + ROTATE_PREV_TIME] - frameTime));
|
||||
|
||||
if (time >= frames[rotateTimeline->framesCount - ROTATE_ENTRIES]) /* Time is after last frame. */
|
||||
r2 = bone->data->rotation + frames[rotateTimeline->framesCount + ROTATE_PREV_ROTATION];
|
||||
else {
|
||||
/* Interpolate between the previous frame and the current frame. */
|
||||
frame = _spCurveTimeline_binarySearch(frames, rotateTimeline->framesCount, time, ROTATE_ENTRIES);
|
||||
prevRotation = frames[frame + ROTATE_PREV_ROTATION];
|
||||
frameTime = frames[frame];
|
||||
percent = spCurveTimeline_getCurvePercent(SUPER(rotateTimeline), (frame >> 1) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + ROTATE_PREV_TIME] - frameTime));
|
||||
|
||||
r2 = frames[frame + ROTATE_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;
|
||||
r2 = frames[frame + ROTATE_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. */
|
||||
r1 = blend == SP_MIX_BLEND_SETUP ? bone->data->rotation : bone->rotation;
|
||||
diff = r2 - r1;
|
||||
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
@ -642,34 +642,39 @@ void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleto
|
||||
|
||||
Bone *bone = skeleton._bones[rotateTimeline->_boneIndex];
|
||||
Vector<float>& frames = rotateTimeline->_frames;
|
||||
float r1, r2;
|
||||
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;
|
||||
case MixBlend_First:
|
||||
r1 = bone->_rotation;
|
||||
r2 = bone->_data._rotation;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float r2;
|
||||
if (time >= frames[frames.size() - RotateTimeline::ENTRIES]) {
|
||||
// Time is after last frame.
|
||||
r2 = bone->_data._rotation + frames[frames.size() + RotateTimeline::PREV_ROTATION];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation::binarySearch(frames, time, RotateTimeline::ENTRIES);
|
||||
float prevRotation = frames[frame + RotateTimeline::PREV_ROTATION];
|
||||
float frameTime = frames[frame];
|
||||
float percent = rotateTimeline->getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame +
|
||||
RotateTimeline::PREV_TIME] -
|
||||
frameTime));
|
||||
r1 = blend == MixBlend_Setup ? bone->_data._rotation : bone->_rotation;
|
||||
if (time >= frames[frames.size() - RotateTimeline::ENTRIES]) {
|
||||
// Time is after last frame.
|
||||
r2 = bone->_data._rotation + frames[frames.size() + RotateTimeline::PREV_ROTATION];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation::binarySearch(frames, time, RotateTimeline::ENTRIES);
|
||||
float prevRotation = frames[frame + RotateTimeline::PREV_ROTATION];
|
||||
float frameTime = frames[frame];
|
||||
float percent = 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;
|
||||
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.
|
||||
float r1 = blend == MixBlend_Setup ? bone->_data._rotation : bone->_rotation;
|
||||
float total, diff = r2 - r1;
|
||||
diff -= (16384 - (int) (16384.499999999996 - diff / 360)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
@ -342,30 +342,38 @@ public class AnimationState {
|
||||
RotateTimeline rotateTimeline = (RotateTimeline)timeline;
|
||||
Bone bone = skeleton.bones.get(rotateTimeline.boneIndex);
|
||||
float[] frames = rotateTimeline.frames;
|
||||
float r1, r2;
|
||||
if (time < frames[0]) { // Time is before first frame.
|
||||
if (blend == MixBlend.setup) bone.rotation = bone.data.rotation;
|
||||
return;
|
||||
}
|
||||
switch (blend) {
|
||||
case setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
// Fall through.
|
||||
default:
|
||||
return;
|
||||
case first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
} else {
|
||||
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - ENTRIES]) // Time is after last frame.
|
||||
r2 = bone.data.rotation + frames[frames.length + PREV_ROTATION];
|
||||
else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.binarySearch(frames, time, ENTRIES);
|
||||
float prevRotation = frames[frame + PREV_ROTATION];
|
||||
float frameTime = frames[frame];
|
||||
float percent = rotateTimeline.getCurvePercent((frame >> 1) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
float r2;
|
||||
if (time >= frames[frames.length - ENTRIES]) // Time is after last frame.
|
||||
r2 = bone.data.rotation + frames[frames.length + PREV_ROTATION];
|
||||
else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.binarySearch(frames, time, ENTRIES);
|
||||
float prevRotation = frames[frame + PREV_ROTATION];
|
||||
float frameTime = frames[frame];
|
||||
float percent = rotateTimeline.getCurvePercent((frame >> 1) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
r2 = frames[frame + 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;
|
||||
r2 = frames[frame + 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.
|
||||
float r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
float total, diff = r2 - r1;
|
||||
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
|
||||
if (diff == 0)
|
||||
|
||||
@ -475,31 +475,42 @@ function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, bl
|
||||
local rotateTimeline = timeline
|
||||
local frames = rotateTimeline.frames
|
||||
local bone = skeleton.bones[rotateTimeline.boneIndex]
|
||||
local r1 = 0
|
||||
local r2 = 0
|
||||
if time < frames[0] then
|
||||
if blend == MixBlend.setup then bone.rotation = bone.data.rotation end
|
||||
return
|
||||
if blend == MixBlend.setup then
|
||||
bone.rotation = bone.data.rotation
|
||||
return
|
||||
elseif blend == MixBlend.first then
|
||||
r1 = bone.rotation
|
||||
r2 = bone.data.rotation
|
||||
else
|
||||
return
|
||||
end
|
||||
else
|
||||
if blend == MixBlend.setup then
|
||||
r1 = bone.data.rotation
|
||||
else
|
||||
r1 = bone.rotation
|
||||
end
|
||||
if time >= frames[zlen(frames) - Animation.RotateTimeline.ENTRIES] then -- Time is after last frame.
|
||||
r2 = bone.data.rotation + frames[zlen(frames) + Animation.RotateTimeline.PREV_ROTATION]
|
||||
else
|
||||
-- Interpolate between the previous frame and the current frame.
|
||||
local frame = Animation.binarySearch(frames, time, Animation.RotateTimeline.ENTRIES)
|
||||
local prevRotation = frames[frame + Animation.RotateTimeline.PREV_ROTATION]
|
||||
local frameTime = frames[frame]
|
||||
local percent = rotateTimeline:getCurvePercent(math_floor(frame / 2) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + Animation.RotateTimeline.PREV_TIME] - frameTime))
|
||||
|
||||
r2 = frames[frame + Animation.RotateTimeline.ROTATION] - prevRotation
|
||||
r2 = r2 - (16384 - math_floor(16384.499999999996 - r2 / 360)) * 360
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation
|
||||
r2 = r2 - (16384 - math_floor(16384.499999999996 - r2 / 360)) * 360
|
||||
end
|
||||
end
|
||||
|
||||
local r2 = 0
|
||||
if time >= frames[zlen(frames) - Animation.RotateTimeline.ENTRIES] then -- Time is after last frame.
|
||||
r2 = bone.data.rotation + frames[zlen(frames) + Animation.RotateTimeline.PREV_ROTATION]
|
||||
else
|
||||
-- Interpolate between the previous frame and the current frame.
|
||||
local frame = Animation.binarySearch(frames, time, Animation.RotateTimeline.ENTRIES)
|
||||
local prevRotation = frames[frame + Animation.RotateTimeline.PREV_ROTATION]
|
||||
local frameTime = frames[frame]
|
||||
local percent = rotateTimeline:getCurvePercent(math_floor(frame / 2) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + Animation.RotateTimeline.PREV_TIME] - frameTime))
|
||||
|
||||
r2 = frames[frame + Animation.RotateTimeline.ROTATION] - prevRotation
|
||||
r2 = r2 - (16384 - math_floor(16384.499999999996 - r2 / 360)) * 360
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation
|
||||
r2 = r2 - (16384 - math_floor(16384.499999999996 - r2 / 360)) * 360
|
||||
end
|
||||
|
||||
-- Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
||||
local r1 = bone.rotation
|
||||
if blend == MixBlend.setup then r1 = bone.data.rotation end
|
||||
local total = 0
|
||||
local diff = r2 - r1
|
||||
diff = diff - (16384 - math_floor(16384.499999999996 - diff / 360)) * 360
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1532,25 +1532,33 @@ var spine;
|
||||
var rotateTimeline = timeline;
|
||||
var frames = rotateTimeline.frames;
|
||||
var bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||
var r1 = 0, r2 = 0;
|
||||
if (time < frames[0]) {
|
||||
if (blend == spine.MixBlend.setup)
|
||||
bone.rotation = bone.data.rotation;
|
||||
return;
|
||||
switch (blend) {
|
||||
case spine.MixBlend.setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
default:
|
||||
return;
|
||||
case spine.MixBlend.first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
}
|
||||
var r2 = 0;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
}
|
||||
}
|
||||
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
var total = 0, diff = r2 - r1;
|
||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1532,25 +1532,33 @@ var spine;
|
||||
var rotateTimeline = timeline;
|
||||
var frames = rotateTimeline.frames;
|
||||
var bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||
var r1 = 0, r2 = 0;
|
||||
if (time < frames[0]) {
|
||||
if (blend == spine.MixBlend.setup)
|
||||
bone.rotation = bone.data.rotation;
|
||||
return;
|
||||
switch (blend) {
|
||||
case spine.MixBlend.setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
default:
|
||||
return;
|
||||
case spine.MixBlend.first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
}
|
||||
var r2 = 0;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
}
|
||||
}
|
||||
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
var total = 0, diff = r2 - r1;
|
||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1532,25 +1532,33 @@ var spine;
|
||||
var rotateTimeline = timeline;
|
||||
var frames = rotateTimeline.frames;
|
||||
var bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||
var r1 = 0, r2 = 0;
|
||||
if (time < frames[0]) {
|
||||
if (blend == spine.MixBlend.setup)
|
||||
bone.rotation = bone.data.rotation;
|
||||
return;
|
||||
switch (blend) {
|
||||
case spine.MixBlend.setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
default:
|
||||
return;
|
||||
case spine.MixBlend.first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
}
|
||||
var r2 = 0;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
}
|
||||
}
|
||||
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
var total = 0, diff = r2 - r1;
|
||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1532,25 +1532,33 @@ var spine;
|
||||
var rotateTimeline = timeline;
|
||||
var frames = rotateTimeline.frames;
|
||||
var bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||
var r1 = 0, r2 = 0;
|
||||
if (time < frames[0]) {
|
||||
if (blend == spine.MixBlend.setup)
|
||||
bone.rotation = bone.data.rotation;
|
||||
return;
|
||||
switch (blend) {
|
||||
case spine.MixBlend.setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
default:
|
||||
return;
|
||||
case spine.MixBlend.first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
}
|
||||
var r2 = 0;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
}
|
||||
}
|
||||
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
var total = 0, diff = r2 - r1;
|
||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1532,25 +1532,33 @@ var spine;
|
||||
var rotateTimeline = timeline;
|
||||
var frames = rotateTimeline.frames;
|
||||
var bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||
var r1 = 0, r2 = 0;
|
||||
if (time < frames[0]) {
|
||||
if (blend == spine.MixBlend.setup)
|
||||
bone.rotation = bone.data.rotation;
|
||||
return;
|
||||
switch (blend) {
|
||||
case spine.MixBlend.setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
default:
|
||||
return;
|
||||
case spine.MixBlend.first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
}
|
||||
var r2 = 0;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
}
|
||||
}
|
||||
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
var total = 0, diff = r2 - r1;
|
||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1532,25 +1532,33 @@ var spine;
|
||||
var rotateTimeline = timeline;
|
||||
var frames = rotateTimeline.frames;
|
||||
var bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||
var r1 = 0, r2 = 0;
|
||||
if (time < frames[0]) {
|
||||
if (blend == spine.MixBlend.setup)
|
||||
bone.rotation = bone.data.rotation;
|
||||
return;
|
||||
switch (blend) {
|
||||
case spine.MixBlend.setup:
|
||||
bone.rotation = bone.data.rotation;
|
||||
default:
|
||||
return;
|
||||
case spine.MixBlend.first:
|
||||
r1 = bone.rotation;
|
||||
r2 = bone.data.rotation;
|
||||
}
|
||||
}
|
||||
var r2 = 0;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
if (time >= frames[frames.length - spine.RotateTimeline.ENTRIES])
|
||||
r2 = bone.data.rotation + frames[frames.length + spine.RotateTimeline.PREV_ROTATION];
|
||||
else {
|
||||
var frame = spine.Animation.binarySearch(frames, time, spine.RotateTimeline.ENTRIES);
|
||||
var prevRotation = frames[frame + spine.RotateTimeline.PREV_ROTATION];
|
||||
var frameTime = frames[frame];
|
||||
var percent = rotateTimeline.getCurvePercent((frame >> 1) - 1, 1 - (time - frameTime) / (frames[frame + spine.RotateTimeline.PREV_TIME] - frameTime));
|
||||
r2 = frames[frame + spine.RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
}
|
||||
}
|
||||
var r1 = blend == spine.MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
var total = 0, diff = r2 - r1;
|
||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -288,30 +288,37 @@ module spine {
|
||||
let rotateTimeline = timeline as RotateTimeline;
|
||||
let frames = rotateTimeline.frames;
|
||||
let bone = skeleton.bones[rotateTimeline.boneIndex];
|
||||
let r1 = 0, r2 = 0;
|
||||
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.
|
||||
let frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES);
|
||||
let prevRotation = frames[frame + RotateTimeline.PREV_ROTATION];
|
||||
let frameTime = frames[frame];
|
||||
let percent = rotateTimeline.getCurvePercent((frame >> 1) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));
|
||||
|
||||
let r2 = 0;
|
||||
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.
|
||||
let frame = Animation.binarySearch(frames, time, RotateTimeline.ENTRIES);
|
||||
let prevRotation = frames[frame + RotateTimeline.PREV_ROTATION];
|
||||
let frameTime = frames[frame];
|
||||
let percent = rotateTimeline.getCurvePercent((frame >> 1) - 1,
|
||||
1 - (time - frameTime) / (frames[frame + RotateTimeline.PREV_TIME] - frameTime));
|
||||
|
||||
r2 = frames[frame + RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = frames[frame + RotateTimeline.ROTATION] - prevRotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation;
|
||||
r2 -= (16384 - ((16384.499999999996 - r2 / 360) | 0)) * 360;
|
||||
}
|
||||
}
|
||||
|
||||
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
||||
let r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||
let total = 0, diff = r2 - r1;
|
||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||
if (diff == 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user