Skip to content

Instantly share code, notes, and snippets.

@ycditchf
Created June 14, 2017 01:54
Show Gist options
  • Save ycditchf/e37546cbc0a6a5bd25b72f4de91977ce to your computer and use it in GitHub Desktop.
Save ycditchf/e37546cbc0a6a5bd25b72f4de91977ce to your computer and use it in GitHub Desktop.
心跳动画
/**心跳动画*/
- (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