Skip to content

Instantly share code, notes, and snippets.

@sagaya
Created January 20, 2019 15:26
Show Gist options
  • Save sagaya/d0bd953de6cac876dbd99c003d29f5c9 to your computer and use it in GitHub Desktop.
Save sagaya/d0bd953de6cac876dbd99c003d29f5c9 to your computer and use it in GitHub Desktop.
Curved Bezier Path
let bezierPath = UIBezierPath()
bezierPath.move(to: CGPoint(x: 25.5, y: 185.5))
bezierPath.addCurve(to: CGPoint(x: 25.5, y: 56.5), controlPoint1: CGPoint(x: 25.5, y: 185.5), controlPoint2: CGPoint(x: 25.5, y: 88.75))
bezierPath.addCurve(to: CGPoint(x: 72.5, y: 67.5), controlPoint1: CGPoint(x: 25.5, y: 24.25), controlPoint2: CGPoint(x: 60.75, y: 64.75))
bezierPath.addCurve(to: CGPoint(x: 108.5, y: 185.5), controlPoint1: CGPoint(x: 84.25, y: 70.25), controlPoint2: CGPoint(x: 108.5, y: 185.5))
bezierPath.addCurve(to: CGPoint(x: 136.5, y: 299.5), controlPoint1: CGPoint(x: 108.5, y: 185.5), controlPoint2: CGPoint(x: 129.5, y: 271))
bezierPath.addCurve(to: CGPoint(x: 186.5, y: 279.5), controlPoint1: CGPoint(x: 143.5, y: 328), controlPoint2: CGPoint(x: 174, y: 284.5))
bezierPath.addCurve(to: CGPoint(x: 202.5, y: 185.5), controlPoint1: CGPoint(x: 199, y: 274.5), controlPoint2: CGPoint(x: 202.5, y: 185.5))
bezierPath.addCurve(to: CGPoint(x: 217.5, y: 67.5), controlPoint1: CGPoint(x: 202.5, y: 185.5), controlPoint2: CGPoint(x: 213.75, y: 97))
bezierPath.addCurve(to: CGPoint(x: 261.5, y: 67.5), controlPoint1: CGPoint(x: 221.25, y: 38), controlPoint2: CGPoint(x: 261.5, y: 67.5))
bezierPath.addCurve(to: CGPoint(x: 291.5, y: 185.5), controlPoint1: CGPoint(x: 261.5, y: 67.5), controlPoint2: CGPoint(x: 284, y: 156))
bezierPath.addCurve(to: CGPoint(x: 335.5, y: 299.5), controlPoint1: CGPoint(x: 299, y: 215), controlPoint2: CGPoint(x: 335.5, y: 299.5))
UIColor.black.setStroke()
bezierPath.lineWidth = 0
bezierPath.stroke()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment