UNPKG

495 BJavaScriptView Raw
1import {hsl} from "d3-color";
2import interpolateColor from "./color";
3
4export default function interpolateHslLong(start, end) {
5 var h = interpolateColor((start = hsl(start)).h, (end = hsl(end)).h),
6 s = interpolateColor(start.s, end.s),
7 l = interpolateColor(start.l, end.l),
8 opacity = interpolateColor(start.opacity, end.opacity);
9 return function(t) {
10 start.h = h(t);
11 start.s = s(t);
12 start.l = l(t);
13 start.opacity = opacity(t);
14 return start + "";
15 };
16}