Created
July 14, 2015 13:42
-
-
Save Pegolon/d2a9b31223be77deb2f4 to your computer and use it in GitHub Desktop.
Highlight layer with short animation
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 *color = [CABasicAnimation animationWithKeyPath:@"borderColor"]; | |
| color.fromValue = (id)[UIColor clearColor].CGColor; | |
| color.toValue = (id)[UIColor redColor].CGColor; | |
| CABasicAnimation *width = [CABasicAnimation animationWithKeyPath:@"borderWidth"]; | |
| width.fromValue = @0; | |
| width.toValue = @1.5; | |
| CAAnimationGroup *both = [CAAnimationGroup animation]; | |
| both.duration = 0.5; | |
| both.animations = @[color, width]; | |
| both.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
| both.autoreverses = YES; | |
| both.repeatCount = 1; | |
| [hitLayer addAnimation:both forKey:@"color and width"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment