Return to Snippet

Revision: 56915
at April 22, 2012 07:41 by leftspin


Initial Code
- (IBAction)leButtonTapped:(id)sender 
	{
	NextViewController *nvc = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil] ;

	// This performs a flipboard-like animation
	ASAnimatedTransition *animatedTransition = [[ASAnimatedTransition alloc] init] ;
	animatedTransition.sourceView = self.view ;
	animatedTransition.destinationView = nvc.view ;
	animatedTransition.hostView = self.view ;
	animatedTransition.initializeAnimationBlock = ^(AnimationView *animationView, CALayer *sourceLayer, CALayer *destinationLayer)
		{
		CATransform3D transform = CATransform3DIdentity ;
		transform.m34 =  1.0 / -200 ;
		transform = CATransform3DTranslate(transform, 0, 5, -25) ;
		destinationLayer.transform = transform ;
		} ;
	animatedTransition.performAnimationBlock = ^(AnimationView *animationView, CALayer *sourceLayer, CALayer *destinationLayer)
		{
		[CATransaction setAnimationDuration:0.6] ;
		sourceLayer.position = CGPointMake(sourceLayer.position.x, -sourceLayer.frame.size.height/2.0) ;
		destinationLayer.transform = CATransform3DIdentity ;
		} ;
	animatedTransition.animationFinishedBlock = ^()
		{
		[self.navigationController pushViewController:nvc animated:NO] ;
		} ;
	[animatedTransition performTransition] ;
	}

Initial URL
https://github.com/leftspin/IVM-Awesomesauce/blob/master/IVMAwesomesauce/RootViewController.m

Initial Description
A snippet of code from IVM-Awesomesauce that shows how to use included classes to perform a custom animation between two UIViewControllers.

Initial Title
Example from IVM-Awesomesauce

Initial Tags
animation

Initial Language
Objective C