ISSUE-054 - Have static timing display mostly figured out.

Some subtle scaling was necessary to accomplish the proper spacing.
This commit is contained in:
Kyle Geib committed 2022-02-16 17:20:08 -05:00
1 parent 22ebab1101
commit 7507868dce
8 files changed
+134 -45

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import { random } from "lodash";
import { Meters } from "../types/util";
export function timeDiff(
front: Meters,
back: Meters,
) {
/**
* Spa length in 2020 was 308,052m. Hamilton won it in 1:24:08.761.
* That's 3600 + 1440 + 8.761 = 5,048.761 seconds.
* 61.015 m/s average. So, let's do that.
*/
return random(0.95, 1.05) * ((front - back) / 61.015);
}
+8 -4
View File
@@ -127,9 +127,13 @@ export function outlineClipPath(
[0, height + outlineThickness],
];
}
}
// return [
// ]
export function formatTime(time: number) {
if (time < 60) {
return String(time.toFixed(3));
}
const minutes = Math.floor(time / 60);
const seconds = time % 60;
return `${minutes}:${String(seconds.toFixed(3)).padStart(6, "0")}`;
}