Skip to content

Instantly share code, notes, and snippets.

@RichFell
Created August 26, 2015 17:35
Show Gist options
  • Save RichFell/44cf68262905003757ee to your computer and use it in GitHub Desktop.
Save RichFell/44cf68262905003757ee to your computer and use it in GitHub Desktop.
-(void)startPulsatingAnimation {
if (!self.shouldPulsate) {return;}
[self removePulsingAnimation];
CABasicAnimation *theAnimation=[CABasicAnimation animationWithKeyPath:OpacityAnimationKey];
theAnimation.duration = 1.0;
theAnimation.repeatCount = HUGE_VALF;
theAnimation.autoreverses = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:1.0];
theAnimation.toValue = [NSNumber numberWithFloat:0.0];
[self.layer addAnimation:theAnimation forKey:PulsingAnimation];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment