cosine-gradient
Cosine gradient generator
Usage
cosineGradient(scheme)
Parameters:
scheme
- array of cosine coefficients for R,G,B channels
Returns:
function(t)
- a function calculating a color value for t=0..1. The returned color is an array [0..1, 0..1, 0..1]
Example
To get the middle blue gradient from the screenshot you would:
var cosineGradient = ;var scheme = 000005000500 000005000500 000005000333 000005000667;var gradient = ; forvar i=0; i<=100; i++ var t = i / 100; var color = ; //[R=0..1, G=0..1, B=0..1]
Credits
This is an implementation of a technique by Inigo Quilez (Color Palettes) with color schemes by Karsten Schmidt aka Toxi from thi.ng/color and cosine gradient generator;
License
MIT, see LICENSE.md for details.