@antv/f2
Version:
Charts for mobile visualization.
24 lines • 697 B
JavaScript
import constant from "./constant.js";
function linear(a, d) {
return function (t) {
return a + t * d;
};
}
function exponential(a, b, y) {
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) {
return Math.pow(a + t * b, y);
};
}
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 function gamma(y) {
return (y = +y) === 1 ? nogamma : function (a, b) {
return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
};
}
export default function nogamma(a, b) {
var d = b - a;
return d ? linear(a, d) : constant(isNaN(a) ? b : a);
}