cocos2d-xで後光の演出を作る
概要
画像(スプライト)を透過と永遠に回転させることで後光のエフェクトを作る。
環境
windows8.1
cocos2d-x v2.2.3
手順
アニメーションアクションを作成してスプライトのrunActionを実行する。
// 画像(スプライト)を追加する CCSize winSize = CCDirector::sharedDirector()->getWinSize(); CCSprite* pSprite = CCSprite::create("gokou.png"); pSprite->setPosition(ccp(winSize.width/2, winSize.height/2)); pSprite->setOpacity(85); this->addChild(pSprite, 0); // 画像を永遠に回転させる - 4秒で1回転 CCActionInterval* actionRotate = CCRotateBy::create(4.0f, 360); CCRepeatForever* actionRepeatForever = CCRepeatForever::create(actionRotate); pSprite->runAction(actionRepeatForever);
こんな感じで半透明化した後光を永遠に回転させる演出に使える。