mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 10:16:01 +08:00
[lua] Fix for rotation timelines in AnimationState
This commit is contained in:
parent
6377618e3f
commit
7c59ef2f09
@ -382,6 +382,8 @@ function AnimationState:applyMixingFrom (entry, skeleton)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame)
|
function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame)
|
||||||
|
if firstFrame then timelinesRotation[i] = 0 end
|
||||||
|
|
||||||
if alpha == 1 then
|
if alpha == 1 then
|
||||||
timeline:apply(skeleton, 0, time, nil, 1, setupPose, false)
|
timeline:apply(skeleton, 0, time, nil, 1, setupPose, false)
|
||||||
return
|
return
|
||||||
@ -418,12 +420,7 @@ function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, se
|
|||||||
local total = 0
|
local total = 0
|
||||||
local diff = r2 - r1
|
local diff = r2 - r1
|
||||||
if diff == 0 then
|
if diff == 0 then
|
||||||
if firstFrame then
|
|
||||||
timelinesRotation[i] = 0
|
|
||||||
total = 0
|
|
||||||
else
|
|
||||||
total = timelinesRotation[i]
|
total = timelinesRotation[i]
|
||||||
end
|
|
||||||
else
|
else
|
||||||
diff = diff - (16384 - math_floor(16384.499999999996 - diff / 360)) * 360
|
diff = diff - (16384 - math_floor(16384.499999999996 - diff / 360)) * 360
|
||||||
local lastTotal = 0
|
local lastTotal = 0
|
||||||
@ -541,6 +538,8 @@ function AnimationState:setCurrent (index, current, interrupt)
|
|||||||
current.mixingFrom = from
|
current.mixingFrom = from
|
||||||
current.mixTime = 0
|
current.mixTime = 0
|
||||||
|
|
||||||
|
from.timelinesRotation = {};
|
||||||
|
|
||||||
-- If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
|
-- If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
|
||||||
if from.mixingFrom then current.mixAlpha = current.mixAlpha * math_min(from.mixTime / from.mixDuration, 1) end
|
if from.mixingFrom then current.mixAlpha = current.mixAlpha * math_min(from.mixTime / from.mixDuration, 1) end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user