Spaces:
Running
Running
| // Project runs at Chronixel's fps so source-frame trims stay integer-accurate. | |
| export const FPS = 30; | |
| export const msToFrame = (ms: number) => Math.round((ms / 1000) * FPS); | |
| export const frameToMs = (f: number) => Math.round((f / FPS) * 1000); | |
| export const fmtTime = (ms: number) => { | |
| const t = Math.max(0, ms); | |
| const m = Math.floor(t / 60000); | |
| const s = Math.floor((t % 60000) / 1000); | |
| const cs = Math.floor((t % 1000) / 10); | |
| return `${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}.${String(cs).padStart(2, "0")}`; | |
| }; | |