【IOS】雷达中心扩散效果


UIImageView *imageView =[WJDControl createImageViewWithFrame:self.bounds ImageName:@"yuan"];

[self addSubview:imageView];

UIImageView *centerImageView =[WJDControl createImageViewWithFrame:CGRectMake(0, 0, 33, 33) ImageName:@"user_location"];

centerImageView.center = imageView.center;

[self addSubview:centerImageView];

CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];

opacityAnimation.fromValue = [NSNumber numberWithFloat:1.0];

opacityAnimation.toValue = [NSNumber numberWithFloat:0.0];

opacityAnimation.duration = 2.0f;

opacityAnimation.autoreverses= NO;

opacityAnimation.repeatCount = MAXFLOAT;

//    opacityAnimation.speed = 1.0f;

CABasicAnimation * animation2 = [CABasicAnimation animationWithKeyPath:@"transform.scale"];

animation2.fromValue = [NSNumber numberWithDouble:0];

animation2.toValue = [NSNumber numberWithDouble:1];

animation2.duration= 2.0;

animation2.autoreverses= NO;

animation2.repeatCount= FLT_MAX;  //"forever"

 animation2.removedOnCompletion= YES;

[imageView.layer addAnimation:animation2 forKey:@"scale"];

  [imageView.layer addAnimation:opacityAnimation forKey:nil];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容