cocos2d-x 实现翻牌效果

翻牌的3D动画:



CCSprite* pSprite = CCSprite::spriteWithFile("HelloWorld.png");

pSprite->setPosition( ccp(size.width/2, size.height/2) );

 

pSprite->runAction( CCSequence::actions( CCOrbitCamera::actionWithDuration(1 , 1 , 0 , 0 , 90 , 0, 0),

        CCCallFuncN::actionWithTarget(this , callfuncN_selector(HelloWorld::objectReset) ) , 

CCOrbitCamera::actionWithDuration(1 , 1 , 0 , 90, 90 , 0, 0), NULL) );

this->addChild(pSprite, 0);

return true;

}

void HelloWorld::objectReset(CCNode* sender)

{

        CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addImage("HelloWorld1.png");

CCSprite *sprite = (CCSprite *)sender;

sprite -> setTexture(texture);

}

 

你可能感兴趣的:(cocos2d-x)