UNPKG

273 BJavaScriptView Raw
1export default function linearFunction(x0, y0, a) {
2 return {
3 y(x) {
4 return +y0 + (x - x0) * a;
5 },
6
7 x(y) {
8 return +x0 + (y - y0) / a;
9 }
10 };
11}
12
13export function interpolateLinear(x0, x1, phase) {
14 return linearFunction(x0, x0, phase).y(x1);
15}
16