我正在尝试在Cocos2D for iOS中创建一个自定义场景转换,以模拟书籍封面的开放。
外出的场景必须向左翻开(铰接在屏幕的左边缘)并显示即将到来的场景,就好像它正在被外出场景发现的书的第一页所在
关于如何做到这一点的任何想法?
我能够创建一个CCTransitionSceneOriented
的子类,执行一个简单的书籍封面转换,遗憾的是看起来并不专业,因为当打开封面时,进入的场景不会逐渐显示: - (
@implementation TransitionBookCover
-(void) onEnter
{
[super onEnter];
[inScene_ setVisible:NO];
id outCameraAct = [CCOrbitCamera actionWithDuration:duration_/2 radius:1 deltaRadius:0 angleZ:180 deltaAngleZ:65 angleX:0 deltaAngleX:0];
id outHideAct = [CCHide action];
id outDelayAct = [CCDelayTime actionWithDuration:duration_/2];
id outGroupAct1 = [CCSequence actions:outCameraAct, outHideAct, outDelayAct, nil];
id outMoveAct = [CCMoveTo actionWithDuration:duration_/4 position:ccp(-384.0,0.0)];
id outGroupAct2 = [CCSpawn actions:outMoveAct, outGroupAct1, nil];
id inDelayAct = [CCDelayTime actionWithDuration:duration_/2];
id inShowAct = [CCShow action];
id inFuncAct = [CCCallFunc actionWithTarget:self selector:@selector(finish)];
id inGroupAct = [CCSequence actions:inDelayAct, inShowAct, inFuncAct, nil];
[outScene_ runAction:outGroupAct2];
[inScene_ runAction:inGroupAct];
}
@end.
答案 0 :(得分:0)
你可能不必对场景这样做。你可以用2种方式廉价地做到:
CCTransitionFlipX
更像是将卡片翻过来,而不是一本书的第一页。