2018-09-11 18:46:35 -03:00
|
|
|
-- Copyright (C) 2018 David Capello
|
|
|
|
--
|
|
|
|
-- This file is released under the terms of the MIT license.
|
|
|
|
-- Read LICENSE.txt for more information.
|
|
|
|
|
|
|
|
do
|
|
|
|
local a = Sprite(32, 32)
|
|
|
|
assert(#a.frames == 1)
|
|
|
|
assert(a.frames[1].frameNumber == 1)
|
|
|
|
assert(a.frames[1].duration == 0.1)
|
|
|
|
|
|
|
|
local fr = a:newFrame()
|
|
|
|
assert(#a.frames == 2)
|
|
|
|
assert(a.frames[1].frameNumber == 1)
|
|
|
|
assert(a.frames[2].frameNumber == 2)
|
|
|
|
assert(a.frames[1].duration == 0.1)
|
|
|
|
assert(a.frames[2].duration == 0.1)
|
|
|
|
|
|
|
|
fr.duration = 0.2
|
|
|
|
assert(a.frames[1].duration == 0.1)
|
|
|
|
assert(a.frames[2].duration == 0.2)
|
|
|
|
|
2018-09-12 18:45:23 -03:00
|
|
|
local i = 1
|
|
|
|
for k,v in ipairs(a.frames) do
|
|
|
|
assert(i == k)
|
|
|
|
assert(v == a.frames[k])
|
|
|
|
i = i+1
|
|
|
|
end
|
|
|
|
|
2018-09-11 18:46:35 -03:00
|
|
|
a:deleteFrame(1)
|
|
|
|
assert(a.frames[1].duration == 0.2)
|
|
|
|
end
|