local x = 20
local y = display.height/2
for i = 1,16 do--创建16张
local cardFg = display.newSprite("cardFg.png",x+(i*70),y)--背景牌
self:addChild(cardFg,0)
cardFg:setVisible(false)
local cardBg = display.newSprite("cardBg.png",x+(i*70),y)--前景牌
self:addChild(cardBg,1)
self:runAction(cc.Sequence:create(cc.DelayTime:create(1 + i * 0.5),cc.CallFunc:create(function()
openCard(cardBg,cardFg)
end)))
end
end
function openCard(cardBg,cardFg)
local time = 1
cc.Director:getInstance():setProjection(cc.DIRECTOR_PROJECTION2_D)--cocos2d::DisplayLinkDirector::Projection::_2D
cardBg:runAction(cc.Sequence:create(cc.OrbitCamera:create(time,1,0,0,90,0,0),cc.Hide:create(),cc.CallFunc:create(--开始角度设置为0,旋转90度
function()
cardFg:runAction(cc.Sequence:create(cc.Show:create(),cc.OrbitCamera:create(1,1,0,270,90,0,0)))--开始角度是270,旋转90度
end
)))
end