Created
December 23, 2019 13:37
-
-
Save slawo-ch/84ef495f6cb7ac305213f82b166b677d 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
const makeFiveColorGradient = (c1, c2, c3, c4, c5) => { | |
const g = []; | |
for (let i = 0; i < 64; i++) { | |
const f = i / 64; | |
g[i] = interpolate(c1, c2, f); | |
} | |
for (let i = 64; i < 128; i++) { | |
const f = (i - 64) / 64; | |
g[i] = interpolate(c2, c3, f); | |
} | |
for (let i = 128; i < 192; i++) { | |
const f = (i - 128) / 64; | |
g[i] = interpolate(c3, c4, f); | |
} | |
for (let i = 192; i < 256; i++) { | |
const f = (i - 192) / 64; | |
g[i] = interpolate(c4, c5, f); | |
} | |
return g; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment