Skip to content

Commit

Permalink
Merge pull request #28 from eevee/patch-1
Browse files Browse the repository at this point in the history
Fix seekFrameIndex
  • Loading branch information
kikito committed Sep 15, 2017
2 parents cae46ae + 535c397 commit d4d8926
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions anim8.lua
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ local function seekFrameIndex(intervals, timer)

while(low <= high) do
i = math.floor((low + high) / 2)
if timer > intervals[i+1] then low = i + 1
elseif timer <= intervals[i] then high = i - 1
if timer >= intervals[i+1] then low = i + 1
elseif timer < intervals[i] then high = i - 1
else
return i
end
Expand Down
4 changes: 2 additions & 2 deletions spec/anim8/animation_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ describe("anim8", function()
describe(":update", function()
it("moves to the next frame #focus", function()
local a = newAnimation({1,2,3,4}, 1)
a:update(1)
a:update(0.5)
assert.equal(1, a.position)
a:update(0.1)
a:update(0.5)
assert.equal(2, a.position)
end)
it("moves several frames if needed", function()
Expand Down

0 comments on commit d4d8926

Please sign in to comment.