🐎 Adds four phase gait

This commit is contained in:
Rune Harlyk
2024-08-01 16:05:36 +02:00
committed by Rune Harlyk
parent c2e80f99c3
commit c93d3a030d
3 changed files with 60 additions and 10 deletions
+7
View File
@@ -9,3 +9,10 @@ export const toInt8 = (number: number, min: number, max: number) => {
let scaled = ((number - min) / (max - min)) * 255 - 128;
return Math.max(-128, Math.min(127, Math.round(scaled))) | 0;
};
export const fromInt8 = (int8: number, min: number, max: number) => {
int8 = Math.max(-128, Math.min(127, int8));
const scaled = (int8 + 128) / 255;
const number = scaled * (max - min) + min;
return number;
};