UNPKG

676 BJavaScriptView Raw
1import {cubehelix} from "d3-color";
2import interpolateColor from "./color";
3
4export default (function gamma(y) {
5 y = +y;
6
7 function interpolateCubehelixLong(start, end) {
8 var h = interpolateColor((start = cubehelix(start)).h, (end = cubehelix(end)).h),
9 s = interpolateColor(start.s, end.s),
10 l = interpolateColor(start.l, end.l),
11 opacity = interpolateColor(start.opacity, end.opacity);
12 return function(t) {
13 start.h = h(t);
14 start.s = s(t);
15 start.l = l(Math.pow(t, y));
16 start.opacity = opacity(t);
17 return start + "";
18 };
19 }
20
21 interpolateCubehelixLong.gamma = gamma;
22
23 return interpolateCubehelixLong;
24})(1);