Last active
August 29, 2015 14:04
-
-
Save tongoclinh/7c1378c258779c5f6179 to your computer and use it in GitHub Desktop.
Animate changing corner radius of CALayer
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
| CABasicAnimation *cornerAnim = [CABasicAnimation animationWithKeyPath:@"cornerRadius"]; | |
| cornerAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; | |
| cornerAnim.fromValue = [NSNumber numberWithFloat:40.0f]; | |
| cornerAnim.toValue = [NSNumber numberWithFloat:5.0f]; | |
| cornerAnim.duration = 1.0; | |
| [self.view.layer addAnimation:cornerAnim forKey:@"cornerRadius"]; | |
| self.view.layer = cornerAnim.toValue; | |
| //self is UIViewController sub-class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment