Skip to content

Instantly share code, notes, and snippets.

@JonB
Created February 8, 2012 10:27
Show Gist options
  • Save JonB/1767992 to your computer and use it in GitHub Desktop.
Save JonB/1767992 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;
layer.transform = initialTransform;
layer.anchorPoint = CGPointMake(0.0, 0.5);
[UIView beginAnimations:@"com.jon.Scale" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
CATransform3D rotationAndPerspectiveTransform = self.theRedSquare.layer.transform;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, M_PI , 0 , -self.theRedSquare.bounds.size.height/2, 0);
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