--内存占用也不大,莫名就闪退也是醉
Video = class()
function Video:init(name,numStart,numEnd,len,fps)
-- you can accept and set parameters here
self.name = name --前缀名
self.numStart = numStart --开始的数字
self.numEnd = numEnd --结束的数字
self.len = len --数字的长度(比如说001就是3位)
self.timeStart = 0
self.ended = false --判断是否结束
self.isPlaying = false
self.fps = fps --不解释
end
function Video:setup()
self.timeStart=math.floor(ElapsedTime*self.fps)
self.isPlaying=true
end
function Video:draw()
-- Codea does not automatically call this method
local num = math.floor(ElapsedTime*self.fps)+self.numStart-self.timeStart
while #tostring(num)<self.len do
num="0"..tostring(num)
end
if tonumber(num)<=self.numEnd then
sprite("Project:"..self.name..num,WIDTH/2,HEIGHT/2,WIDTH)
else
self.endedm= true
end
fill(150, 52, 255, 255)
text("内存占用:"..math.floor(collectgarbage("count")).." KB",650,740)
collectgarbage()
end
function Video:touched(touch)
-- Codea does not automatically call this method
end
Video = class()
function Video:init(name,numStart,numEnd,len,fps)
-- you can accept and set parameters here
self.name = name --前缀名
self.numStart = numStart --开始的数字
self.numEnd = numEnd --结束的数字
self.len = len --数字的长度(比如说001就是3位)
self.timeStart = 0
self.ended = false --判断是否结束
self.isPlaying = false
self.fps = fps --不解释
end
function Video:setup()
self.timeStart=math.floor(ElapsedTime*self.fps)
self.isPlaying=true
end
function Video:draw()
-- Codea does not automatically call this method
local num = math.floor(ElapsedTime*self.fps)+self.numStart-self.timeStart
while #tostring(num)<self.len do
num="0"..tostring(num)
end
if tonumber(num)<=self.numEnd then
sprite("Project:"..self.name..num,WIDTH/2,HEIGHT/2,WIDTH)
else
self.endedm= true
end
fill(150, 52, 255, 255)
text("内存占用:"..math.floor(collectgarbage("count")).." KB",650,740)
collectgarbage()
end
function Video:touched(touch)
-- Codea does not automatically call this method
end