Core Animation based on Quartz provides very simple ways to create special effects in your game or application.

The following shows how to create a Pulse Effect of any UIView (e.g. UIButtonView, UIImageView etc.)

  1. +(void)pulse:(UIView*)view toSize: (float) value withDuration:(float) duration
  2. {
  3.     CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
  4.     pulseAnimation.duration = duration;
  5.     pulseAnimation.toValue = [NSNumber numberWithFloat:value];;
  6.     pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
  7.     pulseAnimation.autoreverses = YES;
  8.     pulseAnimation.repeatCount = FLT_MAX;
  9.    
  10.     [view.layer addAnimation:pulseAnimation forKey:nil];
  11. }