-(void)drawRect:(CGRect)rect {
[super drawRect:rect];
[[UIColor colorWithRed:22 / 255.0 green:163 / 255.0 blue:130 / 255.0 alpha:1] setFill];
UIRectFill(rect);
NSInteger pulsingCount = 6;
double animationDuration = 3;
for (int i = 0; i < pulsingCount; i++) {
CALayer * pulsingLayer = [CALayer layer];
pulsingLayer.frame = CGRectMake(0, 0, rect.size.width, rect.size.height);
pulsingLayer.borderColor = [UIColor whiteColor].CGColor;
pulsingLayer.borderWidth = 1;
pulsingLayer.cornerRadius = rect.size.height / 2;
CAMediaTimingFunction * easeInCurve = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
CAAnimationGroup * animationGroup = [CAAnimationGroup animation];
animationGroup.fillMode = kCAFillModeBackwards;
animationGroup.beginTime = CACurrentMediaTime() + (double)i * animationDuration / (double)pulsingCount;
animationGroup.duration = animationDuration;
animationGroup.repeatCount = HUGE;
animationGroup.timingFunction = easeInCurve;
CABasicAnimation * scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.fromValue = @0.5;
scaleAnimation.toValue = @2.2;
CAKeyframeAnimation * opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"];
opacityAnimation.values = @[@1, @0.9, @0.8, @0.7, @0.6, @0.5, @0.4, @0.3, @0.2, @0.1, @0];
opacityAnimation.keyTimes = @[@0, @0.1, @0.2, @0.3, @0.4, @0.5, @0.6, @0.7, @0.8, @0.9, @1];
animationGroup.animations = @[scaleAnimation, opacityAnimation];
[pulsingLayer addAnimation:animationGroup forKey:@"plulsing"];
[self.layer addSublayer:pulsingLayer];
}
}
- effect picture