-- 翻牌动画
-- during:翻牌时间,isShow:是否显示牌的正面,
-- preDuring:前置时间,callback:回调方法,delayTime:延迟时间
function ActValueOfWelfareController:flopCard(during,isShow,preDuring,callback,delayTime)
during = during or 0.3
local callFunc = callback or function() end
preDuring = preDuring or 0
local delayTime = delayTime or 1.5
local rotateOut = cc.OrbitCamera:create(during / 2, 1, 0, 0, 90, 0, 0)
local rotateIn = cc.EaseCubicActionOut:create(cc.OrbitCamera:create(during / 2, 1, 0, -90, 90, 0, 0))
local delay = cc.DelayTime:create(delayTime)
return cc.Sequence:create(
cc.DelayTime:create(preDuring),
rotateOut,
-- cardBack:为牌的背面,s:为执行这个动作的节点
cc.CallFunc:create(function(s) if s.cardBack then s.cardBack:setVisible(not isShow) end end),
rotateIn,
delay,
cc.CallFunc:create(callFunc)
)
end
例如:
currentCard:runAction(self:flopCard(0.2,true,0.2,function(...)
-- TODO
end))
好了,简单的翻牌效果就这样实现了
|