Corey
Corey

Reputation: 2563

CCScene addChild Transition

I've got a CCScene and I'm adding a CCLayer to it via addChild:

[self addChild:helloWorldLayer];

Is there a way to add this child with a transition similar to how you can do this?

[CCTransitionFade transitionWithDuration:1.00f scene:[HelloWorldScene scene]];

Upvotes: 1

Views: 311

Answers (2)

CodeSmile
CodeSmile

Reputation: 64477

Most transitions use a regular CCAction to perform its job. To fade the layer in, use the CCFade action.

The downside: not all transitions are backed by actions, and actions may work differently on layers than in a transition. If in doubt, look at the code of the transition class to learn which action it uses and how it is used.

Upvotes: 0

Hari Babu
Hari Babu

Reputation: 921

Try this one:

[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[HelloWorldScene scene] withColor:ccWHITE]];

Upvotes: 2

Related Questions