Skip to content

Instantly share code, notes, and snippets.

@dcastro
Created June 2, 2012 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcastro/2856150 to your computer and use it in GitHub Desktop.
Save dcastro/2856150 to your computer and use it in GitHub Desktop.
Animation: Move an object (http://www.iphoneexamples.com/)
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
theAnimation.duration=1;
theAnimation.repeatCount=2;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:0];
theAnimation.toValue=[NSNumber numberWithFloat:-60];
[view.layer addAnimation:theAnimation forKey:@"animateLayer"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment