【发布时间】:2015-07-10 21:03:42
【问题描述】:
我有一个遵循 CGPathCreateWithEllipseInRect 描述的路径的精灵。它总是从最右边的点开始(我猜是因为默认是从角度 = 0 开始)。如何让它从最高点开始(角度 = π/2)?我现在的代码是这样的:
let pathCenter = CGPoint(x: frame.width/2 , y: frame.height/2)
let pathDiameter = CGFloat(frame.height/4)
let path = CGPathCreateWithEllipseInRect(CGRect(origin: pathCenter, size: CGSize(width: pathDiameter * 1.5, height: pathDiameter * 0.8)), nil)
let followPath = SKAction.followPath(path, asOffset: false, orientToPath: false, duration: 6.0)
sprite.runAction(SKAction.repeatActionForever(followPath))
【问题讨论】:
标签: swift ellipse skaction cgpath