Last active
August 3, 2018 11:55
-
-
Save marcos1262/7f03ec16a47af105a8cd79cb05e127b0 to your computer and use it in GitHub Desktop.
Example of gradient on iOS
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
static func mainGradient(_ width: CGFloat, _ height: CGFloat) -> CAGradientLayer { | |
let gradient = CAGradientLayer() | |
gradient.frame = CGRect(x: 0, y: 0, width: width, height: height) | |
gradient.startPoint = CGPoint(x: 0, y: 1) | |
gradient.endPoint = CGPoint(x: 1, y: 0) | |
gradient.colors = [UIColor(rgb: 0x6441a5).cgColor, | |
UIColor(rgb: 0x2a0845).cgColor] | |
return gradient | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment