实战需求
SwiftUI 动画教程之实现环形动态进度图 AnimatableModifier
本文价值与收获
看完本文后,您将能够作出下面的界面
![](https://img.haomeiwen.com/i41085/84fde5ac4e64ed93.png)
![](https://img.haomeiwen.com/i41085/2ae630d65592ffbe.gif)
看完本文您将掌握的技能
-
设置渐变圆球 Circle().fill(LinearGradient(gradient: .init(colors: [.yellow, .purple]),startPoint: .topLeading, endPoint: .bottomTrailing))
-
绘制弧度 path.addArc(startAngle: .degrees(0),endAngle: .degrees(Double(pct) * 360)
-
绘制线段 path.strokedPath(.init(lineWidth: 10, dash: [6, 3, 20, 3], dashPhase: 0))
网友评论