【IOS】雷达中心扩散效果

2017-11-08  本文已影响180人  雨影

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];

上一篇 下一篇

猜你喜欢

热点阅读