Ich habe einen Beizer Weg mit Start & Endwinkel, die einen ganzen KreisWie finde ich den Endwinkel für Beizerpath für eine in swift gezogene Kurve?
circle = UIView(frame: CGRect(x: 100, y: 100, width: 200, height:200))
circle.layoutIfNeeded()
self.view.addSubview(circle)
let centerPoint = CGPoint (x: circle.bounds.width/2, y: circle.bounds.width/2)
let circleRadius : CGFloat = circle.bounds.width/2 * 0.83
circlePath = UIBezierPath(arcCenter: centerPoint, radius: circleRadius, startAngle: CGFloat(-0.5 * M_PI), endAngle: CGFloat(1.5 * M_PI), clockwise: true)
Danach i & es in den Kreis voll füllt nicht zeichnen Sie eine Kurve auf diesem Kreis erstellen gezogen.
progressCircle = CAShapeLayer()
progressCircle.path = circlePath?.cgPath
progressCircle.strokeColor = UIColor.red.cgColor
progressCircle.fillColor = UIColor.clear.cgColor
progressCircle.lineWidth = 4.0
progressCircle.strokeStart = 0
progressCircle.strokeEnd = 0.7
circle.layer.addSublayer(progressCircle)
Danach i Bild hinzufügen mag bei dann so der Kurve am Ende zu tun, dass ich einen anderen biezer path.But erstellt hier Problem ist es sollte als die Kurve beendet werden end.So i nicht in der Lage bin zu finden Endwinkel für den Beizer-Pfad basierend auf dem endStroke von CASHAPELAYER. Bitte sagen Sie mir, wie ich den Endwinkel des neuen Beizer-Pfades basierend auf dem Kurvenendpunkt finden kann. Fortschritt Prozentsatz an Stellen auf der Basis der 360-Grad-
let centerPoint = CGPoint (x: circle.bounds.width/2, y: circle.bounds.width/2)
let circleRadius : CGFloat = circle.bounds.width/2 * 0.83
let arcStartAngle: Double = 0.0
let rotationDiff = 360 - abs((0.0 - 270))
let startAngle: CGFloat = -1.57
let endAngle: CGFloat = CGFloat(Double.pi * 0.7)
let bpath = UIBezierPath(arcCenter: centerPoint, radius: circleRadius, startAngle: startAngle, endAngle: endAngle, clockwise: true)
Warum 2 * Pi als Ende Winkel hängen von dem Fortschritt von Cashapelayer gemacht, die in roter Farbe ist – Techiee
Progressvalue *. Pi, das ist Ihr zweiter Winkel. Hier ist 0 bis 2 * pi der volle Kreis. –
Dieser Wert ist nicht korrekt, da er genauso wie die rote Formebene – Techiee