d3-hsv
Version:
The HSV (Hue, Saturation, Value) color space.
18 lines (14 loc) • 378 B
JavaScript
import constant from "./constant";
function linear(a, d) {
return function(t) {
return a + t * d;
};
}
export function hue(a, b) {
var d = b - a;
return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
}
export default function(a, b) {
var d = b - a;
return d ? linear(a, d) : constant(isNaN(a) ? b : a);
}