Skip to content

Instantly share code, notes, and snippets.

@alexnikol
Created Jun 16, 2020
Embed
What would you like to do?
Cuphead-MouthShape
private func getMouthShape() -> CAShapeLayer {
let path = UIBezierPath()
path.move(to: CGPoint(x: 310, y: 250))
path.addCurve(to: CGPoint(x: 175, y: 250),
controlPoint1: CGPoint(x: 330, y: 335),
controlPoint2: CGPoint(x: 125, y: 325))
path.addCurve(to: CGPoint(x: 310, y: 250),
controlPoint1: CGPoint(x: 195, y: 245),
controlPoint2: CGPoint(x: 260, y: 265))
let mouthShape = CAShapeLayer()
mouthShape.path = path.cgPath
mouthShape.lineWidth = 3
mouthShape.strokeColor = UIColor.black.cgColor
mouthShape.fillColor = UIColor.black.cgColor
return mouthShape
}
private func getTongueShape() -> CAShapeLayer {
let path = UIBezierPath()
path.move(to: CGPoint(x: 175, y: 290))
path.addCurve(to: CGPoint(x: 230, y: 285),
controlPoint1: CGPoint(x: 160, y: 250),
controlPoint2: CGPoint(x: 210, y: 250))
path.addCurve(to: CGPoint(x: 270, y: 305),
controlPoint1: CGPoint(x: 210, y: 260),
controlPoint2: CGPoint(x: 260, y: 265))
path.addQuadCurve(to: CGPoint(x: 175, y: 290),
controlPoint: CGPoint(x: 210, y: 320))
let tongueShape = CAShapeLayer()
tongueShape.path = path.cgPath
tongueShape.lineWidth = 2
tongueShape.strokeColor = UIColor.black.cgColor
tongueShape.fillColor = UIColor(named: "orangeColor")?.cgColor
return tongueShape
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment