diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-09-05 12:24:04 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-09-05 12:24:04 -0400 |
commit | ef9cab24b9ee3e25ab00d932fbab2f2a91476950 (patch) | |
tree | 64181097c4ba8f5e2fd7ad5efcebac37adff83c5 /Classes/ZoomFadeTransition.m | |
parent | c505b38ac0ad593ee7c4e56895a06a69878a88d3 (diff) | |
download | cartcollect-ef9cab24b9ee3e25ab00d932fbab2f2a91476950.tar.gz cartcollect-ef9cab24b9ee3e25ab00d932fbab2f2a91476950.tar.bz2 cartcollect-ef9cab24b9ee3e25ab00d932fbab2f2a91476950.zip |
Added zoom/fade transition to selection screen
Refs #207
Diffstat (limited to 'Classes/ZoomFadeTransition.m')
-rw-r--r-- | Classes/ZoomFadeTransition.m | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Classes/ZoomFadeTransition.m b/Classes/ZoomFadeTransition.m new file mode 100644 index 0000000..da995ea --- /dev/null +++ b/Classes/ZoomFadeTransition.m | |||
@@ -0,0 +1,60 @@ | |||
1 | // | ||
2 | // ZoomFadeTransition.m | ||
3 | // Cartographic | ||
4 | // | ||
5 | // Created by Starla Insigna on 9/5/11. | ||
6 | // Copyright (c) 2011 Four Island. All rights reserved. | ||
7 | // | ||
8 | |||
9 | #import "ZoomFadeTransition.h" | ||
10 | |||
11 | @implementation ZoomFadeTransition | ||
12 | |||
13 | + (id)transitionWithDuration:(ccTime)t scene:(CCScene *)s position:(CGPoint)position | ||
14 | { | ||
15 | return [[[self alloc] initWithDuration:t scene:s position:position] autorelease]; | ||
16 | } | ||
17 | |||
18 | - (id)initWithDuration:(ccTime)t scene:(CCScene *)s position:(CGPoint)p | ||
19 | { | ||
20 | self = [super initWithDuration:t scene:s]; | ||
21 | |||
22 | if (nil != self) | ||
23 | { | ||
24 | endPosition_ = ccpMult(p, 5.0f); | ||
25 | endScale_ = 5.0f; | ||
26 | } | ||
27 | |||
28 | return self; | ||
29 | } | ||
30 | |||
31 | -(void) onEnter | ||
32 | { | ||
33 | [super onEnter]; | ||
34 | |||
35 | [inScene_ setAnchorPoint:ccp(0.5f, 0.5f)]; | ||
36 | [outScene_ setAnchorPoint:ccp(0.5f, 0.5f)]; | ||
37 | |||
38 | CCLayerColor *l = [CCLayerColor layerWithColor:ccc4(0, 0, 0, 0)]; | ||
39 | [inScene_ setVisible: NO]; | ||
40 | [self addChild: l z:2 tag:0xFADEFADE]; | ||
41 | CCNode *f = [self getChildByTag:0xFADEFADE]; | ||
42 | |||
43 | [f runAction:[CCSequence actions: | ||
44 | [CCDelayTime actionWithDuration:duration_/5], | ||
45 | [CCFadeIn actionWithDuration:duration_/3], | ||
46 | [CCDelayTime actionWithDuration:duration_/5], | ||
47 | [CCFadeOut actionWithDuration:duration_/3], | ||
48 | [CCCallFunc actionWithTarget:self selector:@selector(finish)], | ||
49 | nil]]; | ||
50 | [outScene_ runAction:[CCSpawn actions: | ||
51 | [CCMoveTo actionWithDuration:duration_/3 position:endPosition_], | ||
52 | [CCScaleTo actionWithDuration:duration_/3 scale:endScale_], | ||
53 | nil]]; | ||
54 | [inScene_ runAction: [CCSequence actions: | ||
55 | [CCDelayTime actionWithDuration:duration_/5*3], | ||
56 | [CCCallFunc actionWithTarget:self selector:@selector(hideOutShowIn)], | ||
57 | nil]]; | ||
58 | } | ||
59 | |||
60 | @end | ||