export function constrain(value, min, max) {
return Math.min(max, Math.max(min, value));
}
export function easeInOutQuad(progress, start, delta, duration) {
progress /= duration / 2;
if (progress < 1)
return (progress * progress * (delta / 2)) + start;
--progress;
return (((progress * (progress - 2)) - 1) * (-delta / 2)) + start;
}
export function map(value, xMin, xMax, yMin, yMax) {
return constrain(((value - xMin) * (yMax - yMin) / (xMax - xMin) + yMin), yMin, yMax);
}
export function maxDecimals(value, decimals) {
let power = 10 ** decimals;
return Math.round(value * power) / power;
}
export function randomBetween(min, max) {
return (Math.random() * (max - min)) + min;
}