Skip to content

Instantly share code, notes, and snippets.

@mcany
Created October 7, 2016 06:43
Show Gist options
  • Save mcany/c6135133e0d1c8874b8c3d60e2d56775 to your computer and use it in GitHub Desktop.
Save mcany/c6135133e0d1c8874b8c3d60e2d56775 to your computer and use it in GitHub Desktop.
- (void)pulseAnimationTo:(UIView *)view duration:(float)duration toValue:(float)toValue repeatCount:(float)repeatCount {
CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
pulseAnimation.duration = duration;
pulseAnimation.toValue = [NSNumber numberWithFloat:toValue];
pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
pulseAnimation.autoreverses = YES;
pulseAnimation.repeatCount = repeatCount;
[view.layer addAnimation:pulseAnimation forKey:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment