【发布时间】:2016-08-06 19:36:14
【问题描述】:
我正在努力实现这样的目标。我也在 Swift 中寻找答案。到目前为止,我有一个CAShapeLayer
对于CAShapeLayer,我使用此代码来创建它。
let circlePath: UIBezierPath = UIBezierPath(arcCenter: CGPoint(x: 36, y: 47), radius: view.frame.width / 2, startAngle: 0, endAngle: CGFloat(M_PI * 2), clockwise: true)
let circleShape: CAShapeLayer = CAShapeLayer()
circleShape.path = circlePath.CGPath
circleShape.fillColor = UIColor.clearColor().CGColor
circleShape.lineWidth = view.frame.width - 80
circleShape.strokeColor = Color().blue.CGColor
circleShape.opacity = 0.87
效果很好,外观也很棒,但是当我想让它最初是一个 (1,1) 圆然后扩展到当前大小时它不起作用。所以我想将圆从半径 1 开始动画到半径 180,然后能够反转它。
【问题讨论】:
-
所以你想将你的圆的大小从半径为 1 的圆设置为最终大小?'
-
正确。最终半径为 180。
标签: ios swift uikit core-graphics