Skip to content

Instantly share code, notes, and snippets.

@akshitzaveri
Last active May 2, 2020 11:27
Show Gist options
  • Save akshitzaveri/2b27bbd50ce39bb6bac53eb063c3a56b to your computer and use it in GitHub Desktop.
Save akshitzaveri/2b27bbd50ce39bb6bac53eb063c3a56b to your computer and use it in GitHub Desktop.
private func getPoint(for angle: Int) -> CGPoint {
// 1
let radius = Double(self.circleView.layer.cornerRadius)
// 2
let radian = Double(angle) * Double.pi / Double(180)
// 3
let newCenterX = radius * cos(radian)
let newCenterY = radius * sin(radian)
return CGPoint(x: newCenterX, y: newCenterY)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment