Skip to content

Instantly share code, notes, and snippets.

@nishabe
Last active August 12, 2018 18:24
Show Gist options
  • Save nishabe/41b54634c9c89df419ac45ed0d5dbe94 to your computer and use it in GitHub Desktop.
Save nishabe/41b54634c9c89df419ac45ed0d5dbe94 to your computer and use it in GitHub Desktop.
OBJC: Pulsing View Animation
-(void)showPulsingAnimation {
CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
theAnimation.duration = 2.0;
theAnimation.repeatCount = HUGE_VALF;
theAnimation.autoreverses = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:1.0];
theAnimation.toValue = [NSNumber numberWithFloat:0.0];
[self.pulsingView.layer addAnimation:theAnimation forKey:@"animateOpacity"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment