WIP: reorganizing and beunsize mapping

This commit is contained in:
Rik Berkelder 2026-05-10 04:04:30 +02:00
parent 569a03245c
commit cad9433266
6 changed files with 502 additions and 401 deletions

11
src/utilityFunctions.ts Normal file
View file

@ -0,0 +1,11 @@
export function mapNumber(value: number, fromMin: number, fromMax: number, toMin: number, toMax: number): number {
if (value <= fromMin) return toMin;
if (value >= fromMax) return toMax;
const absFromMax = fromMax - fromMin;
const absToMax = toMax - toMin;
const mapped = (value / absFromMax) * absToMax;
return mapped + toMin;
}