Created
October 10, 2016 13:13
-
-
Save bouchtaoui-dev/e34d8f0866c083f61aa75522cf81e56e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat; | |
| { | |
| CABasicAnimation* rotationAnimation; | |
| rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
| rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ]; | |
| rotationAnimation.duration = duration; | |
| rotationAnimation.cumulative = YES; | |
| rotationAnimation.repeatCount = repeat; | |
| [view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment