From 9963293c886983873d8fb7e16808fc787988f0e1 Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 3 Jun 2013 10:48:44 +0300 Subject: [PATCH 1/2] make sure animation duration is not 0 when figuring out the time --- spine-lua/Animation.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-lua/Animation.lua b/spine-lua/Animation.lua index 315ac84eb..67669363e 100644 --- a/spine-lua/Animation.lua +++ b/spine-lua/Animation.lua @@ -36,7 +36,7 @@ function Animation.new (name, timelines, duration) function self:apply (skeleton, time, loop) 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 timeline:apply(skeleton, time, 1) @@ -46,7 +46,7 @@ function Animation.new (name, timelines, duration) function self:mix (skeleton, time, loop, alpha) 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 timeline:apply(skeleton, time, alpha) From a92419193fe14ffb73b63cb620d3fd6a2657d550 Mon Sep 17 00:00:00 2001 From: Matias Date: Mon, 3 Jun 2013 10:49:29 +0300 Subject: [PATCH 2/2] fix typo(?) in colortimelines using color.r instead of slot.r when using alpha --- spine-lua/Animation.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spine-lua/Animation.lua b/spine-lua/Animation.lua index 67669363e..9f33f3144 100644 --- a/spine-lua/Animation.lua +++ b/spine-lua/Animation.lua @@ -372,7 +372,7 @@ function Animation.ColorTimeline.new () local b = lastFrameB + (frames[frameIndex + FRAME_B] - lastFrameB) * percent local a = lastFrameA + (frames[frameIndex + FRAME_A] - lastFrameA) * percent if alpha < 1 then - slot:setColor(slot.r + (r - color.r) * alpha, slot.g + (g - color.g) * alpha, slot.b + (b - color.b) * alpha, slot.a + (a - color.a) * alpha) + slot:setColor(slot.r + (r - slot.r) * alpha, slot.g + (g - slot.g) * alpha, slot.b + (b - slot.b) * alpha, slot.a + (a - slot.a) * alpha) else slot:setColor(r, g, b, a) end