Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)turnUp:(BOOL)aBool {
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:kFlipAnimationDuration * 0.5];
- [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
- [UIView setAnimationDelegate:self];
- [UIView setAnimationDidStopSelector:@selector(turnHalftime)];
- CATransform3D flipTransform = CATransform3DIdentity;
- flipTransform.m34 = kFlipPerspective;
- flipTransform = CATransform3DRotate(flipTransform, M_PI / 2.0, 0.0f, 1.0f, 0.0f);
- flipTransform = CATransform3DTranslate(flipTransform, -kFlipHeight, 0.0f, 0.0f);
- flipTransform = CATransform3DScale(flipTransform, kFlipScale, kFlipScale, kFlipScale);
- cardView.layer.transform = flipTransform;
- [UIView commitAnimations];
- }
- - (void)turnHalftime {
- CATransform3D flipTransform = CATransform3DIdentity;
- flipTransform.m34 = kFlipPerspective;
- flipTransform = CATransform3DRotate(flipTransform,(-M_PI/2.0) - 0.001f, 0.0f, 1.0f, 0.0f);
- flipTransform = CATransform3DTranslate(flipTransform, kFlipHeight, 0.0f, 0.0f);
- flipTransform = CATransform3DScale(flipTransform, kFlipScale, kFlipScale, kFlipScale);
- cardView.layer.transform = flipTransform;
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:kFlipAnimationDuration * 0.5];
- [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
- [UIView setAnimationDelegate:self];
- [UIView setAnimationDidStopSelector:@selector(turnAnimationFinished)];
- CATransform3D flipTransform2 = CATransform3DMakeScale(kCardHeight / kCardImageHeight, kCardWidth / kCardImageWidth, 1.0f);
- flipTransform2.m34 = kFlipPerspective;
- flipTransform2 = CATransform3DRotate(flipTransform2, 0.0, 0.0f, 1.0f, 0.0f);
- flipTransform2 = CATransform3DTranslate(flipTransform2, 0.0f, 0.0f, 0.0f);
- cardView.layer.transform = flipTransform2;
- [UIView commitAnimations];
- }
- #define kFlipAnimationDuration 0.35f
- #define kFlipPerspective 1.0f / -600.0f
- #define kFlipHeight 90.0f
- #define kFlipScale 0.7f
Add Comment
Please, Sign In to add comment