如何以编程方式更改endAngle

时间:2016-09-13 12:50:58

标签: swift sprite-kit uibezierpath skshapenode

我想通过这样的方式创建一个带Swift和SpriteKit的弧:

func createArc(endAngle: CGFloat) -> SKShapeNode {

    let bezierPath = UIBezierPath(arcCenter: CGPointMake(0, 0), radius: 300, startAngle: CGFloat(M_PI_2), endAngle: endAngle, clockwise: false)

    let pathNode = SKShapeNode(path: bezierPath.CGPath)
    pathNode.strokeColor = SKColor.blackColor()
    pathNode.lineWidth = 50
    pathNode.position = CGPoint(x: size.width/2, y: size.height/2)
    pathNode.antialiased = true

    return pathNode


}

但是如何在update()函数中以编程方式更改UIBezierPath的endAngle值?

0 个答案:

没有答案