🧹 Formats
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
data[2] = toUint8($input.left.y, -1, 1);
|
||||
data[3] = toUint8($input.right.x, -1, 1);
|
||||
data[4] = toUint8($input.right.y, -1, 1);
|
||||
data[5] = toUint8($input.height, 0, 100);;
|
||||
data[5] = toUint8($input.height, 0, 100);
|
||||
data[6] = toUint8($input.speed, 0, 100);
|
||||
|
||||
outControllerData.set(data);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const toUint8 = (number:number, min:number, max:number) => {
|
||||
number = Math.max(min, Math.min(max, number));
|
||||
let scaled = ((number - min) / (max - min)) * 255;
|
||||
return Math.round(scaled) & 0xFF;
|
||||
}
|
||||
export const toUint8 = (number: number, min: number, max: number) => {
|
||||
number = Math.max(min, Math.min(max, number));
|
||||
let scaled = ((number - min) / (max - min)) * 255;
|
||||
return Math.round(scaled) & 0xff;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user