如何实现一个panel从顶部到底部逐渐的显示动画?
cc 3.1.1有个例子,但是移植进来不好用,提示少cc.PROGRESS_TIMER_TYPE_BAR的定义
– SpriteProgressToVertical
local function SpriteProgressToVertical()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
local to1 = cc.ProgressTo:create(2, 100)
local to2 = cc.ProgressTo:create(2, 100)
local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
left:setMidpoint(cc.p(0,0))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
left:setBarChangeRate(cc.p(0, 1))
left:setPosition(cc.p(100, s.height / 2))
left:runAction(cc.RepeatForever:create(to1))
layer:addChild(left)
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
right:setMidpoint(cc.p(0, 1))
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
right:setBarChangeRate(cc.p(0, 1))
right:setPosition(cc.p(s.width - 100, s.height / 2))
right:runAction(cc.RepeatForever:create(to2))
layer:addChild(right)
Helper.subtitleLabel:setString(“ProgressTo Vertical”)
return layer
end