Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

444 B
Raw Blame
/** One frame in seconds at 60 FPS (~16.67ms). */
export const FRAME_DURATION_SEC = 1 / 60;

/** New playhead time after stepping one frame, clamped to [0, duration]. */
export function computeFrameStepTime(
	currentTime: number,
	duration: number,
	direction: "forward" | "backward",
): number {
	const delta = direction === "forward" ? FRAME_DURATION_SEC : -FRAME_DURATION_SEC;
	return Math.min(duration, Math.max(0, currentTime + delta));
}