Created
June 14, 2017 01:54
-
-
Save ycditchf/e37546cbc0a6a5bd25b72f4de91977ce 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)heartAnimationWithLayer:(CALayer*)layer { | |
CAAnimationGroup *group = [[CAAnimationGroup alloc]init]; | |
group.duration = 0.5; | |
group.repeatCount = HUGE; | |
CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; | |
scaleAnim.toValue = @1.2; | |
CABasicAnimation *alphaAnim = [CABasicAnimation animationWithKeyPath:@"opacity"]; | |
alphaAnim.toValue = @0.3f; | |
group.animations = @[scaleAnim,alphaAnim]; | |
[layer addAnimation:group forKey:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment