Last active
April 13, 2020 09:20
-
-
Save Ethosa/ad983ae3174023e9b06bcabd73cbb08d to your computer and use it in GitHub Desktop.
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
finish = 187 | |
# current color: Color(0.0, 0.3, 0.8) | |
old_r = 0.0 | |
old_g = 0.3 | |
old_b = 0.8 | |
# target color: Color(0.9, 0.08, 0.2) | |
target_r = 0.9 | |
target_g = 0.08 | |
target_b = 0.2 | |
# calculate difference | |
r_smooth = target_r - old_r | |
g_smooth = target_g - old_g | |
b_smooth = target_b - old_b | |
def get_color_by_step(step): | |
r = old_r + (r_smooth * step / finish) | |
g = old_g + (g_smooth * step / finish) | |
b = old_b + (b_smooth * step / finish) | |
return r, g, b | |
for step in range(finish): | |
print("Color(%f, %f, %f)" % get_color_by_step(step)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment