diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-07-12 12:48:31 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-07-12 12:48:31 +0200 |
| commit | 8545d95070890edfcf76b788ee023f9d510c302d (patch) | |
| tree | b3e1f9bf0bf30a8e748094b0a52c483befd7accf /apps/web/src/constants/timeline-constants.ts | |
| parent | 0726c27221c5b3aa9a8442b0cf89bd6acd8dfb5a (diff) | |
| download | opencut-8545d95070890edfcf76b788ee023f9d510c302d.tar.gz | |
refactor: add FPS and remove turbopack (yes, fuck you turbopack)
Diffstat (limited to 'apps/web/src/constants/timeline-constants.ts')
| -rw-r--r-- | apps/web/src/constants/timeline-constants.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/web/src/constants/timeline-constants.ts b/apps/web/src/constants/timeline-constants.ts index 26cd865c..92045c5e 100644 --- a/apps/web/src/constants/timeline-constants.ts +++ b/apps/web/src/constants/timeline-constants.ts @@ -76,3 +76,31 @@ export const TIMELINE_CONSTANTS = { DEFAULT_TEXT_DURATION: 5, ZOOM_LEVELS: [0.25, 0.5, 1, 1.5, 2, 3, 4], } as const; + +// FPS presets for project settings +export const FPS_PRESETS = [ + { value: "24", label: "24 fps (Film)" }, + { value: "25", label: "25 fps (PAL)" }, + { value: "30", label: "30 fps (NTSC)" }, + { value: "60", label: "60 fps (High)" }, + { value: "120", label: "120 fps (Slow-mo)" }, +] as const; + +// Frame snapping utilities +export function timeToFrame(time: number, fps: number): number { + return Math.round(time * fps); +} + +export function frameToTime(frame: number, fps: number): number { + return frame / fps; +} + +export function snapTimeToFrame(time: number, fps: number): number { + if (fps <= 0) return time; // Fallback for invalid FPS + const frame = timeToFrame(time, fps); + return frameToTime(frame, fps); +} + +export function getFrameDuration(fps: number): number { + return 1 / fps; +} |
