Skip to content

Instantly share code, notes, and snippets.

@MaximAlien
Created December 21, 2015 10:29
Show Gist options
  • Save MaximAlien/f6abd0897a0af358f7f8 to your computer and use it in GitHub Desktop.
Save MaximAlien/f6abd0897a0af358f7f8 to your computer and use it in GitHub Desktop.
[iOS] Rotation animation using CABasicAnimation
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.duration = 2.0f;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.additive = YES;
rotationAnimation.fromValue = [NSNumber numberWithFloat:0];
rotationAnimation.toValue = [NSNumber numberWithFloat:M_PI];
rotationAnimation.fillMode = kCAFillModeForwards;
[self.customView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment