diff options
Diffstat (limited to 'apps/web/src/constants')
| -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; +} |
