内容大纲:html
四、用于CAShapeLayer的贝塞尔曲线作为path,其path实一个首尾相接的闭环的曲线,即便该贝塞尔曲线不是一个闭环的曲线git
图2.pnggithub
如何创建贝塞尔曲线和CAShapeLayer的联系:框架
属性:pathpost
UIBezierPath *circle = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0,0,200,100)]; shape.path = circle.CGPath;
属性:fillColor 修改贝塞尔曲线的填充颜色优化
属性:maskToBounds 动画
四、将strokeStart值设定成0,而后让strokeEnd的值变化触发隐式动画spa
类:CAShapeLayer3d
属性:code
处理方法:
shapeLayer.strokeStart = valueOne < valueTwo ? valueOne : valueTwo; shapeLayer.strokeStart = valueOne > valueTwo ? valueOne : valueTwo;
属性:
圆形进度条动画.gif
源码下载地址:CircleProgress 中的 CircleProgress源码
直接更改path的结果,并无理想中的渐变过程,因此须要使用核心动画:
综合示例源码请看:https://github.com/HeYang123456789/UIView
若是fillColors不设置成 [UIColor clearColor].CGColor就会有这样的效果: