What's up with this CCTransitionCrossFade?

Forums Programming cocos2d support (graphics engine) What's up with this CCTransitionCrossFade?

This topic contains 3 replies, has 2 voices, and was last updated by  araker 2 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
February 5, 2012 at 3:02 am #238971

Vramin
@vramin

If you check out the linked video you’ll see what I’m wrestling with. I’m presenting a world map where you pick a city, then I want to simulate zooming in on that city to see the levels that are available. I’ve got the zoom part where I’m pretty happy with it, but the crossfade goes to white and I can’t figure out why.

http://sobranisoft.com/video/crossfade.mov

I had this working in an older prototype project with 0.99.5, but in this case I have rebuilt the project using Kobold2d 1.0.2, which includes cocos2d 1.0.1. Not sure if the crossfade changed in the meantime, or if I’m doing something wrong.

- (void) zoomToSelectedCity: (LHTouchInfo*) info;
{
// Shift the layer to center the sprite up on screen
CGPoint center = ccp(WINSIZE.width/2, WINSIZE.height/2);
CGPoint cityPoint = [self convertToWorldSpace: lastCityTouched.position];
CGPoint target = ccpSub(center, cityPoint);
[self.parent runAction: [CCScaleBy actionWithDuration: 1.0f scale: 3.0f]];

CCScene *scene = [ZSCityMap scene];
Block transitionBlock = ^void
{
CCDirector sharedDirector] replaceScene: [CCTransitionCrossFade transitionWithDuration: 1.0f scene: scene;
};
[self runAction: [CCSequence actions: [CCMoveBy actionWithDuration: 1.0f position: target], [CCCallBlock actionWithBlock: transitionBlock], nil]];
}

February 5, 2012 at 10:07 pm #364506

araker
Moderator
@araker

It looks like a incorrect blend mode, try this..

//CCTransition.m, CCTransitionCrossFade onEnter method

replace

ccBlendFunc blend1 = {GL_ONE, GL_ONE}; // inScene_ will lay on background and will not be used with alpha

ccBlendFunc blend1 = {GL_ONE, GL_ZERO}; // inScene_ will lay on background and will not be used with alpha

GL_ONE,GL_ZERO turns off blending for the background layer in the transition. It doesn’t need to blend with the background.

February 6, 2012 at 12:24 am #364507

Vramin
@vramin

You are a genius. That fixed it perfectly! Thanks!

Is this something that should be submitted back to the project as a bug or correction?

February 6, 2012 at 1:24 am #364508

araker
Moderator
@araker

Yes it is, I’ll fix it in the next beta release of 1.1.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.