Create professional demos and 3D mockups in seconds, directly in your browser
feat: add types for motion menu
CristianOlivera107d795b7929e
diff --git a/types/control-panel.types.ts b/types/control-panel.types.tsindex 120ad56..5fc7467 100644--- a/types/control-panel.types.ts+++ b/types/control-panel.types.ts@@ -88,4 +88,6 @@ export interface ControlPanelProps {onAddImageToCanvas?: (projectId: string) => void;onDeleteImageProject?: (projectId: string) => void;onUploadImageToHistory?: (file: File) => void;+ /** Which editor mode — determines which motion menu to show */+ mediaType?: "video" | "image";}diff --git a/types/editor.types.ts b/types/editor.types.tsindex 30b44c5..88413b1 100644--- a/types/editor.types.ts+++ b/types/editor.types.ts@@ -2,7 +2,7 @@ import type { ZoomFragment } from "./zoom.types";import type { CanvasElement } from "./canvas-elements.types";import type { CursorConfig, CursorRecordingData } from "./cursor.types";-export type Tool = "screenshot" | "elements" | "audio" | "zoom" | "mockup" | "cursor" | "videos" | "camera" | "history";+export type Tool = "screenshot" | "elements" | "audio" | "zoom" | "mockup" | "cursor" | "videos" | "camera" | "history" | "motion";export type BackgroundTab = "wallpaper" | "image" | "color";@@ -58,6 +58,7 @@ export interface VideoThumbnail {export type MediaType = "video" | "image";export interface VideoCanvasProps {+ activeTool?: string;mediaType?: MediaType;imageUrl?: string | null;imageRef?: React.RefObject<HTMLImageElement | null>;@@ -120,4 +121,5 @@ export interface VideoCanvasProps {textToolActive?: boolean;onTextToolDeactivate?: () => void;onAddElement?: (element: CanvasElement) => void;+ isPlaying?: boolean;}\ No newline at end of filediff --git a/types/motion.types.ts b/types/motion.types.tsnew file mode 100644index 0000000..8b32ec5--- /dev/null+++ b/types/motion.types.ts@@ -0,0 +1,46 @@+// ─── Shared motion types ──────────────────────────────────────────────────────++export type MotionStyle = "smooth" | "normal" | "cinematic";++/** Controls which finite animations play during a video clip */+export type AnimMode = "entry" | "exit" | "entry+exit" | "none" | "static";++/** Animation vector — GSAP tweens this object, Three.js reads it */+export interface AV {+ rx: number;+ ry: number;+ tx: number;+ ty: number;+ sc: number;+}++/** A cinematic script function — returns a repeating GSAP timeline */+export type ScriptFn = (+ av: AV,+ intensity: number, // 0–1+ durMs: number,+ style: MotionStyle,+ onUpdate: () => void,+) => gsap.core.Timeline;++/** What each template declares about itself */+export interface MotionTemplate {+ id: string;+ title: string;+ description: string;+ accentColor: string;+ icon: string;+ tags: string[];+ defaultDuration: number; // ms+ /** If false, shows plain video with no phone overlay */+ showPhone: boolean;+ /** The cinematic script — only defined on templates that have one */+ script?: ScriptFn;+ /** Template-specific editor panel component (lazy-imported by the menu) */+ EditorPanel?: React.ComponentType<EditorPanelProps>;+}++/** Props every EditorPanel receives */+export interface EditorPanelProps {+ template: MotionTemplate;+}\ No newline at end of filediff --git a/types/photo.types.ts b/types/photo.types.tsindex 64f0744..12e9584 100644--- a/types/photo.types.ts+++ b/types/photo.types.ts@@ -11,6 +11,22 @@ export interface Preview3DConfig {perspective?: number;}+export interface PhoneRotationOffset {+ rx: number;+ ry: number;+}++export const PREVIEW_TO_PHONE_OFFSET: Record<string, PhoneRotationOffset> = {+ "front": { rx: 0, ry: 0 },+ "top-left-angle": { rx: 15, ry: -25 },+ "top-right-angle": { rx: 15, ry: 22 },+ "bottom-left-angle": { rx: -15, ry: -25 },+ "bottom-right-angle": { rx: -15, ry: 22 },+ "isometric": { rx: 25, ry: 45 },+ "tilt-up": { rx: 15, ry: 0 },+ "tilt-down": { rx: -15, ry: 0 },+};+export const PREVIEW_CONFIGS: readonly Preview3DConfig[] = Object.freeze([Object.freeze({ id: "front", label: "Front", rotateX: 0, rotateY: 0, rotateZ: 0, translateY: 0, scale: 0.9, perspective: 600 }),Object.freeze({ id: "top-left-angle", label: "Top Left Angle", rotateX: 18, rotateY: 25, rotateZ: -15, translateY: -10, scale: 0.95, perspective: 500 }),