0
SKShapeNode에 추가하는 UIBezierPath가있는 원을 만들었습니다. 원이 잘 표시됩니다. 그러나 경로를 업데이트하려고 할 때 아무 일도 일어나지 않습니다. 내가 만든 동일한 초기 경로를 계속 볼 수 있습니다. 경로를 제대로 업데이트하려면 일종의 업데이트 기능을 호출해야합니까? 색상 변경 및 획 변경은 잘 작동하지만 경로는 변경되지 않습니다. (가) SKShapeNode
당신이 당신의 changePath
기능에서 언급하는 것은 위의 초기화에서 같은 아니다처럼SKShapeNode 경로가 업데이트되지 않습니다.
override init(texture: SKTexture?, color: UIColor, size: CGSize) {
shape = SKShapeNode.init()
endAngle = CGFloat(endAngle) * CGFloat(M_PI)/180.0
startAngle = CGFloat(startAngle) * CGFloat(M_PI)/180.0
let circlePath : UIBezierPath = UIBezierPath.init(arcCenter: CGPoint(x:0,y:0), radius: 30, startAngle: startAngle, endAngle: endAngle , clockwise: true)
super.init(texture: texture, color: color, size: size)
shape!.path = circlePath.cgPath
shape!.fillColor = UIColor.red
addChild(shape!)
}
func changePath() {
self.endAngle -= 0.1
self.circle.path = nil
let circlePath : UIBezierPath = UIBezierPath.init(arcCenter: CGPoint(x:0,y:0), radius: 35, startAngle: startAngle, endAngle: self.endAngle , clockwise: true)
self.circle.path = circlePath.cgPath
}
'circle' 속성은 당신이 참조하고있는'SKShapeNode'입니까? 그리고 init에서 생성 한'shape'' SKShpaeNode'와 같은 것입니까? – nathan
aaaargh !! 나는 그런 바보 야. 그게 바로 문제였습니다. 임시 SKShapeNode를 만들었고 임시 노드에서 경로를 변경하는 것을 잊었습니다. –