Created
June 5, 2017 13:05
-
-
Save simonwuyts/b280f8ae8dcf47fcb484633b4c256fb4 to your computer and use it in GitHub Desktop.
Paint
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
// Shadow Layer | |
let shadowShape = CAShapeLayer() | |
shadowShape.path = bubblePath.cgPath | |
shadowShape.fillColor = fillColor.cgColor | |
shadowShape.shadowColor = shadowColor.cgColor | |
shadowShape.shadowOffset = CGSize(width: CGFloat(shadowOffsetX), height: CGFloat(shadowOffsetY)) | |
shadowShape.shadowRadius = CGFloat(shadowBlur) | |
shadowShape.shadowOpacity = 0.8 | |
// Border Layer | |
let borderShape = CAShapeLayer() | |
borderShape.path = bubblePath.cgPath | |
borderShape.fillColor = fillColor.cgColor | |
borderShape.strokeColor = borderColor.cgColor | |
borderShape.lineWidth = CGFloat(borderWidth*2) | |
// Fill Layer | |
let fillShape = CAShapeLayer() | |
fillShape.path = bubblePath.cgPath | |
fillShape.fillColor = fillColor.cgColor | |
// Add Sublayers | |
self.layer.insertSublayer(shadowShape, at: 0) | |
self.layer.insertSublayer(borderShape, at: 0) | |
self.layer.insertSublayer(fillShape, at: 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment