aseprite/scripts/frames.lua
2018-09-12 18:45:23 -03:00

33 lines
755 B
Lua

-- 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)
local i = 1
for k,v in ipairs(a.frames) do
assert(i == k)
assert(v == a.frames[k])
i = i+1
end
a:deleteFrame(1)
assert(a.frames[1].duration == 0.2)
end