Matthijn
Matthijn

Reputation: 3234

Scene transition with CATransition in Cocos2D

Currently I am trying to port a project of mine from SpriteKit to Cocos2D. And I'm stuck with the transition's. In SpriteKit I could use the CATransition to transition to another scene.

But I can't figure out how I could do that in Cocos2D. Or perhaps there is another way to achieve a similar effect in Cocos2D. The effect I'm going for is this "pixelate" effect which is made with the CATransition class. If I could use that that would be awesome. If there is another way to achieve the same effect that is okay too.

Perhaps it is worth noting that I am using Cocos2d 3.

Upvotes: 4

Views: 278

Answers (2)

Tiddly
Tiddly

Reputation: 1620

You could try looking at the source code for CCTransitionTurnOffTiles. You could then copy it and create your own transition with a few tweaks so it's closer to the pixilate transition from SpriteKit.

I haven't looked at the source for this but I suspect tweaking it to what you want should just be a case of changing which series of actions it uses on each block.

Upvotes: 1

Kirit Modi
Kirit Modi

Reputation: 23407

According to your video you can push one scene to another scene using CCTransition in cocos2d with same effect. code as below

-(void)YourButtonToPush
{
   [[CCDirector sharedDirector] replaceScene:[CCTransitionTurnOffTiles transitionWithDuration:1.0 scene:[HelloWorldLayer scene]]];  
}

enter image description here

if you want to fast replacing to decrees transition time of the method.

Upvotes: 1

Related Questions