Created
May 24, 2023 13:49
-
-
Save OdNairy/8dd5c96e055694daf9074a3b62633ce9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func generateSunColor(progress: Double) -> UIColor { | |
if progress < 0.2 { | |
return interpolateColor(from: .white, | |
to: UIColor(red: 255/255, green: 242/255, blue: 0/255, alpha: 1), // Yellow | |
with: (progress) / 0.2) | |
} else if progress < 0.4 { | |
return interpolateColor(from: UIColor(red: 255/255, green: 242/255, blue: 0/255, alpha: 1), // Yellow | |
to: .white, | |
with: (progress - 0.2) / 0.2) | |
} else if progress < 0.7 { | |
return .white | |
} else if progress <= 0.85 { | |
return interpolateColor(from: .white, | |
to: UIColor(red: 255/255, green: 180/255, blue: 0/255, alpha: 1), | |
with: (progress - 0.7) / 0.15) | |
} else { | |
return interpolateColor(from: UIColor(red: 255/255, green: 180/255, blue: 0/255, alpha: 1), | |
to: UIColor(red: 204/255, green: 51/255, blue: 0/255, alpha: 1), | |
with: (progress - 0.85) / 0.15) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment