UNPKG

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