小编chr*_*nce的帖子

平滑地动画 CAShapeLayer 路径

我正在尝试制作一个 Gauge UIView 来尽可能模仿以下图像 目标

    func gradientBezierPath(percent: CGFloat) ->  UIBezierPath {
        // vary this to move the start of the arc
        let startAngle = CGFloat(180).toRadians()//-CGFloat.pi / 2  // This corresponds to 12 0'clock
        // vary this to vary the size of the segment, in per cent
        let proportion = CGFloat(50 * percent)
        let centre = CGPoint (x: self.frame.size.width / 2, y: self.frame.size.height / 2)
        let radius = self.frame.size.height/4//self.frame.size.width / (CGFloat(130).toRadians())
        let arc = CGFloat.pi * 2 * proportion / 100 // …
Run Code Online (Sandbox Code Playgroud)

animation cabasicanimation ios uibezierpath swift

1
推荐指数
1
解决办法
1378
查看次数

标签 统计

animation ×1

cabasicanimation ×1

ios ×1

swift ×1

uibezierpath ×1