Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function bezier(p1x: number, p1y: number, p2x: number, p2y: number): (t: number) => number {
const bezier = new UnitBezier(p1x, p1y, p2x, p2y);
return function(t: number) {
return bezier.solve(t);
};
}
export function bezier(p1x: number, p1y: number, p2x: number, p2y: number): (t: number) => number {
const bezier = new UnitBezier(p1x, p1y, p2x, p2y);
return function(t: number) {
return bezier.solve(t);
};
}
export function bezier(p1x, p1y, p2x, p2y) {
const bezier = new UnitBezier(p1x, p1y, p2x, p2y)
return function(t) {
return bezier.solve(t)
}
}
/**
static interpolationFactor(interpolation: InterpolationType, input: number, lower: number, upper: number) {
let t = 0;
if (interpolation.name === 'exponential') {
t = exponentialInterpolation(input, interpolation.base, lower, upper);
} else if (interpolation.name === 'linear') {
t = exponentialInterpolation(input, 1, lower, upper);
} else if (interpolation.name === 'cubic-bezier') {
const c = interpolation.controlPoints;
const ub = new UnitBezier(c[0], c[1], c[2], c[3]);
t = ub.solve(exponentialInterpolation(input, 1, lower, upper));
}
return t;
}