More cleanup

This commit is contained in:
be5invis 2022-07-17 00:54:59 -07:00
parent e61edd0db9
commit 4a418cd473
58 changed files with 198 additions and 195 deletions

View file

@ -1,29 +1,23 @@
function mix(a, b, p) {
export function mix(a, b, p) {
return a + (b - a) * p;
}
function barmixL(l, r, b, p) {
return l > r ? barmixL(r, l, b, p) : l + b + p * (r - l - b * 3);
export function barMixL(l, r, b, p) {
return l > r ? barMixL(r, l, b, p) : l + b + p * (r - l - b * 3);
}
function barmixM(l, r, b, p) {
return barmixL(l, r, b, p) + b / 2;
}
function barMixR(l, r, b, p) {
return barMixR(l, r, b, p) + b;
}
function linreg(x0, y0, x1, y1, x) {
export function linreg(x0, y0, x1, y1, x) {
return y0 + ((x - x0) * (y1 - y0)) / (x1 - x0);
}
function clamp(l, h, x) {
export function clamp(l, h, x) {
return x < l ? l : x > h ? h : x;
}
function fallback(...args) {
export function fallback(...args) {
for (const item of args) if (item !== void 0) return item;
return void 0;
}
function bez2(a, b, c, t) {
export function bez2(a, b, c, t) {
return (1 - t) * (1 - t) * a + 2 * (1 - t) * t * b + t * t * c;
}
function bez3(a, b, c, d, t) {
export function bez3(a, b, c, d, t) {
return (
(1 - t) * (1 - t) * (1 - t) * a +
3 * (1 - t) * (1 - t) * t * b +
@ -31,12 +25,3 @@ function bez3(a, b, c, d, t) {
t * t * t * d
);
}
export { mix };
export { barmixL };
export { barmixM };
export { barMixR as barmixR };
export { linreg };
export { clamp };
export { fallback };
export { bez2 };
export { bez3 };