GameCorder.net

このエントリーをはてなブックマークに追加

fadeOut and fadeIn Animation forever in cocos2dx

How to fadeOut and fadeIn animation forever.
First fadeOut Constant Value next fadeIn up value to use FadeTo class
Use Sequence Class and createAction using RepeatForever class.
Let's see Example!


    FadeTo* fadeOut = FadeTo::create(1, 100);
    FadeTo* fadeIn = FadeTo::create(1, 255);
    // fadeOut then fadeIn
    Sequence* sequence = Sequence::create(fadeOut,fadeIn,NULL);
    // create action with forever
    Action* action = RepeatForever::create(sequence);
    // run action
    Sprite* sprite = Sprite::create("image.png");
    sprite->runAction(action);
	

In case want to stop sprite->stopAllAction()
or ByTag

I confirm version 3.15.1.