Skip to content

Instantly share code, notes, and snippets.

@mlaster
Created June 21, 2012 22:31
Show Gist options
  • Save mlaster/2969010 to your computer and use it in GitHub Desktop.
Save mlaster/2969010 to your computer and use it in GitHub Desktop.
- (CAAnimation *)rotationAnimation {
CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform"];
rotation.valueFunction = [CAValueFunction functionWithName:kCAValueFunctionRotateZ];
rotation.fromValue = [NSNumber numberWithFloat:0.0];
rotation.toValue = [NSNumber numberWithFloat:M_PI * 2];
rotation.duration = 2.0f;
rotation.repeatCount = INFINITY;
rotation.removedOnCompletion = NO;
return rotation;
}
...
[layer addAnimation:[self rotationAnimation] forKey:@"animation"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment