简单的圆弧动画
UIBezierPath * path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(150, 150) radius:100 startAngle:0 endAngle:M_PI*2 clockwise:YES];
// path.lineWidth = 10;
CAShapeLayer * layer = [[CAShapeLayer alloc]init];
layer.frame = view.bounds;
layer.path = path.CGPath;
layer.lineWidth = 10;
layer.strokeColor = [UIColor yellowColor].CGColor;
// layer.fillColor = [UIColor clearColor].CGColor;
layer.backgroundColor = [UIColor redColor].CGColor;
[view.layer addSublayer:layer];
CABasicAnimation * animation = [[CABasicAnimation alloc]init];
animation.fillMode=kCAFillModeForwards ;//保持动画后的状态
animation.keyPath = @"strokeEnd";
animation.fromValue = [NSNumber numberWithInteger:1];
animation.toValue = [NSNumber numberWithInteger:0];
animation.duration = 2;
animation.removedOnCompletion= NO;
[layer addAnimation: animation forKey:@""];
本文标题:简单的圆弧动画
本文链接:https://www.haomeiwen.com/subject/vbsddxtx.html
网友评论