cocos2dx 扑克牌翻转动画

local pCardBack = cc.CSLoader:createNode("deskScene/cardItem.csb")

    local spCard = pCardBack:getChildByName("Sprite_card")

    spCard:setTexture(Resources.getCardSprite(-2):getTexture())

    pCardBack:setName("gongCardbg")

    pCardBack:setPosition(cc.p(336.88, -214.49))

    self.m_plGongPai:addChild(pCardBack)

    pCardBack:setVisible(false)

 

    local pCardFront = cc.CSLoader:createNode("deskScene/cardItem.csb")

    local spCard = pCardFront:getChildByName("Sprite_card")

    spCard:setTexture(Resources.getCardSprite(cardData):getTexture())

    pCardFront:setName("gongCardFront")

    pCardFront:setPosition(cc.p(336.88, -214.49))

    self.m_plGongPai:addChild(pCardFront, pCardBack:getLocalZOrder())

    pCardFront:setVisible(false)

 

    local orbcardBg = cc.OrbitCamera:create(0.6, 1, 0, 0, -90, 0, 0)

    local deytime = cc.DelayTime:create(0.4)

    local show = cc.Show:create()

    local hide = cc.Hide:create()

    local actionListBg = {}

    table.insert( actionListBg, deytime )

    table.insert( actionListBg, show )

    table.insert( actionListBg, deytime )

    table.insert( actionListBg, hide)

    local sequenceBg = cc.Sequence:create(actionListBg)

    local spawnbg = cc.Spawn:create(sequenceBg, orbcardBg)

    pCardBack:runAction(spawnbg)

 

    local actionFront = {}

    table.insert( actionFront, deytime )

    table.insert( actionFront, hide )

    table.insert( actionFront, deytime )

    table.insert( actionFront, show )

    local sequenceFront = cc.Sequence:create(actionFront)

    local orbcardFront = cc.OrbitCamera:create(0.4, 1, 0, 0, -360, 0, 0)

    local spawnFront = cc.Spawn:create(sequenceFront, orbcardFront)

    pCardFront:runAction(spawnFront)

你可能感兴趣的:(cocos2dx)