您的位置:首页 > 移动开发 > IOS开发

IOS 点击按钮 光环 冲击波效果

2014-08-04 09:40 302 查看
UIBezierPath * path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(0, 0) radius:ROUND_WIDTH/2 -3 startAngle:0 endAngle:2*M_PI clockwise:YES];

CAShapeLayer * layer = [CAShapeLayer layer];

layer.path = path.CGPath;

layer.fillColor = [[UIColor clearColor]CGColor];

layer.strokeColor = [[UIColor orangeColor] CGColor];

layer.lineCap = kCALineCapRound;

layer.position = pt;

layer.lineWidth = 1.5f;

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

scaleAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];

scaleAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(5, 5, 1)];

scaleAnimation.removedOnCompletion = NO;

scaleAnimation.fillMode = kCAFillModeForwards;

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

alphaAnimation.fromValue = @1;

alphaAnimation.toValue = @0;

alphaAnimation.removedOnCompletion = NO;

alphaAnimation.fillMode = kCAFillModeForwards;

CAAnimationGroup * group = [CAAnimationGroup animation];

group.animations = @[scaleAnimation, alphaAnimation];

group.duration = 1.5;

group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];

group.delegate = self;

group.removedOnCompletion = NO;

group.fillMode = kCAFillModeForwards;

[_bgImgView.layer addSublayer:layer];

[layer addAnimation:group forKey:@""];

layer = nil;

本文转自 张江论坛 转自请注明~~~~ http://www.999dh.net/home.php?mod=space&uid=1&do=blog&id=409
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: