Hi guys!
I struggle with how to handle transitions between scenes in my Sparrow projects.
I usually end up just adding all scenes (SPSprite subclasses really) to the stage at once, but outside the viewable area. I then create hide: and show: methods in each "scene" class. These methods animates objects into (or out of) the viewable area. For instance, a show: might look like this:
- (void) show { self.touchable = NO; float time = 1.0f; [self updateButtons:-1]; SPTween *tween = [SPTween tweenWithTarget:self time:time transition:SP_TRANSITION_EASE_OUT_BACK]; self.rotation = -PI; [tween animateProperty:@"rotation" targetValue:0]; [self.stage.juggler addObject:tween]; [[self.stage.juggler delayInvocationAtTarget:self byTime:time] setTouchable:YES]; }
This code simply rotates the scene into the viewable area. To hide it, just do the opposite. Other variations animates all the different objects into the screen individually from different corners of the viewport. It works but is a bit messy and (probably) odd to have all objects rendered outside the viewport.
As an example, consider writing something like a slideshow (powerpoint) viewer in Sparrow where each page would be a Scene and there would be different transitions for each slide. Like fade in/crossover, flip, rotate, 3d flip etc...
How would you do this? How do you do it today? Looking forward to your ideas!
Thanks!