UIBezierPath动画 画圆

来源:互联网 发布:2016淘宝规则好评返现 编辑:程序博客网 时间:2024/06/05 00:09

            UIBezierPath *path = [UIBezierPathbezierPathWithArcCenter:point radius:60startAngle:pi*2*percent1/100endAngle:pi*2*percent2/100clockwise:YES];

            CAShapeLayer *shapeLayer = [CAShapeLayerlayer];

            shapeLayer.path = path.CGPath;

            shapeLayer.strokeColor = color.CGColor;

            shapeLayer.fillColor = [[UIColorclearColor] CGColor];

            shapeLayer.lineWidth =10;

            [view.layeraddSublayer:shapeLayer];

            

            CABasicAnimation *pathAnimation = [CABasicAnimationanimationWithKeyPath:@"strokeEnd"];

            pathAnimation = [CABasicAnimationanimationWithKeyPath:@"strokeEnd"];

            pathAnimation.duration =2.0;

            pathAnimation.fromValue = [NSNumbernumberWithFloat:0.0f];

            pathAnimation.toValue = [NSNumbernumberWithFloat:1.0f];

            [shapeLayer addAnimation:pathAnimationforKey:@"strokeEnd"];

0 0
原创粉丝点击