Created
June 16, 2020 14:17
-
-
Save alexnikol/5b96096f9561084ff8183a023378a1ef to your computer and use it in GitHub Desktop.
Cuphead-MouthShape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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