mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
make sure animation duration is not 0 when figuring out the time
This commit is contained in:
parent
4ea202a1e6
commit
9963293c88
@ -36,7 +36,7 @@ function Animation.new (name, timelines, duration)
|
|||||||
function self:apply (skeleton, time, loop)
|
function self:apply (skeleton, time, loop)
|
||||||
if not skeleton then error("skeleton cannot be nil.", 2) end
|
if not skeleton then error("skeleton cannot be nil.", 2) end
|
||||||
|
|
||||||
if loop and duration then time = time % duration end
|
if loop and duration > 0 then time = time % duration end
|
||||||
|
|
||||||
for i,timeline in ipairs(self.timelines) do
|
for i,timeline in ipairs(self.timelines) do
|
||||||
timeline:apply(skeleton, time, 1)
|
timeline:apply(skeleton, time, 1)
|
||||||
@ -46,7 +46,7 @@ function Animation.new (name, timelines, duration)
|
|||||||
function self:mix (skeleton, time, loop, alpha)
|
function self:mix (skeleton, time, loop, alpha)
|
||||||
if not skeleton then error("skeleton cannot be nil.", 2) end
|
if not skeleton then error("skeleton cannot be nil.", 2) end
|
||||||
|
|
||||||
if loop and duration then time = time % duration end
|
if loop and duration > 0 then time = time % duration end
|
||||||
|
|
||||||
for i,timeline in ipairs(self.timelines) do
|
for i,timeline in ipairs(self.timelines) do
|
||||||
timeline:apply(skeleton, time, alpha)
|
timeline:apply(skeleton, time, alpha)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user