Skip to content

Instantly share code, notes, and snippets.

@xieweizhi
Forked from albertodebortoli/bookCoverOpen.m
Created September 30, 2015 08:40
Show Gist options
  • Save xieweizhi/06bac099d8de6bae47d3 to your computer and use it in GitHub Desktop.
Save xieweizhi/06bac099d8de6bae47d3 to your computer and use it in GitHub Desktop.
Book cover flip animation on iOS (Path app style)
#import <QuartzCore/QuartzCore.h>
UIImageView *splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
splashView.image = [UIImage imageNamed:@"Default.png"];
[self.window addSubview:splashView];
[self.window bringSubviewToFront:splashView];
splashView.layer.anchorPoint=CGPointMake(0, .5);
splashView.center = CGPointMake(splashView.center.x - splashView.bounds.size.width/2.0f, splashView.center.y);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationDelay:1];
splashView.transform = CGAffineTransformMakeTranslation(0,0);
CATransform3D _3Dt = CATransform3DIdentity;
_3Dt =CATransform3DMakeRotation(3.141f/2.0f,0.0f,-1.0f,0.0f);
_3Dt.m34 = 0.001f;
_3Dt.m14 = -0.0015f;
splashView.layer.transform =_3Dt;
[UIView commitAnimations];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment