Created
July 19, 2009 13:48
-
-
Save atnan/149922 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
CALayer* layer = someView.layer; | |
CAKeyframeAnimation* animation; | |
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
animation.duration = 1.0; | |
animation.cumulative = YES; | |
animation.repeatCount = 1; | |
animation.removedOnCompletion = NO; | |
animation.fillMode = kCAFillModeForwards; | |
animation.values = [NSArray arrayWithObjects: | |
[NSNumber numberWithFloat:0.0 * M_PI], | |
[NSNumber numberWithFloat:0.5 * M_PI], | |
[NSNumber numberWithFloat:1.0 * M_PI], nil]; | |
animation.keyTimes = [NSArray arrayWithObjects: | |
[NSNumber numberWithFloat:0.0], | |
[NSNumber numberWithFloat:0.5], | |
[NSNumber numberWithFloat:1.0], nil]; | |
animation.timingFunctions = [NSArray arrayWithObjects: | |
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], | |
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], nil]; | |
[layer addAnimation:animation forKey:@"transform.rotation.z"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment