Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

ui for custom fps

Dhananjay Borse522dbf03ded4
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsx
index 1834241..c22c53e 100644
--- a/app/[locale]/(editor)/editor/page.tsx
+++ b/app/[locale]/(editor)/editor/page.tsx
@@ -1041,7 +1041,7 @@ export default function Editor() {
const pathname = usePathname();
const router = useRouter();
- const handleExport = useCallback((quality: ExportQuality) => {
+ const handleExport = useCallback((quality: ExportQuality, fps?: number) => {
if (!EDITOR_WITHOUT_AUTH && !authUser) {
savePendingExport(quality);
router.replace({
@@ -1064,6 +1064,7 @@ export default function Editor() {
setIsPlaying(false);
exportVideo({
quality,
+ fps,
videoBlob: videoBlob ?? undefined,
transparentBackground: selectedWallpaper === -1,
trim: trimRange.end > trimRange.start ? { start: trimRange.start, end: trimRange.end } : undefined,
diff --git a/app/components/ui/ExportDropdown.tsx b/app/components/ui/ExportDropdown.tsx
index 80b95fa..504581d 100644
--- a/app/components/ui/ExportDropdown.tsx
+++ b/app/components/ui/ExportDropdown.tsx
@@ -14,14 +14,41 @@ interface ExportProgress {
}
interface ExportDropdownProps {
- onExport: (quality: ExportQuality) => void;
+ onExport: (quality: ExportQuality, fps?: number) => void;
exportProgress: ExportProgress;
hasTransparentBackground?: boolean;
}
+type VideoFormat = "mp4" | "webm" | "gif";
+
+interface QualityOption {
+ id: ExportQuality;
+ label: string;
+ resolution: string;
+ recommended?: boolean;
+ tag?: string;
+}
+
+const QUALITY_OPTIONS: QualityOption[] = [
+ { id: "1080p", label: "1080p Full HD", resolution: "1920 × 1080", recommended: true, tag: "Popular" },
+ { id: "4k", label: "4K Ultra HD", resolution: "3840 × 2160", tag: "Max Clarity" },
+ { id: "2k", label: "2K Quad HD", resolution: "2560 × 1440" },
+ { id: "720p", label: "720p HD", resolution: "1280 × 720" },
+ { id: "480p", label: "480p SD", resolution: "854 × 480" },
+];
+
+const FPS_PRESETS = [
+ { value: 30, label: "30 FPS", desc: "Standard" },
+ { value: 60, label: "60 FPS", desc: "Ultra Smooth", recommended: true },
+ { value: 120, label: "120 FPS", desc: "High Refresh" },
+];
+
export function ExportDropdown({ onExport, exportProgress, hasTransparentBackground }: ExportDropdownProps) {
const t = useTranslations("editor.export");
const [isOpen, setIsOpen] = useState(false);
+ const [selectedFormat, setSelectedFormat] = useState<VideoFormat>("mp4");
+ const [selectedQuality, setSelectedQuality] = useState<ExportQuality>("1080p");
+ const [selectedFps, setSelectedFps] = useState<number>(60);
const isExporting = exportProgress.status !== "idle" &&
exportProgress.status !== "complete" &&
@@ -29,54 +56,21 @@ export function ExportDropdown({ onExport, exportProgress, hasTransparentBackgro
const isTransparent = !!hasTransparentBackground;
- const handleExport = (quality: ExportQuality) => {
+ const handleStartExport = () => {
setIsOpen(false);
- onExport(quality);
+ if (selectedFormat === "gif") {
+ onExport("gif", 24);
+ } else if (selectedFormat === "webm" || isTransparent) {
+ onExport("webm-alpha", selectedFps);
+ } else {
+ onExport(selectedQuality, selectedFps);
+ }
};
- const renderQualityItem = (id: ExportQuality, resolution: string, isRecommended = false) => {
- const isGif = id === "gif";
-
- return (
- <button
- className={`group flex flex-col items-start gap-1.5 p-4 transition-all text-left border-b border-border ${
- isGif ? (isTransparent ? "opacity-80 hover:bg-orange-500/5" : "hover:bg-orange-500/5") :
- (isTransparent ? "hover:bg-cyan-500/5" : "hover:bg-muted")
- }`}
- onClick={() => handleExport(id)}
- aria-label={`Export as ${id.toUpperCase()} ${resolution}`}
- >
- <div className="flex items-center justify-between w-full">
- <span className={`text-sm font-medium transition-colors ${
- isGif ? "text-orange-600 dark:text-orange-400 group-hover:text-orange-300" :
- "text-foreground group-hover:text-blue-400"
- }`}>
- {isTransparent && !isGif ? (
- <>{id.toUpperCase()} WebM · <span className="text-cyan-600 dark:text-cyan-400 group-hover:text-cyan-300">{t("noBackground")}</span></>
- ) : (
- t(`qualities.${id}.label`)
- )}
- </span>
- {isRecommended && !isTransparent && (
- <span className="border border-blue-500/30 text-blue-600 dark:text-blue-400 text-[9px] px-2 py-0.5 rounded-full font-bold tracking-tight">
- {t("recommended")}
- </span>
- )}
- {isGif && isTransparent && (
- <span className="text-[9px] text-red-600 dark:text-red-400/80 font-bold bg-red-500/10 px-2 py-0.5 rounded-full border border-red-500/20">
- {t("solidBackground")}
- </span>
- )}
- </div>
- <span className={`text-[11px] font-mono ${isGif ? "text-orange-600 dark:text-orange-400/70" : "text-muted-foreground"}`}>
- {isTransparent ? (
- <>{resolution} · <span className="text-cyan-600 dark:text-cyan-400/70">{isGif ? t("gifNotice") : "VP9 Alpha"}</span></>
- ) : (
- t(`qualities.${id}.desc`)
- )}
- </span>
- </button>
- );
+ const handleDirectExport = (quality: ExportQuality) => {
+ setIsOpen(false);
+ const fpsToUse = quality === "gif" ? 24 : selectedFps;
+ onExport(quality, fpsToUse);
};
return (
@@ -84,29 +78,202 @@ export function ExportDropdown({ onExport, exportProgress, hasTransparentBackgro
<PopoverTrigger asChild>
<Button
variant="primary"
- className="px-3 py-2 text-sm gap-2 min-w-27.5 text-white"
+ className="px-3.5 py-2 text-sm gap-2 min-w-28 font-medium text-white shadow-sm transition-all hover:brightness-110 active:scale-95"
size="sm"
disabled={isExporting}
aria-label={t("button")}
>
- <Icon icon="icon-park-outline:export" width="18" aria-hidden="true" />
+ <Icon icon="lucide:download" width="16" className="text-white" aria-hidden="true" />
{t("button")}
</Button>
</PopoverTrigger>
- <PopoverContent align="end" className="w-72 bg-popover dark:bg-black border-border text-foreground shadow-2xl p-0 overflow-hidden z-999999">
- <div className="flex flex-col bg-popover dark:bg-black border border-border overflow-hidden shadow-2xl">
- <div className="px-4 py-3 border-b border-border bg-muted">
- <span className="text-[11px] font-medium uppercase tracking-[0.15em] text-muted-foreground">
- {t("title")}
- </span>
+ <PopoverContent
+ align="end"
+ className="w-[370px] p-0 bg-background/95 backdrop-blur-xl border border-border/80 text-foreground shadow-2xl rounded-xl overflow-hidden z-999999"
+ >
+ <div className="flex flex-col">
+ {/* Header */}
+ <div className="px-4 py-3 border-b border-border/60 bg-muted/40 flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <div className="w-6 h-6 rounded-md bg-blue-500/10 text-blue-500 flex items-center justify-center border border-blue-500/20">
+ <Icon icon="lucide:video" width="14" />
+ </div>
+ <span className="text-xs font-semibold uppercase tracking-wider text-foreground">
+ Export Video
+ </span>
+ </div>
+ {isTransparent && (
+ <span className="text-[10px] font-medium px-2 py-0.5 rounded-full bg-cyan-500/10 text-cyan-400 border border-cyan-500/20">
+ Transparent
+ </span>
+ )}
+ </div>
+
+ <div className="p-4 space-y-4">
+ {/* Format Switcher */}
+ <div>
+ <div className="flex items-center justify-between mb-2">
+ <span className="text-xs font-medium text-muted-foreground">Format</span>
+ <span className="text-[10px] text-muted-foreground/70 font-mono">
+ {selectedFormat === "mp4" ? "H.264 · WebCodecs" : selectedFormat === "webm" ? "VP9 · Alpha" : "Animated"}
+ </span>
+ </div>
+ <div className="grid grid-cols-3 gap-1.5 p-1 bg-muted/50 rounded-lg border border-border/50">
+ <button
+ type="button"
+ onClick={() => setSelectedFormat("mp4")}
+ className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
+ selectedFormat === "mp4"
+ ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <Icon icon="mdi:video" width="14" className={selectedFormat === "mp4" ? "text-blue-500" : ""} />
+ MP4
+ </button>
+ <button
+ type="button"
+ onClick={() => setSelectedFormat("webm")}
+ className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
+ selectedFormat === "webm"
+ ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <Icon icon="mdi:web" width="14" className={selectedFormat === "webm" ? "text-cyan-500" : ""} />
+ WebM
+ </button>
+ <button
+ type="button"
+ onClick={() => setSelectedFormat("gif")}
+ className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
+ selectedFormat === "gif"
+ ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <Icon icon="mdi:file-gif-box" width="14" className={selectedFormat === "gif" ? "text-orange-500" : ""} />
+ GIF
+ </button>
+ </div>
+ </div>
+
+ {/* Framerate Selection (FPS) */}
+ {selectedFormat !== "gif" && (
+ <div>
+ <div className="flex items-center justify-between mb-2">
+ <div className="flex items-center gap-1.5">
+ <span className="text-xs font-medium text-muted-foreground">Framerate</span>
+ <span className="text-[10px] text-blue-500/90 font-medium">✨ Smooth Scroll</span>
+ </div>
+ <span className="text-[10px] text-muted-foreground/70">
+ {selectedFps === 120 ? "120/144Hz Native" : selectedFps === 60 ? "Fluid 60 FPS" : "Standard 30 FPS"}
+ </span>
+ </div>
+ <div className="grid grid-cols-3 gap-1.5">
+ {FPS_PRESETS.map((preset) => {
+ const isSelected = selectedFps === preset.value;
+ return (
+ <button
+ key={preset.value}
+ type="button"
+ onClick={() => setSelectedFps(preset.value)}
+ className={`p-2 rounded-lg border text-left transition-all relative ${
+ isSelected
+ ? "border-blue-500/60 bg-blue-500/10 text-foreground shadow-sm ring-1 ring-blue-500/30"
+ : "border-border/60 bg-card/40 hover:bg-muted/60 text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <div className="flex items-center justify-between">
+ <span className={`text-xs font-bold ${isSelected ? "text-blue-500 dark:text-blue-400" : ""}`}>
+ {preset.label}
+ </span>
+ {preset.recommended && (
+ <span className="w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse" />
+ )}
+ </div>
+ <span className="text-[10px] text-muted-foreground block mt-0.5 leading-tight">
+ {preset.desc}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ )}
+
+ {/* Resolution Selector */}
+ {selectedFormat !== "gif" ? (
+ <div>
+ <div className="flex items-center justify-between mb-2">
+ <span className="text-xs font-medium text-muted-foreground">Resolution</span>
+ <span className="text-[10px] text-muted-foreground/70">Aspect 16:9</span>
+ </div>
+ <div className="space-y-1.5 max-h-48 overflow-y-auto custom-scrollbar pr-1">
+ {QUALITY_OPTIONS.map((opt) => {
+ const isSelected = selectedQuality === opt.id;
+ return (
+ <button
+ key={opt.id}
+ type="button"
+ onClick={() => {
+ setSelectedQuality(opt.id);
+ }}
+ className={`w-full flex items-center justify-between p-2.5 rounded-lg border text-left transition-all ${
+ isSelected
+ ? "border-primary/60 bg-primary/10 text-foreground ring-1 ring-primary/20"
+ : "border-border/40 hover:border-border/80 hover:bg-muted/40 text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <div className="flex items-center gap-2.5">
+ <div className={`w-2 h-2 rounded-full ${isSelected ? "bg-primary" : "bg-muted-foreground/40"}`} />
+ <div>
+ <div className="flex items-center gap-1.5">
+ <span className={`text-xs font-semibold ${isSelected ? "text-foreground" : ""}`}>
+ {opt.label}
+ </span>
+ {opt.tag && (
+ <span className="text-[9px] px-1.5 py-0.2 rounded font-medium bg-muted text-muted-foreground border border-border/40">
+ {opt.tag}
+ </span>
+ )}
+ </div>
+ <span className="text-[10px] font-mono text-muted-foreground/80 block">
+ {opt.resolution}
+ </span>
+ </div>
+ </div>
+ <span className="text-[10px] font-mono font-medium px-2 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/40">
+ {selectedFps} fps
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ ) : (
+ <div className="p-3 rounded-lg border border-orange-500/20 bg-orange-500/5 text-orange-400 space-y-1">
+ <div className="flex items-center gap-1.5 text-xs font-semibold text-orange-400">
+ <Icon icon="mdi:information-outline" width="16" />
+ GIF Animated Export
+ </div>
+ <p className="text-[11px] text-orange-400/80 leading-relaxed">
+ Exporting as an animated GIF renders at 720p (24 fps) without audio, ideal for embeds, GitHub, and documentation.
+ </p>
+ </div>
+ )}
</div>
- <div className="flex flex-col max-h-120 overflow-y-auto custom-scrollbar">
- {renderQualityItem("4k", "3840 × 2160")}
- {renderQualityItem("2k", "2560 × 1440")}
- {renderQualityItem("1080p", "1920 × 1080", true)}
- {renderQualityItem("720p", "1280 × 720")}
- {renderQualityItem("480p", "854 × 480")}
- {renderQualityItem("gif", "1280 × 720")}
+
+ {/* Footer Action */}
+ <div className="p-3 border-t border-border/60 bg-muted/30 flex items-center gap-2">
+ <Button
+ onClick={handleStartExport}
+ variant="primary"
+ className="w-full py-2.5 text-xs font-semibold gap-2 shadow-md hover:brightness-105 active:scale-[0.98] transition-all"
+ >
+ <Icon icon="lucide:arrow-down-circle" width="16" />
+ Export {selectedFormat.toUpperCase()} ({selectedFormat === "gif" ? "720p · 24fps" : `${selectedQuality.toUpperCase()} · ${selectedFps}fps`})
+ </Button>
</div>
</div>
</PopoverContent>
diff --git a/app/components/ui/editor/EditorTopBar.tsx b/app/components/ui/editor/EditorTopBar.tsx
index b3bfa21..4f07526 100644
--- a/app/components/ui/editor/EditorTopBar.tsx
+++ b/app/components/ui/editor/EditorTopBar.tsx
@@ -23,7 +23,7 @@ interface ImageExportProgress {
}
interface EditorTopBarProps {
- onExport: (quality: ExportQuality) => void;
+ onExport: (quality: ExportQuality, fps?: number) => void;
exportProgress: ExportProgress;
hasTransparentBackground?: boolean;
onUndo?: () => void;
diff --git a/claude.md b/claude.md
index 08733da..c7cc9e9 100644
--- a/claude.md
+++ b/claude.md
@@ -299,4 +299,14 @@ Cada `ZoomFragmentTrackItem` expone `role="slider"` con `aria-valuemin/max/now`
| `canAddFragmentAt`, `findValidFragmentPosition` | `ZoomFragmentTrackItem.tsx:280,330` |
| Row de zoom + ghost preview + add | `app/components/ui/editor/Timeline.tsx:560-630` |
| `ZoomGlobalConfig` lista de fragmentos | `app/components/ui/editor/ZoomGlobalConfig.tsx` |
-| `ZoomFragmentEditor` (foco, movement, 3D) | `app/components/ui/editor/ZoomFragmentEditor.tsx` |
\ No newline at end of file
+| `ZoomFragmentEditor` (foco, movement, 3D) | `app/components/ui/editor/ZoomFragmentEditor.tsx` |
+
+<!-- BEGIN:nextjs-agent-rules -->
+
+# This is NOT the Next.js you know
+
+This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
+
+This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
+
+<!-- END:nextjs-agent-rules -->
diff --git a/lib/constants.ts b/lib/constants.ts
index 24a54d6..f55422c 100644
--- a/lib/constants.ts
+++ b/lib/constants.ts
@@ -4,19 +4,19 @@ export const EXPORT_WIDTH = 1920;
export const EXPORT_HEIGHT = 1080;
export const QUALITY_SETTINGS: Record<string, QualitySettings> = {
- "4k": { width: 3840, height: 2160, bitrate: 40_000_000, fps: 30 },
- "2k": { width: 2560, height: 1440, bitrate: 16_000_000, fps: 30 },
- "1080p": { width: 1920, height: 1080, bitrate: 8_000_000, fps: 30 },
- "720p": { width: 1280, height: 720, bitrate: 5_000_000, fps: 30 },
- "480p": { width: 854, height: 480, bitrate: 2_500_000, fps: 24 },
+ "4k": { width: 3840, height: 2160, bitrate: 45_000_000, fps: 60 },
+ "2k": { width: 2560, height: 1440, bitrate: 20_000_000, fps: 60 },
+ "1080p": { width: 1920, height: 1080, bitrate: 12_000_000, fps: 60 },
+ "720p": { width: 1280, height: 720, bitrate: 6_000_000, fps: 60 },
+ "480p": { width: 854, height: 480, bitrate: 2_500_000, fps: 30 },
"gif": { width: 1280, height: 720, bitrate: 2_500_000, fps: 24 },
- "webm-alpha": { width: 1280, height: 720, bitrate: 2_000_000, fps: 24 },
+ "webm-alpha": { width: 1280, height: 720, bitrate: 4_000_000, fps: 60 },
};
/**
* FPS por defecto para exportación (fallback)
*/
-export const DEFAULT_EXPORT_FPS = 30;
+export const DEFAULT_EXPORT_FPS = 60;
/**
* Ancho de referencia del contenedor de preview (max-w-4xl en Tailwind)