Skip to content

Instantly share code, notes, and snippets.

@benchester
Forked from JonB/gist:1767992
Created February 8, 2012 10:47
Show Gist options
  • Save benchester/1768117 to your computer and use it in GitHub Desktop.
Save benchester/1768117 to your computer and use it in GitHub Desktop.
CA Test
- (IBAction)goButtonPressed:(id)sender
{
CALayer *layer = self.theRedSquare.layer;
CATransform3D initialTransform = self.theRedSquare.layer.transform;
initialTransform.m34 = 1.0 / -1000;
CATransform3D rotationAndPerspectiveTransform = CATransform3DRotate(initialTransform, M_PI , 0 , -self.theRedSquare.bounds.size.height/2, 0);
layer.anchorPoint = CGPointMake(0.0, 0.5);
[UIView beginAnimations:@"com.jon.Scale" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
layer.transform = rotationAndPerspectiveTransform;
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment