Skip to content

Instantly share code, notes, and snippets.

@bleft
Created May 16, 2013 08:05
Show Gist options
  • Save bleft/5590171 to your computer and use it in GitHub Desktop.
Save bleft/5590171 to your computer and use it in GitHub Desktop.
pulsing animation. Put two UIImageViews on a view for low and highlighted. Animate the highlighted for pulsing. To stop animation remove animation from layer. Needs QuartzCore.Framework.
- (void)startAnimation
{
self.imageViewHigh.hidden = NO;
CABasicAnimation *theAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
theAnimation.duration = 1.0f;
theAnimation.repeatCount = HUGE_VALF;
theAnimation.autoreverses = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
theAnimation.toValue = [NSNumber numberWithFloat:1.0f];
[self.imageViewHigh.layer addAnimation:theAnimation forKey:@"animateOpacity"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment