本文介绍了使用UIBezierPath对绘图弧进行动画处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下方法绘制了一条弧线:
I have drawn an arc using:
- (void)drawRect:(CGRect)rect {
UIBezierPath *stripePath = [UIBezierPath bezierPath];
[arcColor set];
[stripePath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:clockwise];
stripePath.lineWidth = arcWidth;
stripePath.lineCapStyle = kCGLineCapRound;
stripePath.lineJoinStyle = kCGLineCapRound;
[stripePath stroke];
}
现在,我想按角度为弧线设置动画。
Now I want to animate this arc by the angle.
我正在尝试使用类似的方法:
I am trying it with something like:
angle = startAngle;
[UIView animateWithDuration:1
delay:0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
angle = endAngle;
[stripePath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:angle clockwise:clockwise];
[stripePath stroke];
}];
但是,屏幕上没有显示动画。如何以角度作为变化变量对弧进行动画处理?谢谢。
However no animation is being displayed on screen. How to animate the arc with the angle as the changing variable? Thanks.
推荐答案
可能将帮助您按特定角度对弧进行动画处理。
May MHRadialProgressView will help you to animating arc by specific angle.
这篇关于使用UIBezierPath对绘图弧进行动画处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!