Initial release of PDEV AI Video Studio
This commit is contained in:
commit
754c56c478
19 files changed
+11121
No files matched your search
@@ -0,0 +1,4 @@
|
||||
# Optional: enables real AI storyboard generation. Without it, the local generator is used.
|
||||
OPENAI_API_KEY=
|
||||
OPENAI_MODEL=gpt-4.1-mini
|
||||
PORT=4318
|
||||
@@ -0,0 +1,7 @@
|
||||
node_modules/
|
||||
dist/
|
||||
out/
|
||||
release/
|
||||
.env
|
||||
.env.local
|
||||
*.log
|
||||
@@ -0,0 +1,46 @@
|
||||
# PDEV AI Video Studio
|
||||
|
||||
Ein visueller, datengetriebener Video-Editor mit Remotion. Prompt, Live-Editor und MP4-Render verwenden dasselbe Projektmodell, damit die Vorschau dem Export entspricht.
|
||||
|
||||
## Start
|
||||
|
||||
Unter Windows `start-studio.cmd` ausfuehren. Das Studio oeffnet sich unter `http://localhost:4317`, der Render-Server laeuft unter `http://localhost:4318`.
|
||||
|
||||
Alternativ nach einer funktionierenden npm-Installation:
|
||||
|
||||
```powershell
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Funktionen
|
||||
|
||||
- Prompt-zu-Storyboard mit lokalem Generator oder optional OpenAI
|
||||
- Live-Vorschau mit Remotion Player
|
||||
- Sechs Szenenlayouts und direkter Text-, Farb- und Timing-Editor
|
||||
- Timeline, Scrubbing, Szenenreihenfolge, Duplizieren sowie Undo/Redo
|
||||
- Hochformat, Querformat und Quadrat mit 24, 30 oder 60 FPS
|
||||
- Projekt-Export als JSON und serverseitiger MP4-Render
|
||||
- Responsive Desktop- und Mobile-Oberflaeche
|
||||
|
||||
## Optionale KI
|
||||
|
||||
`.env.example` nach `.env` kopieren und `OPENAI_API_KEY` setzen. Ohne Key bleibt der lokale Storyboard-Generator voll funktionsfaehig.
|
||||
|
||||
## Produktion
|
||||
|
||||
```powershell
|
||||
npm run build
|
||||
$env:NODE_ENV="production"
|
||||
node server.mjs
|
||||
```
|
||||
|
||||
Gerenderte Videos landen unter `out/`.
|
||||
|
||||
## Desktop-App und Installer
|
||||
|
||||
```powershell
|
||||
npm run desktop
|
||||
npm run dist:win
|
||||
```
|
||||
|
||||
Der Windows-Installer wird unter `release/` erstellt. In der installierten Desktop-App landen gerenderte Videos unter `Videos/PDEV AI Video Studio/`.
|
||||
@@ -0,0 +1,86 @@
|
||||
const {app, BrowserWindow, dialog, shell} = require("electron");
|
||||
const path = require("node:path");
|
||||
const {pathToFileURL} = require("node:url");
|
||||
|
||||
const PORT = 4321;
|
||||
let mainWindow;
|
||||
|
||||
const waitForServer = async () => {
|
||||
for (let attempt = 0; attempt < 80; attempt++) {
|
||||
try {
|
||||
const response = await fetch(`http://127.0.0.1:${PORT}/api/health`);
|
||||
if (response.ok) return;
|
||||
} catch {}
|
||||
await new Promise((resolve) => setTimeout(resolve, 150));
|
||||
}
|
||||
throw new Error("Der lokale PDEV-Server konnte nicht gestartet werden.");
|
||||
};
|
||||
|
||||
const startServer = async () => {
|
||||
const projectRoot = path.join(__dirname, "..");
|
||||
const resourceRoot = app.isPackaged ? process.resourcesPath : projectRoot;
|
||||
process.env.NODE_ENV = "production";
|
||||
process.env.PDEV_DESKTOP = "1";
|
||||
process.env.PORT = String(PORT);
|
||||
process.env.PDEV_APP_ROOT = projectRoot;
|
||||
process.env.PDEV_OUTPUT_DIR = path.join(app.getPath("videos"), "PDEV AI Video Studio");
|
||||
process.env.PDEV_REMOTION_ENTRY = app.isPackaged
|
||||
? path.join(resourceRoot, "remotion-src", "index.ts")
|
||||
: path.join(projectRoot, "src", "remotion", "index.ts");
|
||||
await import(pathToFileURL(path.join(projectRoot, "server.mjs")).href);
|
||||
await waitForServer();
|
||||
};
|
||||
|
||||
const createWindow = () => {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1540,
|
||||
height: 980,
|
||||
minWidth: 1080,
|
||||
minHeight: 720,
|
||||
backgroundColor: "#080a0f",
|
||||
title: "PDEV AI Video Studio",
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
},
|
||||
});
|
||||
mainWindow.loadURL(`http://127.0.0.1:${PORT}`);
|
||||
mainWindow.once("ready-to-show", () => mainWindow.show());
|
||||
mainWindow.webContents.setWindowOpenHandler(({url}) => {
|
||||
if (url.startsWith(`http://127.0.0.1:${PORT}/renders/`)) return {action: "allow"};
|
||||
shell.openExternal(url);
|
||||
return {action: "deny"};
|
||||
});
|
||||
mainWindow.webContents.on("will-navigate", (event, url) => {
|
||||
if (!url.startsWith(`http://127.0.0.1:${PORT}`)) {
|
||||
event.preventDefault();
|
||||
shell.openExternal(url);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (!app.requestSingleInstanceLock()) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on("second-instance", () => {
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
}
|
||||
});
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
try {
|
||||
await startServer();
|
||||
createWindow();
|
||||
} catch (error) {
|
||||
dialog.showErrorBox("PDEV AI Video Studio", error instanceof Error ? error.message : String(error));
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
app.on("window-all-closed", () => app.quit());
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#080a0f" />
|
||||
<title>PDEV AI Video Studio</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+9680
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "pdev-ai-video-studio",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "electron/main.cjs",
|
||||
"scripts": {
|
||||
"dev": "concurrently -k \"npm:dev:web\" \"npm:dev:server\"",
|
||||
"dev:web": "vite",
|
||||
"dev:server": "node --watch server.mjs",
|
||||
"build": "tsc --noEmit && vite build",
|
||||
"desktop": "electron electron/main.cjs",
|
||||
"dist:win": "tsc --noEmit && vite build && electron-builder --win nsis",
|
||||
"start": "node server.mjs",
|
||||
"studio": "remotion studio src/remotion/index.ts",
|
||||
"render": "remotion render src/remotion/index.ts PDEVVideo out/pdev-video.mp4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@remotion/bundler": "4.0.540",
|
||||
"@remotion/cli": "4.0.540",
|
||||
"@remotion/player": "4.0.540",
|
||||
"@remotion/renderer": "4.0.540",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "16.4.7",
|
||||
"express": "^5.1.0",
|
||||
"lucide-react": "^0.468.0",
|
||||
"react": "19.1.0",
|
||||
"react-dom": "19.1.0",
|
||||
"remotion": "4.0.540"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^5.0.3",
|
||||
"@types/react": "19.1.8",
|
||||
"@types/react-dom": "19.1.6",
|
||||
"@vitejs/plugin-react": "^4.5.2",
|
||||
"concurrently": "^9.2.0",
|
||||
"typescript": "5.8.3",
|
||||
"vite": "^6.3.5"
|
||||
,"electron": "^39.2.1",
|
||||
"electron-builder": "^26.0.12"
|
||||
},
|
||||
"build": {
|
||||
"appId": "de.pdev.aivideostudio",
|
||||
"productName": "PDEV AI Video Studio",
|
||||
"artifactName": "PDEV-AI-Video-Studio-Setup-${version}.${ext}",
|
||||
"directories": {
|
||||
"output": "release"
|
||||
},
|
||||
"files": [
|
||||
"dist/**/*",
|
||||
"electron/**/*",
|
||||
"server.mjs",
|
||||
"package.json"
|
||||
],
|
||||
"extraResources": [
|
||||
{"from": "src/remotion", "to": "remotion-src"},
|
||||
{"from": "src/types.ts", "to": "types.ts"}
|
||||
],
|
||||
"asarUnpack": [
|
||||
"node_modules/@remotion/**/*",
|
||||
"node_modules/remotion/**/*"
|
||||
],
|
||||
"win": {
|
||||
"target": ["nsis"]
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"createDesktopShortcut": true,
|
||||
"createStartMenuShortcut": true,
|
||||
"shortcutName": "PDEV AI Video Studio",
|
||||
"deleteAppDataOnUninstall": false
|
||||
}
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
import "dotenv/config";
|
||||
import cors from "cors";
|
||||
import express from "express";
|
||||
import {mkdir, writeFile} from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import {fileURLToPath} from "node:url";
|
||||
import {bundle} from "@remotion/bundler";
|
||||
import {renderMedia, selectComposition} from "@remotion/renderer";
|
||||
|
||||
const root = path.dirname(fileURLToPath(import.meta.url));
|
||||
const appRoot = process.env.PDEV_APP_ROOT || root;
|
||||
const outputDir = process.env.PDEV_OUTPUT_DIR || path.join(root, "out");
|
||||
const mediaDir = process.env.PDEV_MEDIA_DIR || path.join(outputDir, "media");
|
||||
const remotionEntry = process.env.PDEV_REMOTION_ENTRY || path.join(root, "src/remotion/index.ts");
|
||||
const app = express();
|
||||
const port = Number(process.env.PORT || 4318);
|
||||
const jobs = new Map();
|
||||
let bundlePromise;
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json({limit: "10mb"}));
|
||||
app.use("/renders", express.static(outputDir));
|
||||
app.use("/media", express.static(mediaDir, {acceptRanges: true}));
|
||||
app.get("/api/health", (_req, res) => res.json({status: "ok", desktop: Boolean(process.env.PDEV_DESKTOP)}));
|
||||
|
||||
app.post("/api/media", express.raw({type: "application/octet-stream", limit: "2gb"}), async (req, res) => {
|
||||
try {
|
||||
const original = decodeURIComponent(String(req.headers["x-file-name"] || "media.mp4"));
|
||||
const extension = path.extname(original).replace(/[^.a-zA-Z0-9]/g, "").slice(0, 10) || ".mp4";
|
||||
const base = path.basename(original, path.extname(original)).replace(/[^a-zA-Z0-9_-]+/g, "-").slice(0, 60) || "media";
|
||||
const fileName = `${Date.now()}-${base}${extension}`;
|
||||
await mkdir(mediaDir, {recursive: true});
|
||||
await writeFile(path.join(mediaDir, fileName), req.body);
|
||||
res.json({name: original, url: `${req.protocol}://${req.get("host")}/media/${encodeURIComponent(fileName)}`, size: req.body.length});
|
||||
} catch (error) {
|
||||
res.status(500).json({error: error instanceof Error ? error.message : String(error)});
|
||||
}
|
||||
});
|
||||
|
||||
const fallbackStoryboard = (prompt) => {
|
||||
const subject = prompt.trim().replace(/\s+/g, " ").slice(0, 90) || "Deine nächste große Idee";
|
||||
return [
|
||||
{layout: "hero", eyebrow: "DER HOOK", title: subject, body: "Eine Geschichte, die in der ersten Sekunde Aufmerksamkeit gewinnt.", accent: "#8b5cf6", duration: 3.5},
|
||||
{layout: "split", eyebrow: "DAS PROBLEM", title: "Komplex muss nicht kompliziert wirken.", body: "Wir reduzieren die Botschaft auf das, was wirklich hängen bleibt.", accent: "#2dd4bf", duration: 4},
|
||||
{layout: "steps", eyebrow: "DER WEG", title: "Idee. Bewegung. Wirkung.", body: "Ein klarer visueller Rhythmus führt durch die Story.", accent: "#38bdf8", duration: 4.5},
|
||||
{layout: "stat", eyebrow: "DER BEWEIS", title: "3x", body: "Stärkere Botschaft durch präzises Timing, Kontrast und Fokus.", accent: "#f59e0b", duration: 3.5},
|
||||
{layout: "outro", eyebrow: "READY TO CREATE", title: "Mach die Idee sichtbar.", body: "PDEV AI Video Studio", accent: "#8b5cf6", duration: 3.5}
|
||||
].map((scene, index) => ({...scene, id: `ai-${Date.now()}-${index}`}));
|
||||
};
|
||||
|
||||
app.post("/api/generate", async (req, res) => {
|
||||
const prompt = String(req.body?.prompt || "");
|
||||
if (!process.env.OPENAI_API_KEY) return res.json({scenes: fallbackStoryboard(prompt), source: "local"});
|
||||
try {
|
||||
const response = await fetch("https://api.openai.com/v1/chat/completions", {method: "POST", headers: {"Content-Type": "application/json", Authorization: `Bearer ${process.env.OPENAI_API_KEY}`}, body: JSON.stringify({model: process.env.OPENAI_MODEL || "gpt-4.1-mini", response_format: {type: "json_object"}, messages: [{role: "system", content: "Du bist Creative Director für kurze Social Videos. Antworte nur als JSON {scenes:[...]}. Erzeuge 4-7 deutsche Szenen. Jede Szene braucht layout (hero|split|stat|steps|quote|outro), eyebrow, title, body, accent als Hexfarbe und duration zwischen 2 und 8 Sekunden."}, {role: "user", content: prompt}]})});
|
||||
if (!response.ok) throw new Error(`OpenAI ${response.status}`);
|
||||
const data = await response.json();
|
||||
const parsed = JSON.parse(data.choices[0].message.content);
|
||||
const scenes = parsed.scenes.map((scene, index) => ({...scene, id: `ai-${Date.now()}-${index}`}));
|
||||
res.json({scenes, source: "openai"});
|
||||
} catch (error) {
|
||||
res.json({scenes: fallbackStoryboard(prompt), source: "fallback", warning: error.message});
|
||||
}
|
||||
});
|
||||
|
||||
app.post("/api/render", async (req, res) => {
|
||||
const project = req.body?.project;
|
||||
if (!project || (project.activeMode === "cut" ? !project.clips?.length : !project.scenes?.length)) {
|
||||
return res.status(400).json({error: project?.activeMode === "cut" ? "Die Sequenz enthält keine Clips." : "Das Projekt enthält keine Szenen."});
|
||||
}
|
||||
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
||||
jobs.set(id, {status: "queued", progress: 0});
|
||||
res.status(202).json({id});
|
||||
try {
|
||||
jobs.set(id, {status: "bundling", progress: 0.03});
|
||||
bundlePromise ||= bundle({entryPoint: remotionEntry, webpackOverride: (config) => config});
|
||||
const serveUrl = await bundlePromise;
|
||||
const [width, height] = project.format === "16:9" ? [1920, 1080] : project.format === "1:1" ? [1080, 1080] : [1080, 1920];
|
||||
const durationSeconds = project.activeMode === "cut"
|
||||
? Math.max(1, ...project.clips.map((clip) => Number(clip.start) + (Number(clip.sourceEnd) - Number(clip.sourceStart)) / Math.max(0.1, Number(clip.speed))))
|
||||
: project.scenes.reduce((sum, scene) => sum + Number(scene.duration), 0);
|
||||
const durationInFrames = Math.max(1, Math.round(durationSeconds * project.fps));
|
||||
const composition = await selectComposition({serveUrl, id: "PDEVVideo", inputProps: project});
|
||||
await mkdir(outputDir, {recursive: true});
|
||||
const fileName = `pdev-${id}.mp4`;
|
||||
jobs.set(id, {status: "rendering", progress: 0.08});
|
||||
await renderMedia({composition: {...composition, width, height, durationInFrames, fps: project.fps}, serveUrl, codec: "h264", outputLocation: path.join(outputDir, fileName), inputProps: project, onProgress: ({progress}) => jobs.set(id, {status: "rendering", progress: 0.08 + progress * 0.92})});
|
||||
jobs.set(id, {status: "done", progress: 1, url: `/renders/${fileName}`});
|
||||
} catch (error) {
|
||||
jobs.set(id, {status: "error", progress: 0, error: error instanceof Error ? error.message : String(error)});
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/api/render/:id", (req, res) => {
|
||||
const job = jobs.get(req.params.id);
|
||||
if (!job) return res.status(404).json({error: "Render-Job nicht gefunden."});
|
||||
res.json(job);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
app.use(express.static(path.join(appRoot, "dist")));
|
||||
app.use((_req, res) => res.sendFile(path.join(appRoot, "dist/index.html")));
|
||||
}
|
||||
|
||||
app.listen(port, () => console.log(`PDEV render server: http://localhost:${port}`));
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import {Player, type PlayerRef} from "@remotion/player";
|
||||
import {Bot, Box, Check, ChevronDown, ChevronLeft, ChevronRight, Clapperboard, Copy, Diamond, Download, Eye, EyeOff, Film, GripVertical, Image, Layers3, Lock, MonitorPlay, MousePointer2, Pause, Play, Plus, Redo2, Save, Scissors, Sparkles, Trash2, Type, Undo2, Unlock, WandSparkles, X, Zap} from "lucide-react";
|
||||
import {PDEVVideo} from "./remotion/Video";
|
||||
import {CutEditor} from "./CutEditor";
|
||||
import {defaultProject, dimensions, normalizeProject, projectFrames, type AnimatableProperty, type AspectRatio, type EffectType, type EntranceType, type SceneEffect, type SceneLayout, type TransitionType, type VideoLayer, type VideoProject, type VideoScene} from "./types";
|
||||
|
||||
const layouts: {value: SceneLayout; label: string}[] = [
|
||||
{value: "hero", label: "Hero"}, {value: "split", label: "Split"}, {value: "stat", label: "Stat"},
|
||||
{value: "steps", label: "Steps"}, {value: "quote", label: "Quote"}, {value: "outro", label: "Outro"}
|
||||
];
|
||||
|
||||
const effectPresets: {type: EffectType; name: string; description: string; color: string; amount: number; speed: number}[] = [
|
||||
{type: "bloom", name: "Neon Bloom", description: "Leuchtender Lichtsaum", color: "#8b5cf6", amount: 45, speed: 20},
|
||||
{type: "grain", name: "Film Grain", description: "Analoge Filmstruktur", color: "#ffffff", amount: 22, speed: 70},
|
||||
{type: "vignette", name: "Vignette", description: "Cinematic Edge Falloff", color: "#000000", amount: 62, speed: 0},
|
||||
{type: "scanlines", name: "CRT Scanlines", description: "Digitales Displayraster", color: "#60a5fa", amount: 36, speed: 45},
|
||||
{type: "chromatic", name: "RGB Split", description: "Chromatische Kanten", color: "#ff1744", amount: 32, speed: 75},
|
||||
{type: "particles", name: "Particles", description: "Animiertes Partikelfeld", color: "#a78bfa", amount: 48, speed: 38},
|
||||
{type: "shake", name: "Camera Shake", description: "Handheld Bewegung", color: "#ffffff", amount: 20, speed: 42},
|
||||
{type: "drift", name: "Camera Drift", description: "Langsame Kamerafahrt", color: "#ffffff", amount: 35, speed: 25},
|
||||
];
|
||||
|
||||
const clone = <T,>(value: T): T => JSON.parse(JSON.stringify(value));
|
||||
const seconds = (value: number) => `${Math.floor(value / 60)}:${String(Math.floor(value % 60)).padStart(2, "0")}`;
|
||||
|
||||
export function App() {
|
||||
const [project, setProject] = useState<VideoProject>(() => {
|
||||
const saved = localStorage.getItem("pdev-video-project");
|
||||
return saved ? normalizeProject(JSON.parse(saved)) : clone(defaultProject);
|
||||
});
|
||||
const [selectedId, setSelectedId] = useState(project.scenes[0]?.id ?? "");
|
||||
const [tab, setTab] = useState<"scenes" | "layers" | "effects" | "design">("scenes");
|
||||
const [selectedLayerId, setSelectedLayerId] = useState<string | null>(null);
|
||||
const [prompt, setPrompt] = useState("Erstelle einen dynamischen Launch-Trailer für eine neue Software, die Teams Zeit spart.");
|
||||
const [generating, setGenerating] = useState(false);
|
||||
const [renderJob, setRenderJob] = useState<{id?: string; status: string; progress: number; url?: string; error?: string} | null>(null);
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [frame, setFrame] = useState(0);
|
||||
const [timelineZoom, setTimelineZoom] = useState(120);
|
||||
const [history, setHistory] = useState<VideoProject[]>([]);
|
||||
const [future, setFuture] = useState<VideoProject[]>([]);
|
||||
const player = useRef<PlayerRef>(null);
|
||||
const stage = useRef<HTMLDivElement>(null);
|
||||
const timelineContent = useRef<HTMLDivElement>(null);
|
||||
const scene = project.scenes.find((item) => item.id === selectedId) ?? project.scenes[0];
|
||||
const selectedLayer = scene?.layers.find((item) => item.id === selectedLayerId) ?? null;
|
||||
const sceneStart = project.scenes.slice(0, Math.max(0, project.scenes.findIndex((item) => item.id === scene?.id))).reduce((sum, item) => sum + item.duration, 0);
|
||||
const localTime = Math.max(0, Math.min(scene?.duration ?? 0, frame / project.fps - sceneStart));
|
||||
const size = dimensions[project.format];
|
||||
const totalFrames = projectFrames(project);
|
||||
const totalSeconds = totalFrames / project.fps;
|
||||
const layerTracks = project.scenes.flatMap((item, sceneIndex) => {
|
||||
const offset = project.scenes.slice(0, sceneIndex).reduce((sum, previous) => sum + previous.duration, 0);
|
||||
return item.layers.map((layer) => ({scene: item, layer, offset}));
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const current = player.current;
|
||||
if (!current) return;
|
||||
const onFrame = (event: {detail: {frame: number}}) => setFrame(event.detail.frame);
|
||||
const onPlay = () => setIsPlaying(true);
|
||||
const onPause = () => setIsPlaying(false);
|
||||
current.addEventListener("frameupdate", onFrame);
|
||||
current.addEventListener("play", onPlay);
|
||||
current.addEventListener("pause", onPause);
|
||||
return () => {
|
||||
current.removeEventListener("frameupdate", onFrame);
|
||||
current.removeEventListener("play", onPlay);
|
||||
current.removeEventListener("pause", onPause);
|
||||
};
|
||||
}, [project.format]);
|
||||
|
||||
const commit = (next: VideoProject) => {
|
||||
setHistory((items) => [...items.slice(-29), clone(project)]);
|
||||
setFuture([]);
|
||||
setProject(normalizeProject(next));
|
||||
};
|
||||
|
||||
const patchProject = (patch: Partial<VideoProject>) => commit({...project, ...patch});
|
||||
const patchScene = (patch: Partial<VideoScene>) => commit({...project, scenes: project.scenes.map((item) => item.id === selectedId ? {...item, ...patch} : item)});
|
||||
const patchMotion = (patch: Partial<VideoScene["motion"]>) => scene && patchScene({motion: {...scene.motion, ...patch}});
|
||||
const addEffect = (preset: typeof effectPresets[number]) => {
|
||||
if (!scene) return;
|
||||
const next: SceneEffect = {...preset, id: crypto.randomUUID(), enabled: true};
|
||||
patchScene({effects: [...scene.effects, next]});
|
||||
};
|
||||
const patchEffect = (id: string, patch: Partial<SceneEffect>) => scene && patchScene({effects: scene.effects.map((item) => item.id === id ? {...item, ...patch} : item)});
|
||||
const removeEffect = (id: string) => scene && patchScene({effects: scene.effects.filter((item) => item.id !== id)});
|
||||
const patchLayer = (id: string, patch: Partial<VideoLayer>) => scene && patchScene({layers: scene.layers.map((item) => item.id === id ? {...item, ...patch} : item)});
|
||||
const patchLayerInScene = (sceneId: string, id: string, patch: Partial<VideoLayer>) => commit({...project, scenes: project.scenes.map((item) => item.id === sceneId ? {...item, layers: item.layers.map((layer) => layer.id === id ? {...layer, ...patch} : layer)} : item)});
|
||||
const createLayer = (type: VideoLayer["type"], source = "") => {
|
||||
if (!scene) return;
|
||||
const layer: VideoLayer = {id: crypto.randomUUID(), type, name: type === "text" ? "Text Layer" : type === "shape" ? "Shape Layer" : "Image Layer", visible: true, locked: false, x: 50, y: 50, width: type === "text" ? 70 : 32, height: type === "text" ? 14 : 22, scale: 100, rotation: 0, opacity: 100, start: 0, end: scene.duration, text: "NEW TEXT", source, color: type === "shape" ? scene.accent : "#ffffff", fontSize: type === "text" ? 88 : 40, borderRadius: type === "shape" ? 24 : 0, blendMode: "normal", keyframes: []};
|
||||
patchScene({layers: [...scene.layers, layer]});
|
||||
setSelectedLayerId(layer.id);
|
||||
setTab("layers");
|
||||
};
|
||||
const importImage = (file?: File) => {
|
||||
if (!file) return;
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => createLayer("image", String(reader.result));
|
||||
reader.readAsDataURL(file);
|
||||
};
|
||||
const deleteLayer = () => {
|
||||
if (!scene || !selectedLayer) return;
|
||||
patchScene({layers: scene.layers.filter((item) => item.id !== selectedLayer.id)});
|
||||
setSelectedLayerId(null);
|
||||
};
|
||||
const addKeyframe = (property: AnimatableProperty) => {
|
||||
if (!selectedLayer) return;
|
||||
const existing = selectedLayer.keyframes.find((key) => key.property === property && Math.abs(key.time - localTime) < 0.04);
|
||||
const value = selectedLayer[property];
|
||||
const keyframes = existing ? selectedLayer.keyframes.map((key) => key.id === existing.id ? {...key, value} : key) : [...selectedLayer.keyframes, {id: crypto.randomUUID(), property, time: Number(localTime.toFixed(3)), value, easing: "ease-in-out" as const}];
|
||||
patchLayer(selectedLayer.id, {keyframes});
|
||||
};
|
||||
const removeKeyframe = (id: string) => selectedLayer && patchLayer(selectedLayer.id, {keyframes: selectedLayer.keyframes.filter((key) => key.id !== id)});
|
||||
const beginLayerDrag = (event: React.PointerEvent) => {
|
||||
if (!selectedLayer || selectedLayer.locked || !stage.current) return;
|
||||
event.preventDefault();
|
||||
player.current?.pause();
|
||||
const initial = clone(project);
|
||||
const rect = stage.current.getBoundingClientRect();
|
||||
const move = (pointer: PointerEvent) => {
|
||||
const x = Math.max(0, Math.min(100, (pointer.clientX - rect.left) / rect.width * 100));
|
||||
const y = Math.max(0, Math.min(100, (pointer.clientY - rect.top) / rect.height * 100));
|
||||
setProject((current) => ({...current, scenes: current.scenes.map((item) => item.id === selectedId ? {...item, layers: item.layers.map((layer) => layer.id === selectedLayer.id ? {...layer, x, y} : layer)} : item)}));
|
||||
};
|
||||
const up = () => {
|
||||
window.removeEventListener("pointermove", move);
|
||||
window.removeEventListener("pointerup", up);
|
||||
setHistory((items) => [...items.slice(-29), initial]);
|
||||
setFuture([]);
|
||||
};
|
||||
window.addEventListener("pointermove", move);
|
||||
window.addEventListener("pointerup", up);
|
||||
};
|
||||
const timeAtPointer = (clientX: number) => {
|
||||
const rect = timelineContent.current?.getBoundingClientRect();
|
||||
if (!rect) return 0;
|
||||
return Math.max(0, Math.min(totalSeconds, (clientX - rect.left) / rect.width * totalSeconds));
|
||||
};
|
||||
const beginScrub = (event: React.PointerEvent) => {
|
||||
const seek = (clientX: number) => player.current?.seekTo(Math.round(timeAtPointer(clientX) * project.fps));
|
||||
seek(event.clientX);
|
||||
const move = (pointer: PointerEvent) => seek(pointer.clientX);
|
||||
const up = () => {window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", up);};
|
||||
window.addEventListener("pointermove", move);
|
||||
window.addEventListener("pointerup", up);
|
||||
};
|
||||
const beginTimingDrag = (event: React.PointerEvent, sceneId: string, layerId: string, mode: "move" | "start" | "end") => {
|
||||
event.stopPropagation();
|
||||
const targetScene = project.scenes.find((item) => item.id === sceneId);
|
||||
const targetLayer = targetScene?.layers.find((item) => item.id === layerId);
|
||||
const rect = timelineContent.current?.getBoundingClientRect();
|
||||
if (!targetScene || !targetLayer || !rect || targetLayer.locked) return;
|
||||
const initial = clone(project);
|
||||
const originX = event.clientX;
|
||||
const originStart = targetLayer.start;
|
||||
const originEnd = targetLayer.end;
|
||||
const duration = originEnd - originStart;
|
||||
const move = (pointer: PointerEvent) => {
|
||||
const delta = (pointer.clientX - originX) / rect.width * totalSeconds;
|
||||
let start = originStart;
|
||||
let end = originEnd;
|
||||
if (mode === "move") {start = Math.max(0, Math.min(targetScene.duration - duration, originStart + delta)); end = start + duration;}
|
||||
if (mode === "start") start = Math.max(0, Math.min(originEnd - 0.1, originStart + delta));
|
||||
if (mode === "end") end = Math.max(originStart + 0.1, Math.min(targetScene.duration, originEnd + delta));
|
||||
setProject((current) => ({...current, scenes: current.scenes.map((item) => item.id === sceneId ? {...item, layers: item.layers.map((layer) => layer.id === layerId ? {...layer, start, end} : layer)} : item)}));
|
||||
};
|
||||
const up = () => {window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", up); setHistory((items) => [...items.slice(-29), initial]); setFuture([]);};
|
||||
window.addEventListener("pointermove", move);
|
||||
window.addEventListener("pointerup", up);
|
||||
};
|
||||
const beginKeyframeDrag = (event: React.PointerEvent, sceneId: string, layerId: string, keyframeId: string) => {
|
||||
event.stopPropagation();
|
||||
const targetScene = project.scenes.find((item) => item.id === sceneId);
|
||||
const targetLayer = targetScene?.layers.find((item) => item.id === layerId);
|
||||
const targetKey = targetLayer?.keyframes.find((item) => item.id === keyframeId);
|
||||
const rect = timelineContent.current?.getBoundingClientRect();
|
||||
if (!targetScene || !targetLayer || !targetKey || !rect || targetLayer.locked) return;
|
||||
const initial = clone(project);
|
||||
const originX = event.clientX;
|
||||
const originTime = targetKey.time;
|
||||
const move = (pointer: PointerEvent) => {
|
||||
const delta = (pointer.clientX - originX) / rect.width * totalSeconds;
|
||||
const time = Math.max(0, Math.min(targetScene.duration, originTime + delta));
|
||||
setProject((current) => ({...current, scenes: current.scenes.map((item) => item.id === sceneId ? {...item, layers: item.layers.map((layer) => layer.id === layerId ? {...layer, keyframes: layer.keyframes.map((key) => key.id === keyframeId ? {...key, time} : key)} : layer)} : item)}));
|
||||
};
|
||||
const up = () => {window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", up); setHistory((items) => [...items.slice(-29), initial]); setFuture([]);};
|
||||
window.addEventListener("pointermove", move);
|
||||
window.addEventListener("pointerup", up);
|
||||
};
|
||||
|
||||
const undo = () => {
|
||||
const previous = history.at(-1);
|
||||
if (!previous) return;
|
||||
setFuture((items) => [clone(project), ...items]);
|
||||
setProject(previous);
|
||||
setHistory((items) => items.slice(0, -1));
|
||||
};
|
||||
const redo = () => {
|
||||
const next = future[0];
|
||||
if (!next) return;
|
||||
setHistory((items) => [...items, clone(project)]);
|
||||
setProject(next);
|
||||
setFuture((items) => items.slice(1));
|
||||
};
|
||||
|
||||
const addScene = () => {
|
||||
const next: VideoScene = {id: crypto.randomUUID(), layout: "hero", eyebrow: "NEUE SZENE", title: "Deine Headline", body: "Beschreibe hier die zentrale Botschaft.", accent: "#8b5cf6", duration: 3.5, effects: [], motion: {entrance: "rise", entranceDuration: 0.55, exitDuration: 0.35, transition: "fade", transitionDuration: 0.3}, layers: []};
|
||||
commit({...project, scenes: [...project.scenes, next]});
|
||||
setSelectedId(next.id);
|
||||
};
|
||||
|
||||
const duplicateScene = () => {
|
||||
if (!scene) return;
|
||||
const copy = {...clone(scene), id: crypto.randomUUID(), title: `${scene.title} Kopie`, effects: scene.effects.map((item) => ({...item, id: crypto.randomUUID()})), layers: scene.layers.map((layer) => ({...clone(layer), id: crypto.randomUUID(), keyframes: layer.keyframes.map((key) => ({...key, id: crypto.randomUUID()}))}))};
|
||||
const index = project.scenes.findIndex((item) => item.id === scene.id);
|
||||
const scenes = [...project.scenes];
|
||||
scenes.splice(index + 1, 0, copy);
|
||||
commit({...project, scenes});
|
||||
setSelectedId(copy.id);
|
||||
setSelectedLayerId(null);
|
||||
};
|
||||
|
||||
const deleteScene = () => {
|
||||
if (project.scenes.length < 2 || !scene) return;
|
||||
const index = project.scenes.findIndex((item) => item.id === scene.id);
|
||||
const scenes = project.scenes.filter((item) => item.id !== scene.id);
|
||||
commit({...project, scenes});
|
||||
setSelectedId(scenes[Math.min(index, scenes.length - 1)].id);
|
||||
setSelectedLayerId(null);
|
||||
};
|
||||
|
||||
const moveScene = (direction: -1 | 1) => {
|
||||
const index = project.scenes.findIndex((item) => item.id === selectedId);
|
||||
const target = index + direction;
|
||||
if (index < 0 || target < 0 || target >= project.scenes.length) return;
|
||||
const scenes = [...project.scenes];
|
||||
[scenes[index], scenes[target]] = [scenes[target], scenes[index]];
|
||||
commit({...project, scenes});
|
||||
};
|
||||
|
||||
const generate = async () => {
|
||||
if (!prompt.trim()) return;
|
||||
setGenerating(true);
|
||||
try {
|
||||
const response = await fetch("/api/generate", {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({prompt})});
|
||||
if (!response.ok) throw new Error("Storyboard konnte nicht erstellt werden.");
|
||||
const data = await response.json();
|
||||
commit({...project, title: prompt.slice(0, 48), scenes: data.scenes});
|
||||
setSelectedId(data.scenes[0].id);
|
||||
} catch (error) {
|
||||
alert(error instanceof Error ? error.message : String(error));
|
||||
} finally {
|
||||
setGenerating(false);
|
||||
}
|
||||
};
|
||||
|
||||
const render = async () => {
|
||||
setRenderJob({status: "startet", progress: 0});
|
||||
try {
|
||||
const response = await fetch("/api/render", {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({project})});
|
||||
const data = await response.json();
|
||||
if (!response.ok) throw new Error(data.error);
|
||||
setRenderJob({id: data.id, status: "queued", progress: 0});
|
||||
const timer = window.setInterval(async () => {
|
||||
const status = await fetch(`/api/render/${data.id}`).then((result) => result.json());
|
||||
setRenderJob({id: data.id, ...status});
|
||||
if (status.status === "done" || status.status === "error") window.clearInterval(timer);
|
||||
}, 1000);
|
||||
} catch (error) {
|
||||
setRenderJob({status: "error", progress: 0, error: error instanceof Error ? error.message : String(error)});
|
||||
}
|
||||
};
|
||||
|
||||
const save = () => {
|
||||
localStorage.setItem("pdev-video-project", JSON.stringify(project));
|
||||
const blob = new Blob([JSON.stringify(project, null, 2)], {type: "application/json"});
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = `${project.title.toLowerCase().replace(/[^a-z0-9]+/g, "-") || "pdev-project"}.pdev.json`;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
const seekToScene = (id: string) => {
|
||||
setSelectedId(id);
|
||||
setSelectedLayerId(null);
|
||||
const index = project.scenes.findIndex((item) => item.id === id);
|
||||
const start = project.scenes.slice(0, index).reduce((sum, item) => sum + item.duration, 0);
|
||||
player.current?.seekTo(Math.round(start * project.fps));
|
||||
};
|
||||
|
||||
return (
|
||||
<main className="studio-shell">
|
||||
<header className="topbar">
|
||||
<div className="brand"><div className="brand-mark"><Film size={18} /></div><div><strong>PDEV</strong><span>AI VIDEO STUDIO</span></div></div>
|
||||
<div className="center-tools"><div className="mode-switch"><button className={project.activeMode === "motion" ? "active" : ""} onClick={() => patchProject({activeMode: "motion"})}><WandSparkles /> Motion</button><button className={project.activeMode === "cut" ? "active" : ""} onClick={() => patchProject({activeMode: "cut"})}><Scissors /> Schnitt</button></div><div className="project-name"><span className="status-dot" /><input value={project.title} onChange={(event) => setProject({...project, title: event.target.value})} /><ChevronDown size={14} /></div></div>
|
||||
<div className="top-actions">
|
||||
<button className="icon-button" title="Rückgängig" disabled={!history.length} onClick={undo}><Undo2 /></button>
|
||||
<button className="icon-button" title="Wiederholen" disabled={!future.length} onClick={redo}><Redo2 /></button>
|
||||
<button className="button ghost" onClick={save}><Save /> Speichern</button>
|
||||
<button className="button render" onClick={render}><Sparkles /> Rendern</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{project.activeMode === "motion" ? <><section className="workspace">
|
||||
<aside className="left-panel panel">
|
||||
<div className="panel-tabs four"><button className={tab === "scenes" ? "active" : ""} onClick={() => setTab("scenes")}>Szenen</button><button className={tab === "layers" ? "active" : ""} onClick={() => setTab("layers")}>Layer</button><button className={tab === "effects" ? "active" : ""} onClick={() => setTab("effects")}>FX</button><button className={tab === "design" ? "active" : ""} onClick={() => setTab("design")}>Design</button></div>
|
||||
{tab === "scenes" ? <>
|
||||
<div className="scene-list">
|
||||
{project.scenes.map((item, index) => <button key={item.id} className={`scene-card ${item.id === selectedId ? "selected" : ""}`} onClick={() => seekToScene(item.id)}>
|
||||
<GripVertical className="grip" size={15} /><div className="scene-number">{String(index + 1).padStart(2, "0")}</div><div className="scene-thumb" style={{"--accent": item.accent} as React.CSSProperties}><span>{item.title.slice(0, 22)}</span></div><div className="scene-meta"><b>{item.title}</b><span>{item.layout} · {item.duration.toFixed(1)}s</span></div>
|
||||
</button>)}
|
||||
</div>
|
||||
<button className="add-scene" onClick={addScene}><Plus size={16} /> Szene hinzufügen</button>
|
||||
</> : tab === "layers" ? <div className="layers-panel">
|
||||
<div className="layer-tools"><button onClick={() => createLayer("text")}><Type /> Text</button><button onClick={() => createLayer("shape")}><Box /> Shape</button><label><Image /> Bild<input type="file" accept="image/*" onChange={(event) => importImage(event.target.files?.[0])} /></label></div>
|
||||
<div className="layer-heading"><span>Ebenen</span><small>{scene?.layers.length ?? 0} Layer</small></div>
|
||||
<div className="layer-list">{scene?.layers.length ? [...scene.layers].reverse().map((layer, reverseIndex) => <button key={layer.id} className={layer.id === selectedLayerId ? "selected" : ""} onClick={() => setSelectedLayerId(layer.id)}>
|
||||
<GripVertical /><span className={`layer-type ${layer.type}`}>{layer.type === "text" ? <Type /> : layer.type === "shape" ? <Box /> : <Image />}</span><div><b>{layer.name}</b><small>{layer.type} · {layer.start.toFixed(1)}-{layer.end.toFixed(1)}s</small></div><span className="layer-order">{scene.layers.length - reverseIndex}</span><i onClick={(event) => {event.stopPropagation(); patchLayer(layer.id, {visible: !layer.visible});}}>{layer.visible ? <Eye /> : <EyeOff />}</i><i onClick={(event) => {event.stopPropagation(); patchLayer(layer.id, {locked: !layer.locked});}}>{layer.locked ? <Lock /> : <Unlock />}</i>
|
||||
</button>) : <div className="empty-layer"><MousePointer2 /><b>Noch keine Layer</b><span>Füge Text, Shapes oder Bilder hinzu.</span></div>}</div>
|
||||
</div> : tab === "effects" ? <div className="effects-browser">
|
||||
<div className="browser-title"><Zap /> <div><b>Effect Library</b><span>Klicken zum Einfügen</span></div></div>
|
||||
<div className="effect-grid">{effectPresets.map((preset) => <button key={preset.type} onClick={() => addEffect(preset)} style={{"--fx": preset.color} as React.CSSProperties}><span className={`fx-preview ${preset.type}`}><i /></span><b>{preset.name}</b><small>{preset.description}</small><Plus /></button>)}</div>
|
||||
</div> : <div className="design-controls">
|
||||
<Field label="Hintergrund"><div className="color-row"><input type="color" value={project.background} onChange={(e) => patchProject({background: e.target.value})} /><input value={project.background} onChange={(e) => patchProject({background: e.target.value})} /></div></Field>
|
||||
<Field label="Textfarbe"><div className="color-row"><input type="color" value={project.textColor} onChange={(e) => patchProject({textColor: e.target.value})} /><input value={project.textColor} onChange={(e) => patchProject({textColor: e.target.value})} /></div></Field>
|
||||
<Field label="Typografie"><select value={project.font} onChange={(e) => patchProject({font: e.target.value as VideoProject["font"]})}><option value="modern">Modern Sans</option><option value="editorial">Editorial Serif</option><option value="mono">Technical Mono</option></select></Field>
|
||||
<Field label="Format"><div className="segmented">{(["9:16", "16:9", "1:1"] as AspectRatio[]).map((format) => <button key={format} className={project.format === format ? "active" : ""} onClick={() => patchProject({format})}>{format}</button>)}</div></Field>
|
||||
<Field label="Framerate"><select value={project.fps} onChange={(e) => patchProject({fps: Number(e.target.value)})}><option value={24}>24 FPS</option><option value={30}>30 FPS</option><option value={60}>60 FPS</option></select></Field>
|
||||
</div>}
|
||||
</aside>
|
||||
|
||||
<section className="canvas-area">
|
||||
<div className="canvas-toolbar"><span><MonitorPlay size={15} /> Live Preview</span><div className="preview-formats">{(["9:16", "16:9", "1:1"] as AspectRatio[]).map((format) => <button key={format} className={project.format === format ? "active" : ""} onClick={() => patchProject({format})}>{format}</button>)}</div><span>{size.width} × {size.height}</span></div>
|
||||
<div ref={stage} className={`player-stage ratio-${project.format.replace(":", "-")}`}>
|
||||
<Player ref={player} component={PDEVVideo} inputProps={project} durationInFrames={totalFrames} compositionWidth={size.width} compositionHeight={size.height} fps={project.fps} style={{width: "100%", height: "100%"}} acknowledgeRemotionLicense />
|
||||
{selectedLayer && !selectedLayer.locked && <div className="layer-selection" onPointerDown={beginLayerDrag} style={{left: `${selectedLayer.x}%`, top: `${selectedLayer.y}%`, width: `${selectedLayer.width * selectedLayer.scale / 100}%`, height: `${selectedLayer.height * selectedLayer.scale / 100}%`, transform: `translate(-50%,-50%) rotate(${selectedLayer.rotation}deg)`}}><i className="handle nw"/><i className="handle ne"/><i className="handle sw"/><i className="handle se"/><span>{selectedLayer.name}</span></div>}
|
||||
</div>
|
||||
<div className="transport"><button className="transport-main" onClick={() => isPlaying ? player.current?.pause() : player.current?.play()}>{isPlaying ? <Pause fill="currentColor" /> : <Play fill="currentColor" />}</button><span>{seconds(frame / project.fps)}</span><input type="range" min={0} max={Math.max(1, totalFrames - 1)} value={Math.min(frame, totalFrames - 1)} onChange={(e) => player.current?.seekTo(Number(e.target.value))} /><span>{seconds(totalSeconds)}</span><button className="icon-button"><Clapperboard /></button></div>
|
||||
</section>
|
||||
|
||||
<aside className="right-panel panel">
|
||||
<div className="inspector-head"><div><span>{selectedLayer ? "LAYER INSPECTOR" : "SCENE INSPECTOR"}</span><b>{selectedLayer?.name ?? scene?.title}</b></div><div>{selectedLayer ? <button className="icon-button" onClick={() => patchLayer(selectedLayer.id, {locked: !selectedLayer.locked})}>{selectedLayer.locked ? <Lock /> : <Unlock />}</button> : <><button className="icon-button" onClick={() => moveScene(-1)}><ChevronLeft /></button><button className="icon-button" onClick={() => moveScene(1)}><ChevronRight /></button></>}</div></div>
|
||||
{selectedLayer ? <div className="inspector-body layer-inspector">
|
||||
<Field label="Layer Name"><input value={selectedLayer.name} onChange={(e) => patchLayer(selectedLayer.id, {name: e.target.value})} /></Field>
|
||||
{selectedLayer.type === "text" && <><Field label="Text"><textarea rows={3} value={selectedLayer.text} onChange={(e) => patchLayer(selectedLayer.id, {text: e.target.value})} /></Field><Field label={`Schriftgröße · ${selectedLayer.fontSize}px`}><input type="range" min="12" max="240" value={selectedLayer.fontSize} onChange={(e) => patchLayer(selectedLayer.id, {fontSize: Number(e.target.value)})} /></Field></>}
|
||||
<Field label="Farbe"><div className="color-row"><input type="color" value={selectedLayer.color} onChange={(e) => patchLayer(selectedLayer.id, {color: e.target.value})} /><input value={selectedLayer.color} onChange={(e) => patchLayer(selectedLayer.id, {color: e.target.value})} /></div></Field>
|
||||
<div className="inspector-section"><span><MousePointer2 /> Transform</span><small>{selectedLayer.keyframes.length} Keys</small></div>
|
||||
<div className="transform-row"><label><span>Position X</span><input type="number" step="0.1" value={selectedLayer.x.toFixed(1)} onChange={(e) => patchLayer(selectedLayer.id, {x: Number(e.target.value)})} /></label><button title="Keyframe setzen" onClick={() => addKeyframe("x")}><Diamond /></button><label><span>Y</span><input type="number" step="0.1" value={selectedLayer.y.toFixed(1)} onChange={(e) => patchLayer(selectedLayer.id, {y: Number(e.target.value)})} /></label><button title="Keyframe setzen" onClick={() => addKeyframe("y")}><Diamond /></button></div>
|
||||
<KeyControl label="Skalierung" value={selectedLayer.scale} min={1} max={250} suffix="%" onChange={(value) => patchLayer(selectedLayer.id, {scale: value})} onKey={() => addKeyframe("scale")} />
|
||||
<KeyControl label="Rotation" value={selectedLayer.rotation} min={-180} max={180} suffix="°" onChange={(value) => patchLayer(selectedLayer.id, {rotation: value})} onKey={() => addKeyframe("rotation")} />
|
||||
<KeyControl label="Deckkraft" value={selectedLayer.opacity} min={0} max={100} suffix="%" onChange={(value) => patchLayer(selectedLayer.id, {opacity: value})} onKey={() => addKeyframe("opacity")} />
|
||||
<div className="dual-field"><Field label={`Breite · ${selectedLayer.width.toFixed(0)}%`}><input type="range" min="2" max="120" value={selectedLayer.width} onChange={(e) => patchLayer(selectedLayer.id, {width: Number(e.target.value)})} /></Field><Field label={`Höhe · ${selectedLayer.height.toFixed(0)}%`}><input type="range" min="2" max="120" value={selectedLayer.height} onChange={(e) => patchLayer(selectedLayer.id, {height: Number(e.target.value)})} /></Field></div>
|
||||
{selectedLayer.type === "shape" && <Field label={`Ecken · ${selectedLayer.borderRadius}px`}><input type="range" min="0" max="200" value={selectedLayer.borderRadius} onChange={(e) => patchLayer(selectedLayer.id, {borderRadius: Number(e.target.value)})} /></Field>}
|
||||
<div className="inspector-section"><span><Clapperboard /> Timing & Compositing</span></div>
|
||||
<div className="dual-field"><Field label="Start"><input type="number" min="0" max={scene.duration} step="0.1" value={selectedLayer.start} onChange={(e) => patchLayer(selectedLayer.id, {start: Number(e.target.value)})} /></Field><Field label="Ende"><input type="number" min="0" max={scene.duration} step="0.1" value={selectedLayer.end} onChange={(e) => patchLayer(selectedLayer.id, {end: Number(e.target.value)})} /></Field></div>
|
||||
<Field label="Blend Mode"><select value={selectedLayer.blendMode} onChange={(e) => patchLayer(selectedLayer.id, {blendMode: e.target.value as VideoLayer["blendMode"]})}><option value="normal">Normal</option><option value="screen">Screen</option><option value="multiply">Multiply</option><option value="overlay">Overlay</option><option value="lighten">Lighten</option></select></Field>
|
||||
{selectedLayer.keyframes.length > 0 && <div className="keyframe-list">{[...selectedLayer.keyframes].sort((a,b) => a.time-b.time).map((key) => <button key={key.id} onClick={() => {player.current?.seekTo(Math.round((sceneStart + key.time) * project.fps));}}><Diamond /><b>{key.property}</b><span>{key.time.toFixed(2)}s · {key.value.toFixed(1)}</span><i onClick={(event) => {event.stopPropagation(); removeKeyframe(key.id);}}><X /></i></button>)}</div>}
|
||||
<button className="delete-layer" onClick={deleteLayer}><Trash2 /> Layer löschen</button>
|
||||
</div> : scene && <div className="inspector-body">
|
||||
<Field label="Layout"><div className="layout-grid">{layouts.map((item) => <button key={item.value} className={scene.layout === item.value ? "active" : ""} onClick={() => patchScene({layout: item.value})}><span className={`layout-icon ${item.value}`} />{item.label}</button>)}</div></Field>
|
||||
<Field label="Eyebrow"><input value={scene.eyebrow} onChange={(e) => patchScene({eyebrow: e.target.value})} /></Field>
|
||||
<Field label="Headline"><textarea rows={3} value={scene.title} onChange={(e) => patchScene({title: e.target.value})} /></Field>
|
||||
<Field label="Beschreibung"><textarea rows={4} value={scene.body} onChange={(e) => patchScene({body: e.target.value})} /></Field>
|
||||
<Field label="Akzent"><div className="color-row"><input type="color" value={scene.accent} onChange={(e) => patchScene({accent: e.target.value})} /><input value={scene.accent} onChange={(e) => patchScene({accent: e.target.value})} /></div></Field>
|
||||
<Field label={`Dauer · ${scene.duration.toFixed(1)}s`}><input type="range" min="1.5" max="12" step="0.5" value={scene.duration} onChange={(e) => patchScene({duration: Number(e.target.value)})} /></Field>
|
||||
<div className="inspector-section"><span><Clapperboard /> Motion & Transition</span></div>
|
||||
<Field label="Ein-Animation"><select value={scene.motion.entrance} onChange={(e) => patchMotion({entrance: e.target.value as EntranceType})}><option value="fade">Fade</option><option value="rise">Rise Up</option><option value="zoom">Zoom In</option><option value="slide">Slide In</option><option value="elastic">Elastic Pop</option></select></Field>
|
||||
<div className="dual-field"><Field label={`In · ${scene.motion.entranceDuration.toFixed(2)}s`}><input type="range" min="0.1" max="1.5" step="0.05" value={scene.motion.entranceDuration} onChange={(e) => patchMotion({entranceDuration: Number(e.target.value)})} /></Field><Field label={`Out · ${scene.motion.exitDuration.toFixed(2)}s`}><input type="range" min="0.1" max="1.5" step="0.05" value={scene.motion.exitDuration} onChange={(e) => patchMotion({exitDuration: Number(e.target.value)})} /></Field></div>
|
||||
<Field label="Szenenübergang"><select value={scene.motion.transition} onChange={(e) => patchMotion({transition: e.target.value as TransitionType})}><option value="cut">Hard Cut</option><option value="fade">Cross Fade</option><option value="slide">Push Slide</option><option value="wipe">Linear Wipe</option><option value="zoom">Lens Zoom</option><option value="glitch">Digital Glitch</option></select></Field>
|
||||
<Field label={`Übergang · ${scene.motion.transitionDuration.toFixed(2)}s`}><input type="range" min="0.05" max="1.2" step="0.05" value={scene.motion.transitionDuration} onChange={(e) => patchMotion({transitionDuration: Number(e.target.value)})} /></Field>
|
||||
<div className="inspector-section"><span><Layers3 /> Effect Stack</span><small>{scene.effects.length} aktiv</small></div>
|
||||
<div className="effect-stack">{scene.effects.length ? scene.effects.map((item, index) => <div className={`effect-item ${item.enabled ? "" : "disabled"}`} key={item.id}>
|
||||
<div className="effect-item-head"><GripVertical /><span className="effect-index">FX {String(index + 1).padStart(2, "0")}</span><b>{item.name}</b><button onClick={() => patchEffect(item.id, {enabled: !item.enabled})}>{item.enabled ? <Eye /> : <EyeOff />}</button><button className="remove" onClick={() => removeEffect(item.id)}><X /></button></div>
|
||||
<div className="effect-params"><label><span>Stärke</span><input type="range" min="0" max="100" value={item.amount} onChange={(e) => patchEffect(item.id, {amount: Number(e.target.value)})} /><b>{item.amount}</b></label><label><span>Speed</span><input type="range" min="0" max="100" value={item.speed} onChange={(e) => patchEffect(item.id, {speed: Number(e.target.value)})} /><b>{item.speed}</b></label><label className="mini-color"><span>Farbe</span><input type="color" value={item.color} onChange={(e) => patchEffect(item.id, {color: e.target.value})} /></label></div>
|
||||
</div>) : <button className="empty-effects" onClick={() => setTab("effects")}><Sparkles /> Effekt hinzufügen</button>}</div>
|
||||
<div className="scene-actions"><button onClick={duplicateScene}><Copy /> Duplizieren</button><button className="danger" onClick={deleteScene}><Trash2 /></button></div>
|
||||
</div>}
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
<section className="timeline multitrack panel">
|
||||
<div className="timeline-head"><div><b>Composition Timeline</b><span>{project.scenes.length} Szenen · {layerTracks.length} Layer · {totalSeconds.toFixed(1)} Sekunden</span></div><div className="timeline-tools"><button onClick={() => setTimelineZoom(100)}>Fit</button><div className="zoom">− <input type="range" min="100" max="320" value={timelineZoom} onChange={(event) => setTimelineZoom(Number(event.target.value))} /> +</div><b>{timelineZoom}%</b></div></div>
|
||||
<div className="timeline-scroll">
|
||||
<div className="timeline-content" style={{width: `${timelineZoom}%`}}>
|
||||
<div className="track-ruler"><div className="track-label ruler-label"><span>TRACKS</span></div><div className="ruler-lane" onPointerDown={beginScrub}>{Array.from({length: Math.ceil(totalSeconds) + 1}, (_, index) => <span key={index} style={{left: `${index / totalSeconds * 100}%`}}>{index % 2 === 0 ? `${index}s` : "·"}</span>)}</div></div>
|
||||
<div className="track-row scene-track"><div className="track-label"><Film /><div><b>SCENES</b><span>Master sequence</span></div></div><div ref={timelineContent} className="track-lane scene-lane" onPointerDown={beginScrub}>{project.scenes.map((item, index) => {
|
||||
const offset = project.scenes.slice(0, index).reduce((sum, previous) => sum + previous.duration, 0);
|
||||
return <div key={item.id} className={`scene-clip ${item.id === selectedId ? "active" : ""}`} onPointerDown={(event) => {event.stopPropagation(); seekToScene(item.id);}} style={{left: `${offset / totalSeconds * 100}%`, width: `${item.duration / totalSeconds * 100}%`, "--accent": item.accent} as React.CSSProperties}><span>{index + 1}</span><b>{item.title}</b><small>{item.duration.toFixed(1)}s</small></div>;
|
||||
})}</div></div>
|
||||
{layerTracks.map(({scene: trackScene, layer, offset}) => <div className={`track-row layer-track ${layer.id === selectedLayerId ? "selected" : ""}`} key={`${trackScene.id}-${layer.id}`}><div className="track-label" onClick={() => {setSelectedId(trackScene.id); setSelectedLayerId(layer.id); setTab("layers");}}><i onClick={(event) => {event.stopPropagation(); patchLayerInScene(trackScene.id, layer.id, {visible: !layer.visible});}}>{layer.visible ? <Eye /> : <EyeOff />}</i><span className={`track-type ${layer.type}`}>{layer.type === "text" ? <Type /> : layer.type === "shape" ? <Box /> : <Image />}</span><div><b>{layer.name}</b><span>{trackScene.title}</span></div><i>{layer.locked ? <Lock /> : <Unlock />}</i></div><div className="track-lane" onPointerDown={beginScrub}>
|
||||
<div className={`layer-clip ${layer.locked ? "locked" : ""}`} onPointerDown={(event) => {setSelectedId(trackScene.id); setSelectedLayerId(layer.id); beginTimingDrag(event, trackScene.id, layer.id, "move");}} style={{left: `${(offset + layer.start) / totalSeconds * 100}%`, width: `${(layer.end - layer.start) / totalSeconds * 100}%`, "--layer-color": layer.color} as React.CSSProperties}><i className="trim start" onPointerDown={(event) => beginTimingDrag(event, trackScene.id, layer.id, "start")} /><span>{layer.type.toUpperCase()}</span><b>{layer.name}</b><i className="trim end" onPointerDown={(event) => beginTimingDrag(event, trackScene.id, layer.id, "end")} /></div>
|
||||
{layer.keyframes.map((key) => <button className={`track-key ${key.property}`} title={`${key.property}: ${key.value.toFixed(1)} @ ${key.time.toFixed(2)}s`} key={key.id} onPointerDown={(event) => beginKeyframeDrag(event, trackScene.id, layer.id, key.id)} onDoubleClick={() => {setSelectedId(trackScene.id); setSelectedLayerId(layer.id); player.current?.seekTo(Math.round((offset + key.time) * project.fps));}} style={{left: `${(offset + key.time) / totalSeconds * 100}%`}}><Diamond /></button>)}
|
||||
</div></div>)}
|
||||
{!layerTracks.length && <div className="track-row empty-track"><div className="track-label"><Layers3 /><div><b>NO LAYERS</b><span>Layer-Tab öffnen</span></div></div><div className="track-lane"><span>Füge Text, Shapes oder Bilder hinzu, um Spuren anzulegen.</span></div></div>}
|
||||
<div className="multi-playhead" style={{left: `calc(${frame / totalFrames * 100}% + ${145 * (1 - frame / totalFrames)}px)`}}><i /><span>{seconds(frame / project.fps)}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="ai-dock panel"><div className="ai-badge"><WandSparkles /><span>AI<br/><b>DIRECTOR</b></span></div><textarea value={prompt} onChange={(e) => setPrompt(e.target.value)} placeholder="Beschreibe dein Video, den Stil und die gewünschte Botschaft..." /><button onClick={generate} disabled={generating}>{generating ? <span className="spinner" /> : <Bot />} {generating ? "Storyboard entsteht..." : "Video entwerfen"}</button></section></> : <CutEditor project={project} commit={commit} render={render} />}
|
||||
|
||||
{renderJob && <div className="render-modal-backdrop"><div className="render-modal panel"><button className="modal-close" onClick={() => setRenderJob(null)}><X /></button>{renderJob.status === "done" ? <><div className="success-ring"><Check /></div><h2>Video ist fertig</h2><p>Dein MP4 wurde pixelgenau mit Remotion gerendert.</p><a className="button render" href={renderJob.url} download><Download /> MP4 herunterladen</a></> : renderJob.status === "error" ? <><h2>Render fehlgeschlagen</h2><p>{renderJob.error}</p></> : <><div className="render-orbit"><Film /></div><h2>Video wird gerendert</h2><p>{renderJob.status === "bundling" ? "Projekt wird vorbereitet" : "Frames werden komponiert"}</p><div className="progress"><i style={{width: `${renderJob.progress * 100}%`}} /></div><strong>{Math.round(renderJob.progress * 100)}%</strong></>}</div></div>}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
function Field({label, children}: {label: string; children: React.ReactNode}) {
|
||||
return <label className="field"><span>{label}</span>{children}</label>;
|
||||
}
|
||||
|
||||
function KeyControl({label, value, min, max, suffix, onChange, onKey}: {label: string; value: number; min: number; max: number; suffix: string; onChange: (value: number) => void; onKey: () => void}) {
|
||||
return <label className="key-control"><span>{label}</span><input type="range" min={min} max={max} value={value} onChange={(event) => onChange(Number(event.target.value))} /><b>{Math.round(value)}{suffix}</b><button title="Keyframe am Playhead setzen" onClick={onKey}><Diamond /></button></label>;
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import {Player, type PlayerRef} from "@remotion/player";
|
||||
import {AudioLines, Bot, Copy, Film, FolderOpen, Gauge, ImagePlus, Magnet, MousePointer2, Pause, Play, Plus, Rows3, Scissors, Sparkles, Trash2, Upload, Volume2, VolumeX} from "lucide-react";
|
||||
import {PDEVVideo} from "./remotion/Video";
|
||||
import {clipDuration, dimensions, editDuration, projectFrames, type EditorClip, type MediaAsset, type VideoProject} from "./types";
|
||||
|
||||
type Props = {project: VideoProject; commit: (project: VideoProject) => void; render: () => void};
|
||||
const clock = (value: number) => `${Math.floor(value / 60)}:${String(Math.floor(value % 60)).padStart(2, "0")}:${String(Math.floor(value * 30) % 30).padStart(2, "0")}`;
|
||||
|
||||
const getDuration = (url: string, type: MediaAsset["mediaType"]) => new Promise<number>((resolve) => {
|
||||
const media = document.createElement(type === "audio" ? "audio" : "video");
|
||||
media.preload = "metadata";
|
||||
media.onloadedmetadata = () => resolve(Number.isFinite(media.duration) ? media.duration : 10);
|
||||
media.onerror = () => resolve(10);
|
||||
media.src = url;
|
||||
});
|
||||
|
||||
export function CutEditor({project, commit, render}: Props) {
|
||||
const [selectedClipId, setSelectedClipId] = useState<string | null>(project.clips[0]?.id ?? null);
|
||||
const [frame, setFrame] = useState(0);
|
||||
const [playing, setPlaying] = useState(false);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
const [zoom, setZoom] = useState(120);
|
||||
const [tool, setTool] = useState<"select" | "razor">("select");
|
||||
const [snapping, setSnapping] = useState(true);
|
||||
const player = useRef<PlayerRef>(null);
|
||||
const timeline = useRef<HTMLDivElement>(null);
|
||||
const clip = project.clips.find((item) => item.id === selectedClipId) ?? null;
|
||||
const duration = editDuration(project);
|
||||
const frames = projectFrames(project);
|
||||
const size = dimensions[project.format];
|
||||
|
||||
useEffect(() => {
|
||||
const current = player.current;
|
||||
if (!current) return;
|
||||
const update = (event: {detail: {frame: number}}) => setFrame(event.detail.frame);
|
||||
const play = () => setPlaying(true);
|
||||
const pause = () => setPlaying(false);
|
||||
current.addEventListener("frameupdate", update);
|
||||
current.addEventListener("play", play);
|
||||
current.addEventListener("pause", pause);
|
||||
return () => {current.removeEventListener("frameupdate", update); current.removeEventListener("play", play); current.removeEventListener("pause", pause);};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const keyboard = (event: KeyboardEvent) => {
|
||||
if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement || event.target instanceof HTMLSelectElement) return;
|
||||
if (event.code === "Space") {event.preventDefault(); playing ? player.current?.pause() : player.current?.play();}
|
||||
if (event.key.toLowerCase() === "v") setTool("select");
|
||||
if (event.key.toLowerCase() === "c") setTool("razor");
|
||||
if (event.key.toLowerCase() === "k" && event.ctrlKey) {event.preventDefault(); splitAtPlayhead();}
|
||||
if (event.key.toLowerCase() === "k" && !event.ctrlKey) player.current?.pause();
|
||||
if (event.key.toLowerCase() === "l") player.current?.play();
|
||||
if (event.key === "Delete") rippleDelete();
|
||||
};
|
||||
window.addEventListener("keydown", keyboard);
|
||||
return () => window.removeEventListener("keydown", keyboard);
|
||||
});
|
||||
|
||||
const patchClip = (id: string, patch: Partial<EditorClip>) => commit({...project, clips: project.clips.map((item) => item.id === id ? {...item, ...patch} : item)});
|
||||
const upload = async (files: FileList | null) => {
|
||||
if (!files?.length) return;
|
||||
setUploading(true);
|
||||
try {
|
||||
const assets: MediaAsset[] = [];
|
||||
for (const file of Array.from(files)) {
|
||||
const response = await fetch("/api/media", {method: "POST", headers: {"Content-Type": "application/octet-stream", "x-file-name": encodeURIComponent(file.name)}, body: file});
|
||||
const data = await response.json();
|
||||
if (!response.ok) throw new Error(data.error || `Import fehlgeschlagen: ${file.name}`);
|
||||
const mediaType = file.type.startsWith("audio/") ? "audio" : "video";
|
||||
assets.push({id: crypto.randomUUID(), name: file.name, url: data.url, mediaType, duration: await getDuration(data.url, mediaType), size: file.size});
|
||||
}
|
||||
commit({...project, media: [...project.media, ...assets]});
|
||||
} catch (error) {
|
||||
alert(error instanceof Error ? error.message : String(error));
|
||||
} finally {setUploading(false);}
|
||||
};
|
||||
const addAsset = (asset: MediaAsset) => {
|
||||
const start = Math.max(0, ...project.clips.map((item) => item.start + clipDuration(item)));
|
||||
const next: EditorClip = {id: crypto.randomUUID(), assetId: asset.id, name: asset.name, track: asset.mediaType === "audio" ? 0 : 1, start, sourceStart: 0, sourceEnd: asset.duration, speed: 1, volume: 100, muted: false, fadeIn: 0, fadeOut: 0};
|
||||
commit({...project, clips: [...project.clips, next]});
|
||||
setSelectedClipId(next.id);
|
||||
};
|
||||
const removeAsset = (asset: MediaAsset) => commit({...project, media: project.media.filter((item) => item.id !== asset.id), clips: project.clips.filter((item) => item.assetId !== asset.id)});
|
||||
const removeClip = () => {if (clip) {commit({...project, clips: project.clips.filter((item) => item.id !== clip.id)}); setSelectedClipId(null);}};
|
||||
const roughCut = () => {
|
||||
let cursor = 0;
|
||||
const clips = project.media.map((asset, index) => {
|
||||
const length = Math.min(asset.duration, asset.mediaType === "audio" ? 30 : 6);
|
||||
const next: EditorClip = {id: crypto.randomUUID(), assetId: asset.id, name: asset.name, track: asset.mediaType === "audio" ? 0 : 1 + index % 2, start: asset.mediaType === "audio" ? 0 : cursor, sourceStart: 0, sourceEnd: length, speed: 1, volume: asset.mediaType === "audio" ? 35 : 100, muted: false, fadeIn: asset.mediaType === "audio" ? 1 : 0, fadeOut: asset.mediaType === "audio" ? 1 : 0};
|
||||
if (asset.mediaType === "video") cursor += length;
|
||||
return next;
|
||||
});
|
||||
commit({...project, clips});
|
||||
setSelectedClipId(clips.find((item) => item.track > 0)?.id ?? clips[0]?.id ?? null);
|
||||
};
|
||||
const splitClip = (target: EditorClip, timelineTime: number) => {
|
||||
const local = timelineTime - target.start;
|
||||
const length = clipDuration(target);
|
||||
if (local <= 0.05 || local >= length - 0.05) return;
|
||||
const sourcePoint = target.sourceStart + local * target.speed;
|
||||
const right: EditorClip = {...target, id: crypto.randomUUID(), name: `${target.name} B`, start: timelineTime, sourceStart: sourcePoint, fadeIn: 0};
|
||||
const left: EditorClip = {...target, name: `${target.name} A`, sourceEnd: sourcePoint, fadeOut: 0};
|
||||
commit({...project, clips: project.clips.flatMap((item) => item.id === target.id ? [left, right] : [item])});
|
||||
setSelectedClipId(right.id);
|
||||
};
|
||||
const splitAtPlayhead = () => {if (clip) splitClip(clip, frame / project.fps);};
|
||||
const rippleDelete = () => {
|
||||
if (!clip) return;
|
||||
const removedDuration = clipDuration(clip);
|
||||
const removedEnd = clip.start + removedDuration;
|
||||
commit({...project, clips: project.clips.filter((item) => item.id !== clip.id).map((item) => item.start >= removedEnd ? {...item, start: Math.max(0, item.start - removedDuration)} : item)});
|
||||
setSelectedClipId(null);
|
||||
};
|
||||
const closeGaps = () => {
|
||||
let cursor = 0;
|
||||
const video = project.clips.filter((item) => item.track > 0).sort((a, b) => a.start - b.start).map((item) => {const next = {...item, start: cursor}; cursor += clipDuration(item); return next;});
|
||||
const byId = new Map(video.map((item) => [item.id, item]));
|
||||
commit({...project, clips: project.clips.map((item) => byId.get(item.id) ?? item)});
|
||||
};
|
||||
const duplicateClip = () => {
|
||||
if (!clip) return;
|
||||
const copy = {...clip, id: crypto.randomUUID(), name: `${clip.name} Kopie`, start: clip.start + clipDuration(clip)};
|
||||
commit({...project, clips: [...project.clips, copy]});
|
||||
setSelectedClipId(copy.id);
|
||||
};
|
||||
const timeFromPointer = (clientX: number) => {
|
||||
const rect = timeline.current?.getBoundingClientRect();
|
||||
return rect ? Math.max(0, Math.min(duration, (clientX - rect.left) / rect.width * duration)) : 0;
|
||||
};
|
||||
const scrub = (event: React.PointerEvent) => {
|
||||
const seek = (x: number) => player.current?.seekTo(Math.round(timeFromPointer(x) * project.fps));
|
||||
seek(event.clientX);
|
||||
const move = (pointer: PointerEvent) => seek(pointer.clientX);
|
||||
const up = () => {window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", up);};
|
||||
window.addEventListener("pointermove", move); window.addEventListener("pointerup", up);
|
||||
};
|
||||
const dragClip = (event: React.PointerEvent, target: EditorClip, mode: "move" | "in" | "out") => {
|
||||
event.stopPropagation();
|
||||
const rect = timeline.current?.getBoundingClientRect();
|
||||
if (!rect) return;
|
||||
const originX = event.clientX;
|
||||
const original = {...target};
|
||||
const move = (pointer: PointerEvent) => {
|
||||
const delta = (pointer.clientX - originX) / rect.width * duration;
|
||||
let patch: Partial<EditorClip> = {};
|
||||
if (mode === "move") {
|
||||
let start = Math.max(0, original.start + delta);
|
||||
if (snapping) {
|
||||
const points = [0, ...project.clips.filter((item) => item.id !== target.id).flatMap((item) => [item.start, item.start + clipDuration(item)])];
|
||||
const length = clipDuration(original);
|
||||
for (const point of points) {
|
||||
if (Math.abs(start - point) < 0.16) start = point;
|
||||
if (Math.abs(start + length - point) < 0.16) start = Math.max(0, point - length);
|
||||
}
|
||||
}
|
||||
patch = {start};
|
||||
}
|
||||
if (mode === "in") patch = {sourceStart: Math.max(0, Math.min(original.sourceEnd - .1, original.sourceStart + delta * original.speed)), start: Math.max(0, original.start + delta)};
|
||||
if (mode === "out") patch = {sourceEnd: Math.max(original.sourceStart + .1, original.sourceEnd + delta * original.speed)};
|
||||
commit({...project, clips: project.clips.map((item) => item.id === target.id ? {...item, ...patch} : item)});
|
||||
};
|
||||
const up = () => {window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", up);};
|
||||
window.addEventListener("pointermove", move);
|
||||
window.addEventListener("pointerup", up);
|
||||
};
|
||||
const clipPointerDown = (event: React.PointerEvent, target: EditorClip) => {
|
||||
setSelectedClipId(target.id);
|
||||
if (tool === "razor") {
|
||||
event.stopPropagation();
|
||||
splitClip(target, timeFromPointer(event.clientX));
|
||||
} else dragClip(event, target, "move");
|
||||
};
|
||||
|
||||
return <section className="cut-workspace">
|
||||
<aside className="media-bin cut-panel"><div className="cut-panel-head"><div><FolderOpen /><b>PROJEKT: MEDIEN</b></div><label className={uploading ? "loading" : ""}><Upload />{uploading ? "Import..." : "Import"}<input type="file" multiple accept="video/*,audio/*" onChange={(event) => upload(event.target.files)} /></label></div><div className="media-grid">{project.media.map((asset) => <div className="media-item" key={asset.id}><div className={`media-preview ${asset.mediaType}`}>{asset.mediaType === "video" ? <video src={asset.url} muted /> : <AudioLines />}<span>{clock(asset.duration)}</span></div><b>{asset.name}</b><small>{asset.mediaType.toUpperCase()} · {(asset.size / 1048576).toFixed(1)} MB</small><div><button onClick={() => addAsset(asset)}><Plus /> Timeline</button><button onClick={() => removeAsset(asset)}><Trash2 /></button></div></div>)}</div>{!project.media.length && <div className="media-empty"><ImagePlus /><b>Medien importieren</b><span>Videos und Audiodateien hier hinzufügen.</span></div>}</aside>
|
||||
<section className="program-panel cut-panel"><div className="cut-panel-head"><div><Film /><b>PROGRAM MONITOR</b></div><span>{size.width} × {size.height} · {project.fps} FPS</span></div><div className="program-stage"><Player ref={player} component={PDEVVideo} inputProps={project} durationInFrames={frames} compositionWidth={size.width} compositionHeight={size.height} fps={project.fps} style={{width: "100%", height: "100%"}} acknowledgeRemotionLicense /></div><div className="program-transport"><span>{clock(frame / project.fps)}</span><button onClick={() => frame > 0 && player.current?.seekTo(frame - 1)}>‹</button><button className="play" onClick={() => playing ? player.current?.pause() : player.current?.play()}>{playing ? <Pause /> : <Play fill="currentColor" />}</button><button onClick={() => frame < frames - 1 && player.current?.seekTo(frame + 1)}>›</button><span>{clock(duration)}</span></div></section>
|
||||
<aside className="clip-inspector cut-panel"><div className="cut-panel-head"><div><Scissors /><b>EFFECT CONTROLS</b></div></div>{clip ? <div className="clip-controls"><Field label="Clip"><input value={clip.name} onChange={(event) => patchClip(clip.id, {name: event.target.value})} /></Field><Field label="Videospur"><select value={clip.track} onChange={(event) => patchClip(clip.id, {track: Number(event.target.value)})}><option value={3}>V3</option><option value={2}>V2</option><option value={1}>V1</option><option value={0}>A1</option></select></Field><div className="cut-dual"><Field label="Timeline Start"><input type="number" step=".1" value={clip.start.toFixed(2)} onChange={(event) => patchClip(clip.id, {start: Number(event.target.value)})} /></Field><Field label="Dauer"><input value={clipDuration(clip).toFixed(2)} readOnly /></Field></div><div className="cut-dual"><Field label="Source In"><input type="number" step=".1" min="0" value={clip.sourceStart.toFixed(2)} onChange={(event) => patchClip(clip.id, {sourceStart: Number(event.target.value)})} /></Field><Field label="Source Out"><input type="number" step=".1" value={clip.sourceEnd.toFixed(2)} onChange={(event) => patchClip(clip.id, {sourceEnd: Number(event.target.value)})} /></Field></div><Field label={`Geschwindigkeit · ${Math.round(clip.speed * 100)}%`}><div className="range-icon"><Gauge /><input type="range" min=".25" max="3" step=".05" value={clip.speed} onChange={(event) => patchClip(clip.id, {speed: Number(event.target.value)})} /></div></Field><Field label={`Lautstärke · ${clip.volume}%`}><div className="range-icon"><Volume2 /><input type="range" min="0" max="150" value={clip.volume} onChange={(event) => patchClip(clip.id, {volume: Number(event.target.value)})} /></div></Field><div className="cut-dual"><Field label={`Fade In · ${clip.fadeIn.toFixed(1)}s`}><input type="range" min="0" max={Math.max(.1, clipDuration(clip) / 2)} step=".1" value={clip.fadeIn} onChange={(event) => patchClip(clip.id, {fadeIn: Number(event.target.value)})} /></Field><Field label={`Fade Out · ${clip.fadeOut.toFixed(1)}s`}><input type="range" min="0" max={Math.max(.1, clipDuration(clip) / 2)} step=".1" value={clip.fadeOut} onChange={(event) => patchClip(clip.id, {fadeOut: Number(event.target.value)})} /></Field></div><button className={`mute-clip ${clip.muted ? "active" : ""}`} onClick={() => patchClip(clip.id, {muted: !clip.muted})}>{clip.muted ? <VolumeX /> : <Volume2 />} {clip.muted ? "Stumm" : "Audio aktiv"}</button><div className="clip-action-row"><button onClick={splitAtPlayhead}><Scissors /> Split</button><button onClick={duplicateClip}><Copy /> Duplizieren</button></div><button className="delete-layer" onClick={rippleDelete}><Trash2 /> Ripple Delete</button></div> : <div className="no-clip"><Scissors /><span>Wähle einen Clip in der Timeline.</span></div>}</aside>
|
||||
<section className={`edit-timeline cut-panel tool-${tool}`}><div className="edit-timeline-head"><div className="edit-title"><div><b>SEQUENZ 01</b><span>{project.clips.length} Clips · {clock(duration)}</span></div><div className="timeline-toolbox"><button className={tool === "select" ? "active" : ""} title="Auswahl (V)" onClick={() => setTool("select")}><MousePointer2 /></button><button className={tool === "razor" ? "active" : ""} title="Rasierklinge (C)" onClick={() => setTool("razor")}><Scissors /></button><button className={snapping ? "active" : ""} title="Snapping" onClick={() => setSnapping(!snapping)}><Magnet /></button><button title="Split am Playhead (Strg+K)" onClick={splitAtPlayhead}><Scissors /><span>Split</span></button><button title="Lücken schließen" onClick={closeGaps}><Rows3 /><span>Gaps</span></button></div></div><div><button className="ai-cut" disabled={!project.media.length} onClick={roughCut}><Bot /> AI Rough Cut</button><button onClick={() => setZoom(100)}>Fit</button><input type="range" min="100" max="350" value={zoom} onChange={(event) => setZoom(Number(event.target.value))} /><button className="export-cut" onClick={render}><Sparkles /> Export</button></div></div><div className="edit-timeline-scroll"><div className="edit-timeline-content" style={{width: `${zoom}%`}}><div className="edit-ruler"><div>TIMECODE</div><section ref={timeline} onPointerDown={scrub}>{Array.from({length: Math.ceil(duration) + 1}, (_, index) => <span key={index} style={{left: `${index / duration * 100}%`}}>{index % 2 === 0 ? clock(index) : "·"}</span>)}</section></div>{[3,2,1,0].map((track) => <div className="edit-track" key={track}><div className="edit-track-label"><b>{track === 0 ? "A1" : `V${track}`}</b><span>{track === 0 ? <AudioLines /> : <Film />}</span></div><div className="edit-track-lane" onPointerDown={scrub}>{project.clips.filter((item) => item.track === track).map((item) => <div key={item.id} className={`edit-clip ${item.id === selectedClipId ? "selected" : ""} ${track === 0 ? "audio" : ""}`} onPointerDown={(event) => clipPointerDown(event, item)} style={{left: `${item.start / duration * 100}%`, width: `${clipDuration(item) / duration * 100}%`}}><i className="edit-trim in" onPointerDown={(event) => dragClip(event, item, "in")} />{item.fadeIn > 0 && <i className="fade-ramp fade-in" style={{width: `${Math.min(50, item.fadeIn / clipDuration(item) * 100)}%`}} />}{item.fadeOut > 0 && <i className="fade-ramp fade-out" style={{width: `${Math.min(50, item.fadeOut / clipDuration(item) * 100)}%`}} />}<span>{track === 0 ? <AudioLines /> : <Film />}</span><b>{item.name}</b><small>{clock(clipDuration(item))}</small><i className="edit-trim out" onPointerDown={(event) => dragClip(event, item, "out")} /></div>)}</div></div>)}<div className="edit-playhead" style={{left: `calc(78px + ${(frame / frames) * 100}% - ${(frame / frames) * 78}px)`}}><i /><span>{clock(frame / project.fps)}</span></div></div></div></section>
|
||||
</section>;
|
||||
}
|
||||
|
||||
function Field({label, children}: {label: string; children: React.ReactNode}) {return <label className="field"><span>{label}</span>{children}</label>;}
|
||||
@@ -0,0 +1,6 @@
|
||||
import React from "react";
|
||||
import {createRoot} from "react-dom/client";
|
||||
import {App} from "./App";
|
||||
import "./styles.css";
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<React.StrictMode><App /></React.StrictMode>);
|
||||
@@ -0,0 +1,9 @@
|
||||
import React from "react";
|
||||
import {Composition} from "remotion";
|
||||
import {defaultProject, dimensions, projectFrames} from "../types";
|
||||
import {PDEVVideo} from "./Video";
|
||||
|
||||
export const RemotionRoot: React.FC = () => {
|
||||
const size = dimensions[defaultProject.format];
|
||||
return <Composition id="PDEVVideo" component={PDEVVideo} durationInFrames={projectFrames(defaultProject)} fps={defaultProject.fps} width={size.width} height={size.height} defaultProps={defaultProject} />;
|
||||
};
|
||||
@@ -0,0 +1,178 @@
|
||||
import React from "react";
|
||||
import {AbsoluteFill, Audio, Easing, Img, interpolate, OffthreadVideo, Sequence, spring, useCurrentFrame, useVideoConfig} from "remotion";
|
||||
import {clipDuration, type AnimatableProperty, type EditorClip, type LayerKeyframe, type MediaAsset, type SceneEffect, type VideoLayer, type VideoProject, type VideoScene} from "../types";
|
||||
|
||||
const fontFamilies = {
|
||||
modern: "Inter, Arial, sans-serif",
|
||||
editorial: "Georgia, Times New Roman, serif",
|
||||
mono: "Consolas, Courier New, monospace",
|
||||
};
|
||||
|
||||
const hexToRgba = (hex: string, alpha: number) => {
|
||||
const value = hex.replace("#", "");
|
||||
const normalized = value.length === 3 ? value.split("").map((x) => x + x).join("") : value;
|
||||
const number = Number.parseInt(normalized, 16);
|
||||
return `rgba(${(number >> 16) & 255}, ${(number >> 8) & 255}, ${number & 255}, ${alpha})`;
|
||||
};
|
||||
|
||||
const Background: React.FC<{scene: VideoScene; base: string}> = ({scene, base}) => {
|
||||
const frame = useCurrentFrame();
|
||||
const {width, height} = useVideoConfig();
|
||||
return (
|
||||
<AbsoluteFill style={{background: base, overflow: "hidden"}}>
|
||||
<AbsoluteFill style={{backgroundImage: `linear-gradient(${hexToRgba(scene.accent, 0.08)} 1px, transparent 1px), linear-gradient(90deg, ${hexToRgba(scene.accent, 0.08)} 1px, transparent 1px)`, backgroundSize: `${Math.max(42, width / 18)}px ${Math.max(42, width / 18)}px`, transform: `translateY(${(frame * 0.35) % 60}px)`, maskImage: "radial-gradient(circle at 50% 46%, black, transparent 72%)"}} />
|
||||
<div style={{position: "absolute", width: width * 1.15, height: width * 1.15, borderRadius: "50%", left: -width * 0.35 + Math.sin(frame / 45) * 30, top: -width * 0.42, background: `radial-gradient(circle, ${hexToRgba(scene.accent, 0.3)}, transparent 66%)`, filter: "blur(18px)"}} />
|
||||
<div style={{position: "absolute", width: width * 0.75, height: width * 0.75, borderRadius: "50%", right: -width * 0.35, bottom: height * 0.02, border: `2px solid ${hexToRgba(scene.accent, 0.28)}`}} />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
|
||||
const effect = (scene: VideoScene, type: SceneEffect["type"]) => scene.effects.find((item) => item.enabled && item.type === type);
|
||||
|
||||
const SceneEffects: React.FC<{scene: VideoScene}> = ({scene}) => {
|
||||
const frame = useCurrentFrame();
|
||||
const {width, height} = useVideoConfig();
|
||||
const grain = effect(scene, "grain");
|
||||
const vignette = effect(scene, "vignette");
|
||||
const scanlines = effect(scene, "scanlines");
|
||||
const chromatic = effect(scene, "chromatic");
|
||||
const particles = effect(scene, "particles");
|
||||
return <AbsoluteFill style={{pointerEvents: "none", overflow: "hidden"}}>
|
||||
{particles && <AbsoluteFill>{Array.from({length: Math.round(12 + particles.amount * 0.38)}, (_, index) => {
|
||||
const seed = (index * 73) % 101;
|
||||
const size = 2 + (index * 17) % 7;
|
||||
const travel = (frame * (0.45 + particles.speed / 75) + seed * 19) % (height + 100);
|
||||
return <div key={index} style={{position: "absolute", left: `${(index * 47) % 100}%`, top: height - travel, width: size, height: size, borderRadius: "50%", background: particles.color, opacity: 0.12 + (seed % 30) / 100, boxShadow: `0 0 ${size * 3}px ${particles.color}`}} />;
|
||||
})}</AbsoluteFill>}
|
||||
{chromatic && <AbsoluteFill style={{boxShadow: `inset ${chromatic.amount * 0.12}px 0 ${chromatic.amount * 0.3}px ${hexToRgba("#ff1744", 0.22)}, inset ${-chromatic.amount * 0.12}px 0 ${chromatic.amount * 0.3}px ${hexToRgba("#00e5ff", 0.22)}`, mixBlendMode: "screen", opacity: 0.45 + Math.sin(frame * chromatic.speed / 90) * 0.15}} />}
|
||||
{scanlines && <AbsoluteFill style={{backgroundImage: `repeating-linear-gradient(0deg, transparent 0, transparent ${Math.max(2, 8 - scanlines.amount / 18)}px, ${hexToRgba(scanlines.color, 0.12)} ${Math.max(3, 9 - scanlines.amount / 18)}px)`, backgroundPositionY: frame * scanlines.speed / 50, mixBlendMode: "screen", opacity: scanlines.amount / 100}} />}
|
||||
{grain && <AbsoluteFill style={{inset: -width * 0.1, backgroundImage: `repeating-conic-gradient(from ${(frame * grain.speed) % 360}deg at ${(frame * 17) % 100}% ${(frame * 29) % 100}%, ${hexToRgba(grain.color, 0.13)} 0deg, transparent 3deg, ${hexToRgba(grain.color, 0.08)} 5deg, transparent 8deg)`, backgroundSize: `${18 + frame % 7}px ${21 + frame % 5}px`, mixBlendMode: "soft-light", opacity: grain.amount / 130, transform: `translate(${frame % 3 * 3}px, ${frame % 2 * 4}px)`}} />}
|
||||
{vignette && <AbsoluteFill style={{background: `radial-gradient(ellipse at center, transparent ${Math.max(15, 58 - vignette.amount * 0.35)}%, ${hexToRgba(vignette.color, Math.min(0.92, vignette.amount / 105))} 100%)`}} />}
|
||||
</AbsoluteFill>;
|
||||
};
|
||||
|
||||
const easingFor = (easing: LayerKeyframe["easing"]) => easing === "ease-in" ? Easing.in(Easing.cubic) : easing === "ease-out" ? Easing.out(Easing.cubic) : easing === "ease-in-out" ? Easing.inOut(Easing.cubic) : Easing.linear;
|
||||
|
||||
const animatedValue = (layer: VideoLayer, property: AnimatableProperty, time: number) => {
|
||||
const base = layer[property];
|
||||
const keys = layer.keyframes.filter((key) => key.property === property).sort((a, b) => a.time - b.time);
|
||||
if (!keys.length) return base;
|
||||
if (time <= keys[0].time) return keys[0].value;
|
||||
if (time >= keys[keys.length - 1].time) return keys[keys.length - 1].value;
|
||||
const nextIndex = keys.findIndex((key) => key.time >= time);
|
||||
const previous = keys[nextIndex - 1];
|
||||
const next = keys[nextIndex];
|
||||
return interpolate(time, [previous.time, next.time], [previous.value, next.value], {easing: easingFor(next.easing), extrapolateLeft: "clamp", extrapolateRight: "clamp"});
|
||||
};
|
||||
|
||||
const CustomLayer: React.FC<{layer: VideoLayer}> = ({layer}) => {
|
||||
const frame = useCurrentFrame();
|
||||
const {fps} = useVideoConfig();
|
||||
const time = frame / fps;
|
||||
if (!layer.visible || time < layer.start || time > layer.end) return null;
|
||||
const x = animatedValue(layer, "x", time);
|
||||
const y = animatedValue(layer, "y", time);
|
||||
const scale = animatedValue(layer, "scale", time);
|
||||
const rotation = animatedValue(layer, "rotation", time);
|
||||
const opacity = animatedValue(layer, "opacity", time);
|
||||
const style: React.CSSProperties = {
|
||||
position: "absolute", left: `${x}%`, top: `${y}%`, width: `${layer.width}%`, height: `${layer.height}%`,
|
||||
transform: `translate(-50%, -50%) scale(${scale / 100}) rotate(${rotation}deg)`, opacity: opacity / 100,
|
||||
mixBlendMode: layer.blendMode, display: "flex", alignItems: "center", justifyContent: "center",
|
||||
};
|
||||
if (layer.type === "image") return <div style={style}><Img src={layer.source} style={{width: "100%", height: "100%", objectFit: "contain", borderRadius: layer.borderRadius}} /></div>;
|
||||
if (layer.type === "shape") return <div style={{...style, background: layer.color, borderRadius: layer.borderRadius, boxShadow: `0 0 40px ${hexToRgba(layer.color, 0.24)}`}} />;
|
||||
return <div style={{...style, color: layer.color, fontSize: layer.fontSize, fontWeight: 800, lineHeight: 1.05, textAlign: "center", whiteSpace: "pre-wrap"}}>{layer.text}</div>;
|
||||
};
|
||||
|
||||
const LayerComposition: React.FC<{scene: VideoScene}> = ({scene}) => <AbsoluteFill>{scene.layers.map((layer) => <CustomLayer key={layer.id} layer={layer} />)}</AbsoluteFill>;
|
||||
|
||||
const SceneContent: React.FC<{scene: VideoScene; project: VideoProject; index: number}> = ({scene, project, index}) => {
|
||||
const frame = useCurrentFrame();
|
||||
const {fps, width, height} = useVideoConfig();
|
||||
const entranceFrames = Math.max(1, scene.motion.entranceDuration * fps);
|
||||
const exitFrames = Math.max(1, scene.motion.exitDuration * fps);
|
||||
const entrance = scene.motion.entrance === "elastic"
|
||||
? spring({frame, fps, durationInFrames: entranceFrames, config: {damping: 8, stiffness: 130}})
|
||||
: interpolate(frame, [0, entranceFrames], [0, 1], {extrapolateRight: "clamp"});
|
||||
const leave = interpolate(frame, [scene.duration * fps - exitFrames, scene.duration * fps], [1, 0], {extrapolateLeft: "clamp", extrapolateRight: "clamp"});
|
||||
const transitionFrames = Math.max(1, scene.motion.transitionDuration * fps);
|
||||
const transition = interpolate(frame, [0, transitionFrames], [0, 1], {extrapolateRight: "clamp"});
|
||||
const landscape = width > height;
|
||||
const pad = width * (landscape ? 0.09 : 0.075);
|
||||
const titleSize = Math.min(width * (landscape ? 0.075 : 0.112), height * 0.13);
|
||||
const common: React.CSSProperties = {fontFamily: fontFamilies[project.font], color: project.textColor};
|
||||
const shake = effect(scene, "shake");
|
||||
const drift = effect(scene, "drift");
|
||||
const bloom = effect(scene, "bloom");
|
||||
const chromatic = effect(scene, "chromatic");
|
||||
const motionX = (shake ? Math.sin(frame * (0.7 + shake.speed / 25)) * shake.amount * 0.12 : 0) + (drift ? Math.sin(frame * drift.speed / 650) * drift.amount * 0.28 : 0);
|
||||
const motionY = (shake ? Math.cos(frame * (0.9 + shake.speed / 22)) * shake.amount * 0.08 : 0) + (drift ? Math.cos(frame * drift.speed / 720) * drift.amount * 0.2 : 0);
|
||||
const entranceTransform = scene.motion.entrance === "rise" ? `translateY(${(1 - entrance) * 110}px)` : scene.motion.entrance === "slide" ? `translateX(${(1 - entrance) * -width * 0.28}px)` : scene.motion.entrance === "zoom" ? `scale(${0.72 + entrance * 0.28})` : "";
|
||||
const transitionTransform = scene.motion.transition === "slide" ? `translateX(${(1 - transition) * width}px)` : scene.motion.transition === "zoom" ? `scale(${1.3 - transition * 0.3})` : scene.motion.transition === "glitch" ? `translateX(${Math.sin(frame * 14) * (1 - transition) * 35}px) skewX(${(1 - transition) * 5}deg)` : "";
|
||||
const clipPath = scene.motion.transition === "wipe" ? `inset(0 ${(1 - transition) * 100}% 0 0)` : undefined;
|
||||
const block = (
|
||||
<div style={{maxWidth: landscape ? width * 0.72 : width * 0.86}}>
|
||||
<div style={{fontSize: Math.max(20, width * 0.023), letterSpacing: width * 0.006, fontWeight: 800, color: scene.accent, marginBottom: height * 0.025}}>{scene.eyebrow}</div>
|
||||
<div style={{fontSize: titleSize, lineHeight: 0.96, letterSpacing: -titleSize * 0.045, fontWeight: 850, whiteSpace: "pre-line"}}>{scene.title}</div>
|
||||
<div style={{fontSize: Math.max(26, width * (landscape ? 0.026 : 0.044)), lineHeight: 1.35, color: hexToRgba(project.textColor, 0.68), marginTop: height * 0.035, maxWidth: width * 0.7}}>{scene.body}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<AbsoluteFill style={{...common, opacity: leave * (scene.motion.entrance === "fade" ? entrance : 1) * (scene.motion.transition === "fade" ? transition : 1), transform: `${transitionTransform} translate(${motionX}px, ${motionY}px)`, clipPath}}>
|
||||
<Background scene={scene} base={project.background} />
|
||||
<AbsoluteFill style={{transform: entranceTransform, filter: `${bloom ? `drop-shadow(0 0 ${8 + bloom.amount * 0.4}px ${hexToRgba(bloom.color, 0.7)})` : ""} ${chromatic ? `drop-shadow(${chromatic.amount * 0.07}px 0 ${hexToRgba("#ff1744", 0.7)}) drop-shadow(${-chromatic.amount * 0.07}px 0 ${hexToRgba("#00e5ff", 0.7)})` : ""}`}}>
|
||||
<div style={{position: "absolute", left: pad, right: pad, top: pad * 0.65, display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: Math.max(18, width * 0.018), letterSpacing: 4, fontWeight: 800}}>
|
||||
<span>PDEV / STUDIO</span><span style={{color: hexToRgba(project.textColor, 0.4)}}>{String(index + 1).padStart(2, "0")}</span>
|
||||
</div>
|
||||
<div style={{position: "absolute", inset: 0, padding: pad, display: "flex", alignItems: scene.layout === "outro" ? "center" : "center", justifyContent: scene.layout === "outro" ? "center" : "flex-start", textAlign: scene.layout === "outro" ? "center" : "left", transform: `translateY(${(1 - entrance) * 90}px)`}}>
|
||||
{scene.layout === "stat" ? (
|
||||
<div><div style={{fontSize: Math.min(width * 0.32, height * 0.42), lineHeight: 0.8, fontWeight: 900, color: scene.accent, letterSpacing: -20}}>{scene.title}</div><div style={{fontSize: Math.max(28, width * 0.045), maxWidth: width * 0.72, marginTop: height * 0.08, lineHeight: 1.25}}>{scene.body}</div></div>
|
||||
) : scene.layout === "steps" ? (
|
||||
<div style={{width: "100%"}}>{block}<div style={{display: "flex", gap: 18, marginTop: height * 0.07}}>{["Idee", "Schnitt", "Export"].map((step, i) => <div key={step} style={{flex: 1, borderTop: `5px solid ${i === 1 ? scene.accent : hexToRgba(project.textColor, 0.18)}`, paddingTop: 18, fontSize: Math.max(20, width * 0.025)}}>{`0${i + 1}`}<br/><b>{step}</b></div>)}</div></div>
|
||||
) : block}
|
||||
</div>
|
||||
<div style={{position: "absolute", left: pad, right: pad, bottom: pad * 0.65, height: 4, background: hexToRgba(project.textColor, 0.12)}}><div style={{height: "100%", width: `${interpolate(frame, [0, scene.duration * fps], [0, 100], {extrapolateRight: "clamp"})}%`, background: scene.accent}} /></div>
|
||||
</AbsoluteFill>
|
||||
<LayerComposition scene={scene} />
|
||||
<SceneEffects scene={scene} />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
|
||||
const CutMediaClip: React.FC<{clip: EditorClip; asset: MediaAsset; fps: number}> = ({clip, asset, fps}) => {
|
||||
const frame = useCurrentFrame();
|
||||
const durationFrames = clipDuration(clip) * fps;
|
||||
const fadeIn = clip.fadeIn > 0 ? interpolate(frame, [0, clip.fadeIn * fps], [0, 1], {extrapolateRight: "clamp"}) : 1;
|
||||
const fadeOut = clip.fadeOut > 0 ? interpolate(frame, [durationFrames - clip.fadeOut * fps, durationFrames], [1, 0], {extrapolateLeft: "clamp"}) : 1;
|
||||
const level = Math.min(fadeIn, fadeOut);
|
||||
const trimBefore = Math.max(0, Math.round(clip.sourceStart * fps));
|
||||
const volume = clip.muted ? 0 : clip.volume / 100 * level;
|
||||
return asset.mediaType === "audio"
|
||||
? <Audio src={asset.url} trimBefore={trimBefore} playbackRate={clip.speed} volume={volume} />
|
||||
: <OffthreadVideo src={asset.url} trimBefore={trimBefore} playbackRate={clip.speed} volume={volume} style={{width: "100%", height: "100%", objectFit: "contain", opacity: level}} />;
|
||||
};
|
||||
|
||||
const CutComposition: React.FC<VideoProject> = (project) => <AbsoluteFill style={{background: "#050608"}}>
|
||||
{[...project.clips].sort((a, b) => a.track - b.track).map((clip) => {
|
||||
const asset = project.media.find((item) => item.id === clip.assetId);
|
||||
if (!asset) return null;
|
||||
const from = Math.max(0, Math.round(clip.start * project.fps));
|
||||
const durationInFrames = Math.max(1, Math.round(clipDuration(clip) * project.fps));
|
||||
return <Sequence key={clip.id} from={from} durationInFrames={durationInFrames} name={clip.name}>
|
||||
<CutMediaClip clip={clip} asset={asset} fps={project.fps} />
|
||||
</Sequence>;
|
||||
})}
|
||||
</AbsoluteFill>;
|
||||
|
||||
export const PDEVVideo: React.FC<VideoProject> = (project) => {
|
||||
if (project.activeMode === "cut") return <CutComposition {...project} />;
|
||||
let from = 0;
|
||||
return <AbsoluteFill style={{background: project.background}}>{project.scenes.map((scene, index) => {
|
||||
const duration = Math.max(1, Math.round(scene.duration * project.fps));
|
||||
const start = from;
|
||||
from += duration;
|
||||
return <Sequence key={scene.id} from={start} durationInFrames={duration}><SceneContent scene={scene} project={project} index={index} /></Sequence>;
|
||||
})}</AbsoluteFill>;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
import {registerRoot} from "remotion";
|
||||
import {RemotionRoot} from "./Root";
|
||||
|
||||
registerRoot(RemotionRoot);
|
||||
@@ -0,0 +1,56 @@
|
||||
:root { color-scheme: dark; font-family: Inter, "Segoe UI", Arial, sans-serif; background: #080a0f; color: #edf0f7; font-synthesis: none; }
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; }
|
||||
button, input, textarea, select { font: inherit; }
|
||||
button { color: inherit; }
|
||||
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 2px; }
|
||||
.studio-shell { min-height: 100vh; padding: 12px; background: radial-gradient(circle at 50% -20%, #1b1630 0, transparent 36%), #080a0f; }
|
||||
.panel { background: rgba(15, 18, 27, .94); border: 1px solid #242936; box-shadow: 0 20px 70px rgba(0,0,0,.22); }
|
||||
.topbar { height: 58px; display: grid; grid-template-columns: 280px 1fr 280px; align-items: center; border: 1px solid #242936; background: rgba(12,14,21,.9); border-radius: 12px 12px 6px 6px; padding: 0 14px; }
|
||||
.brand { display: flex; align-items: center; gap: 10px; }
|
||||
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #7c5cff; background: linear-gradient(145deg,#7c5cff22,#22d3aa16); border-radius: 10px; color: #a78bfa; box-shadow: inset 0 0 16px #8b5cf625; }
|
||||
.brand strong { font-size: 15px; letter-spacing: 2px; display: block; }.brand span { color: #666f82; font-size: 8px; letter-spacing: 2.3px; }
|
||||
.project-name { justify-self: center; display: flex; align-items: center; gap: 8px; border: 1px solid #282e3b; border-radius: 8px; padding: 5px 10px; background: #11141d; }
|
||||
.project-name input { color: #dfe3ec; background: transparent; border: 0; text-align: center; width: 220px; font-size: 12px; }
|
||||
.status-dot { width: 6px; height: 6px; background: #34d399; border-radius: 50%; box-shadow: 0 0 8px #34d399; }
|
||||
.top-actions { justify-self: end; display: flex; gap: 7px; align-items: center; }
|
||||
.icon-button { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid transparent; background: transparent; border-radius: 7px; cursor: pointer; color: #8e97aa; }.icon-button:hover { background: #202532; color: #fff; }.icon-button:disabled { opacity: .25; cursor: default; }.icon-button svg { width: 15px; }
|
||||
.button { height: 34px; display: inline-flex; gap: 7px; align-items: center; justify-content: center; border: 1px solid #303746; border-radius: 8px; padding: 0 13px; background: #171b25; cursor: pointer; font-size: 11px; font-weight: 700; text-decoration: none; }.button svg { width: 14px; }.button.render { border-color: #8b5cf6; background: linear-gradient(135deg,#7c4dff,#6242d9); box-shadow: 0 5px 24px #7548ff35; }
|
||||
.workspace { display: grid; grid-template-columns: 250px minmax(420px,1fr) 268px; min-height: 570px; height: calc(100vh - 306px); gap: 6px; margin-top: 6px; }
|
||||
.left-panel, .right-panel { overflow: hidden; }.left-panel { border-radius: 6px 0 0 6px; }.right-panel { border-radius: 0 6px 6px 0; overflow-y: auto; }
|
||||
.panel-tabs { height: 46px; padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-bottom: 1px solid #242936; }.panel-tabs button { border: 0; background: transparent; border-radius: 6px; color: #788195; font-size: 11px; font-weight: 700; cursor: pointer; }.panel-tabs button.active { color: white; background: #222735; }
|
||||
.panel-tabs.three { grid-template-columns: repeat(3,1fr); }
|
||||
.panel-tabs.four { grid-template-columns: repeat(4,1fr); }.panel-tabs.four button { font-size:9px; }
|
||||
.scene-list { padding: 9px; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; max-height: calc(100% - 100px); }
|
||||
.scene-card { position: relative; width: 100%; display: grid; grid-template-columns: 16px 20px 54px 1fr; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px; text-align: left; cursor: pointer; }.scene-card:hover { background: #171b25; }.scene-card.selected { border-color: #7958e9; background: linear-gradient(90deg,#7652db18,transparent); }.grip { color: #434a59; }.scene-number { font: 9px Consolas; color: #606a7c; }
|
||||
.scene-thumb { aspect-ratio: 16/10; display: flex; align-items: center; padding: 5px; border: 1px solid color-mix(in srgb,var(--accent),transparent 35%); background: radial-gradient(circle at 80% 10%,color-mix(in srgb,var(--accent),transparent 60%),#090b11 60%); border-radius: 5px; overflow: hidden; }.scene-thumb span { font-size: 5px; line-height: 1; font-weight: 800; text-transform: uppercase; }
|
||||
.scene-meta { min-width: 0; }.scene-meta b,.scene-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.scene-meta b { font-size: 10px; color: #ccd1dc; }.scene-meta span { font-size: 8px; color: #626c7e; margin-top: 3px; text-transform: capitalize; }
|
||||
.add-scene { width: calc(100% - 18px); margin: 2px 9px; height: 34px; border: 1px dashed #3a4150; border-radius: 7px; background: transparent; color: #8992a4; font-size: 10px; cursor: pointer; }.add-scene:hover { border-color: #8b5cf6; color: #b9a8ff; }
|
||||
.effects-browser { height: calc(100% - 46px); padding: 12px 9px; overflow-y: auto; }.browser-title { display:flex;align-items:center;gap:9px;padding:2px 4px 12px; }.browser-title > svg { width:19px;color:#a78bfa;filter:drop-shadow(0 0 8px #8b5cf6); }.browser-title b,.browser-title span { display:block; }.browser-title b { font-size:10px; }.browser-title span { margin-top:2px;color:#626c7e;font-size:8px; }.effect-grid { display:grid;grid-template-columns:1fr 1fr;gap:7px; }.effect-grid > button { position:relative;min-width:0;border:1px solid #282e3b;border-radius:8px;padding:7px;background:#10131b;text-align:left;cursor:pointer;overflow:hidden; }.effect-grid > button:hover { border-color:color-mix(in srgb,var(--fx),#303746 40%);transform:translateY(-1px);box-shadow:0 8px 20px #0005; }.effect-grid > button > b,.effect-grid > button > small { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }.effect-grid > button > b { margin-top:6px;font-size:8px; }.effect-grid > button > small { margin-top:2px;color:#5e687a;font-size:6px; }.effect-grid > button > svg { position:absolute;right:5px;top:5px;width:11px;color:#788296; }.fx-preview { position:relative;display:block;height:40px;border-radius:5px;background:radial-gradient(circle at 50% 50%,color-mix(in srgb,var(--fx),transparent 30%),transparent 65%),#080a0f;overflow:hidden; }.fx-preview i { position:absolute;inset:10px 22px;border:1px solid var(--fx);box-shadow:0 0 12px var(--fx); }.fx-preview.grain { background-image:repeating-conic-gradient(#ffffff18 0 2deg,transparent 3deg 7deg);background-size:9px 11px; }.fx-preview.vignette { background:radial-gradient(circle, #596175 0, #050608 75%); }.fx-preview.scanlines { background:repeating-linear-gradient(0deg,#0b1220 0 3px,color-mix(in srgb,var(--fx),transparent 60%) 4px); }.fx-preview.chromatic i { box-shadow:4px 0 #ff1744,-4px 0 #00e5ff; }.fx-preview.particles { background-image:radial-gradient(circle at 20% 25%,var(--fx) 0 1px,transparent 2px),radial-gradient(circle at 70% 65%,var(--fx) 0 2px,transparent 3px),radial-gradient(circle at 45% 80%,var(--fx) 0 1px,transparent 2px); }.fx-preview.shake i { transform:rotate(-5deg);box-shadow:4px 2px #ffffff30,-4px -2px #ffffff20; }.fx-preview.drift i { transform:translateX(8px);border-radius:50%; }
|
||||
.canvas-area { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; position: relative; background-color: #0a0c12; background-image: linear-gradient(45deg,#10131b 25%,transparent 25%),linear-gradient(-45deg,#10131b 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#10131b 75%),linear-gradient(-45deg,transparent 75%,#10131b 75%); background-size: 24px 24px; background-position: 0 0,0 12px,12px -12px,-12px 0; border: 1px solid #202531; overflow: hidden; }
|
||||
.canvas-toolbar { position: absolute; z-index: 4; top: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; color: #687286; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; }.canvas-toolbar span { display: flex; align-items:center; gap: 5px; }.preview-formats { padding: 3px; border: 1px solid #252b36; background: #11141d; border-radius: 6px; }.preview-formats button { border: 0; background: transparent; color: #6c7484; font-size: 9px; border-radius: 4px; cursor: pointer; }.preview-formats button.active { color: white; background: #2a3040; }
|
||||
.player-stage { position:relative; height: calc(100% - 100px); max-width: 78%; max-height: 78%; aspect-ratio: 9/16; background: black; box-shadow: 0 28px 90px #000b,0 0 0 1px #303645; }.player-stage.ratio-16-9 { aspect-ratio: 16/9; width: 75%; height: auto; }.player-stage.ratio-1-1 { aspect-ratio: 1; height: 68%; }
|
||||
.transport { position: absolute; bottom: 12px; left: 14%; right: 14%; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 10px; border: 1px solid #292f3c; background: #10131be8; backdrop-filter: blur(15px); border-radius: 10px; color: #778195; font: 9px Consolas; }.transport input { min-width: 0; flex: 1; }.transport-main { border: 0; background: transparent; color: white; display: grid; place-items: center; cursor: pointer; }.transport-main svg { width: 16px; }
|
||||
input[type="range"] { accent-color: #8b5cf6; height: 3px; }
|
||||
.inspector-head { height: 58px; padding: 11px 13px; display: flex; justify-content: space-between; border-bottom: 1px solid #242936; }.inspector-head span,.inspector-head b { display: block; }.inspector-head span { color: #626c7f; font-size: 8px; letter-spacing: 2px; }.inspector-head b { max-width: 160px; margin-top: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }.inspector-head > div:last-child { display: flex; }
|
||||
.inspector-body,.design-controls { padding: 13px; display: flex; flex-direction: column; gap: 15px; }
|
||||
.field { display: block; }.field > span { display: block; margin-bottom: 7px; color: #737d90; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; }.field input:not([type=color]):not([type=range]),.field textarea,.field select { width: 100%; border: 1px solid #2b3140; background: #0d1017; color: #d9dee8; border-radius: 7px; padding: 8px 9px; font-size: 10px; resize: vertical; }.field textarea { line-height: 1.45; }.field select { cursor: pointer; }
|
||||
.layout-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }.layout-grid button { height: 49px; border: 1px solid #292f3c; background: #11151e; border-radius: 6px; color: #6f788a; display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center; font-size: 8px; cursor: pointer; }.layout-grid button.active { border-color: #825ef1; color: #b9a7ff; background: #7957df16; }.layout-icon { width: 19px; height: 11px; display:block; border: 1px solid currentColor; position: relative; }.layout-icon:after { content:""; position:absolute; left:3px; top:3px; width:8px; border-top:2px solid currentColor; }.layout-icon.stat:after { width:4px; height:4px; border:2px solid; border-radius:50%; top:1px; }.layout-icon.steps:after { width:12px; box-shadow:0 3px currentColor; }.layout-icon.outro:after { left:5px; width:7px; }
|
||||
.color-row { display: grid; grid-template-columns: 34px 1fr; gap: 6px; }.color-row input[type=color] { width: 34px; height: 31px; padding: 2px; border: 1px solid #303746; background: #11151e; border-radius: 6px; }.segmented { display: flex; border:1px solid #2a303d; padding:3px; border-radius:7px; }.segmented button { flex:1; border:0; padding:6px; border-radius:4px; background:transparent; color:#697386; font-size:9px; cursor:pointer; }.segmented button.active { background:#2a3040;color:white; }
|
||||
.scene-actions { display: flex; gap: 6px; }.scene-actions button { flex: 1; display:flex;align-items:center;justify-content:center;gap:6px;height:31px;border:1px solid #2c3340;background:#141923;border-radius:6px;color:#7e889a;font-size:9px;cursor:pointer; }.scene-actions svg { width:12px; }.scene-actions button.danger { flex:0 0 35px;color:#e56c7c; }
|
||||
.inspector-section { margin:4px -13px -3px;padding:10px 13px 7px;border-top:1px solid #242936;display:flex;align-items:center;justify-content:space-between;color:#9aa4b7; }.inspector-section > span { display:flex;align-items:center;gap:6px;font-size:8px;font-weight:800;letter-spacing:1px;text-transform:uppercase; }.inspector-section svg { width:12px;color:#9d83f5; }.inspector-section small { color:#596477;font-size:7px; }.dual-field { display:grid;grid-template-columns:1fr 1fr;gap:8px; }.effect-stack { display:flex;flex-direction:column;gap:7px; }.effect-item { border:1px solid #2b3140;border-radius:7px;background:#0c0f16;overflow:hidden; }.effect-item.disabled { opacity:.45; }.effect-item-head { display:grid;grid-template-columns:12px 30px 1fr 20px 20px;align-items:center;gap:4px;height:30px;padding:0 6px;border-bottom:1px solid #222733; }.effect-item-head > svg { width:10px;color:#404958; }.effect-item-head b { overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:8px; }.effect-item-head button { display:grid;place-items:center;border:0;background:transparent;color:#6c7689;cursor:pointer;padding:0; }.effect-item-head button:hover { color:white; }.effect-item-head button.remove:hover { color:#f87186; }.effect-item-head button svg { width:11px; }.effect-index { font:6px Consolas;color:#856ce0; }.effect-params { padding:7px;display:grid;gap:5px; }.effect-params label { display:grid;grid-template-columns:35px 1fr 20px;align-items:center;gap:4px;color:#606b7d;font-size:7px; }.effect-params label b { font:7px Consolas;text-align:right;color:#858fa1; }.effect-params label input[type=range] { width:100%;min-width:0; }.effect-params label.mini-color { grid-template-columns:35px 28px; }.effect-params input[type=color] { width:28px;height:18px;padding:1px;border:1px solid #303746;border-radius:4px;background:#11151d; }.empty-effects { height:42px;border:1px dashed #3a4150;border-radius:7px;background:#0e1118;color:#8172b5;display:flex;align-items:center;justify-content:center;gap:6px;font-size:8px;cursor:pointer; }.empty-effects svg { width:12px; }
|
||||
.timeline { margin-top: 6px; height: 118px; border-radius: 6px; padding: 8px 14px; overflow: hidden; }.timeline-head { display:flex;justify-content:space-between;align-items:center;height:28px; }.timeline-head b,.timeline-head span { display:block; }.timeline-head b { font-size:10px; }.timeline-head span { color:#606a7c;font-size:8px;margin-top:2px; }.zoom { display:flex;gap:7px;align-items:center;color:#596375;font-size:9px; }.zoom input { width:70px; }.timeline-ruler { height:20px; margin-left:1px;display:flex;justify-content:space-between;align-items:end;color:#4d5666;font:7px Consolas;border-bottom:1px solid #292e39; }.timeline-track { position:relative;display:flex;gap:3px;height:49px;padding-top:4px; }.timeline-track button { position:relative; min-width:45px;border:1px solid color-mix(in srgb,var(--accent),transparent 55%);border-top:2px solid var(--accent);border-radius:4px;background:color-mix(in srgb,var(--accent) 10%,#11151e);padding:5px 6px;text-align:left;overflow:hidden;cursor:pointer; }.timeline-track button.active { box-shadow:0 0 0 1px var(--accent),0 0 18px color-mix(in srgb,var(--accent),transparent 75%); }.timeline-track button span { display:inline-grid;place-items:center;width:13px;height:13px;border-radius:3px;background:var(--accent);color:#090b11;font-size:7px;font-weight:900; }.timeline-track button b { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:8px;margin-top:4px; }.timeline-track button small { position:absolute;right:4px;top:5px;color:#657083;font-size:7px; }.playhead { position:absolute;z-index:4;top:0;bottom:0;width:1px;background:#f3f4f6;pointer-events:none; }.playhead:before { content:"";position:absolute;left:-3px;top:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:6px solid white; }
|
||||
.ai-dock { height: 92px; margin-top:6px;border-radius:6px 6px 12px 12px;display:grid;grid-template-columns:120px 1fr 160px;align-items:center;gap:12px;padding:12px 16px;background:linear-gradient(100deg,#141128,#10131b 35%,#10131b); }.ai-badge { display:flex;align-items:center;gap:9px;color:#ad96ff; }.ai-badge > svg { width:27px; }.ai-badge span { font-size:8px;letter-spacing:1.5px;color:#6f788b; }.ai-badge b { color:#bcaaff;font-size:10px; }.ai-dock textarea { height:56px;resize:none;border:1px solid #30294d;background:#0b0d15;border-radius:9px;color:#dfe3eb;padding:10px 12px;font-size:10px;line-height:1.45; }.ai-dock > button { height:40px;border:1px solid #7653e7;border-radius:8px;background:linear-gradient(135deg,#6f46e8,#5336b7);display:flex;align-items:center;justify-content:center;gap:7px;font-size:10px;font-weight:800;cursor:pointer; }.ai-dock > button:disabled { opacity:.7; }.ai-dock > button svg { width:15px; }.spinner { width:14px;height:14px;border:2px solid #ffffff50;border-top-color:white;border-radius:50%;animation:spin .7s linear infinite; }
|
||||
.render-modal-backdrop { position:fixed;z-index:100;inset:0;background:#030409cc;backdrop-filter:blur(8px);display:grid;place-items:center; }.render-modal { position:relative;width:min(420px,90vw);border-radius:15px;padding:38px;text-align:center; }.modal-close { position:absolute;right:10px;top:10px;border:0;background:transparent;color:#727c8e;cursor:pointer; }.modal-close svg { width:17px; }.render-modal h2 { margin:18px 0 6px;font-size:20px; }.render-modal p { color:#7f899c;font-size:11px;line-height:1.5; }.render-modal .button { margin-top:14px; }.render-orbit,.success-ring { width:65px;height:65px;margin:auto;display:grid;place-items:center;border-radius:50%; }.render-orbit { color:#a991ff;border:1px solid #7454db;background:#7653e719;box-shadow:0 0 40px #7653e740;animation:pulse 1.5s ease-in-out infinite; }.render-orbit svg { width:26px; }.success-ring { color:#5ee0ae;border:1px solid #32b987;background:#32b98718; }.progress { height:5px;background:#242937;border-radius:10px;overflow:hidden;margin:22px 0 9px; }.progress i { display:block;height:100%;background:linear-gradient(90deg,#7451e8,#b69cff);transition:width .3s;border-radius:10px; }.render-modal > strong { color:#9880e9;font:11px Consolas; }
|
||||
@keyframes spin { to { transform:rotate(360deg); } } @keyframes pulse { 50% { transform:scale(1.06);box-shadow:0 0 60px #7653e765; } }
|
||||
@media (max-width: 1000px) { .workspace { grid-template-columns:200px 1fr; }.right-panel { position:fixed;z-index:20;right:12px;top:76px;bottom:12px;width:270px;box-shadow:-20px 0 60px #000b; }.topbar { grid-template-columns:180px 1fr auto; }.project-name { display:none; }.player-stage { max-width:65%; }.ai-dock { grid-template-columns:90px 1fr 140px; } }
|
||||
@media (max-width: 700px) { .studio-shell { padding:6px; }.topbar { grid-template-columns:1fr auto;height:52px; }.top-actions .ghost,.top-actions > .icon-button { display:none; }.workspace { display:flex;flex-direction:column;height:auto; }.left-panel { order:2;height:190px;border-radius:6px; }.scene-list { flex-direction:row;overflow-x:auto;height:130px; }.scene-card { min-width:180px;grid-template-columns:16px 20px 54px 1fr; }.canvas-area { height:520px;order:1;border-radius:6px; }.right-panel { position:static;order:3;width:100%;max-height:460px; }.player-stage { height:380px;max-width:75%;max-height:75%; }.timeline { height:112px;overflow-x:auto; }.timeline-track { min-width:650px; }.ai-dock { height:auto;grid-template-columns:1fr;padding:14px; }.ai-badge { display:none; }.ai-dock > button { width:100%; }.render-modal { padding:28px; } }
|
||||
.layers-panel { height:calc(100% - 46px);display:flex;flex-direction:column; }.layer-tools { display:grid;grid-template-columns:repeat(3,1fr);gap:4px;padding:9px;border-bottom:1px solid #242936; }.layer-tools button,.layer-tools label { height:38px;border:1px solid #2b3140;border-radius:6px;background:#121620;color:#828c9e;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:7px;cursor:pointer; }.layer-tools button:hover,.layer-tools label:hover { border-color:#7c5ce0;color:#b39dfb;background:#7653df10; }.layer-tools svg { width:13px; }.layer-tools input { display:none; }.layer-heading { display:flex;justify-content:space-between;padding:10px 11px 6px;color:#697386;font-size:8px;text-transform:uppercase;letter-spacing:1px; }.layer-heading small { font-size:7px; }.layer-list { padding:0 7px 10px;overflow-y:auto;display:flex;flex-direction:column;gap:3px; }.layer-list > button { width:100%;height:42px;display:grid;grid-template-columns:10px 25px 1fr 12px 17px 17px;align-items:center;gap:5px;padding:4px 5px;border:1px solid transparent;border-radius:6px;background:#10131b;color:#6b7588;text-align:left;cursor:pointer; }.layer-list > button:hover { background:#171b25; }.layer-list > button.selected { border-color:#7656db;background:#7656db14; }.layer-list > button > svg { width:9px;color:#3f4756; }.layer-type { width:24px;height:24px;border-radius:5px;background:#242a36;display:grid;place-items:center;color:#a991fc; }.layer-type.shape { color:#4dd7b1; }.layer-type.image { color:#67aaf9; }.layer-type svg { width:11px; }.layer-list b,.layer-list small { display:block;max-width:95px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }.layer-list b { color:#c1c7d2;font-size:8px; }.layer-list small { margin-top:2px;font-size:6px;text-transform:capitalize; }.layer-list i { display:grid;place-items:center; }.layer-list i svg { width:9px; }.layer-order { font:7px Consolas;color:#4f596b; }.empty-layer { padding:35px 12px;text-align:center;color:#596375; }.empty-layer svg { width:25px;margin-bottom:8px; }.empty-layer b,.empty-layer span { display:block; }.empty-layer b { color:#858fa2;font-size:9px; }.empty-layer span { margin-top:5px;font-size:7px;line-height:1.4; }
|
||||
.layer-selection { position:absolute;z-index:9;border:1px solid #b69cff;box-shadow:0 0 0 1px #0b0d13,0 0 12px #8b5cf650;cursor:move;touch-action:none; }.layer-selection:before { content:"";position:absolute;left:50%;top:50%;width:5px;height:5px;transform:translate(-50%,-50%);border:1px solid #fff;border-radius:50%;background:#8b5cf6; }.layer-selection > span { position:absolute;left:0;top:-17px;padding:2px 4px;background:#7652dd;color:white;font-size:6px;white-space:nowrap; }.layer-selection .handle { position:absolute;width:6px;height:6px;background:white;border:1px solid #7652dd; }.layer-selection .nw { left:-4px;top:-4px; }.layer-selection .ne { right:-4px;top:-4px; }.layer-selection .sw { left:-4px;bottom:-4px; }.layer-selection .se { right:-4px;bottom:-4px; }
|
||||
.transform-row { display:grid;grid-template-columns:1fr 22px 1fr 22px;gap:4px;align-items:end; }.transform-row label span { display:block;color:#737d90;font-size:7px;text-transform:uppercase;margin-bottom:5px; }.transform-row input { width:100%;height:28px;border:1px solid #2b3140;background:#0d1017;color:#d9dee8;border-radius:6px;padding:5px;font-size:9px; }.transform-row button,.key-control button { width:22px;height:28px;border:1px solid #2b3140;background:#121620;color:#665d83;border-radius:5px;display:grid;place-items:center;cursor:pointer; }.transform-row button:hover,.key-control button:hover { color:#b69cff;border-color:#7655df; }.transform-row svg,.key-control svg { width:9px;fill:currentColor; }.key-control { display:grid;grid-template-columns:53px 1fr 34px 22px;align-items:center;gap:5px;color:#737d90;font-size:8px; }.key-control input { min-width:0;width:100%; }.key-control b { font:7px Consolas;color:#9099aa;text-align:right; }.keyframe-list { display:flex;flex-direction:column;gap:3px;padding-top:3px; }.keyframe-list > button { display:grid;grid-template-columns:13px 45px 1fr 15px;align-items:center;gap:5px;height:27px;border:1px solid #282e3a;background:#0d1017;border-radius:5px;color:#757f91;text-align:left;cursor:pointer; }.keyframe-list > button:hover { border-color:#6048ad; }.keyframe-list svg { width:8px;color:#a78bfa;fill:#a78bfa;margin-left:3px; }.keyframe-list b { font-size:7px;text-transform:capitalize; }.keyframe-list span { font:7px Consolas; }.keyframe-list i svg { color:#677184;fill:none;margin:0; }.delete-layer { min-height:31px;border:1px solid #512d39;background:#251219;color:#db7182;border-radius:6px;font-size:8px;display:flex;align-items:center;justify-content:center;gap:5px;cursor:pointer; }.delete-layer svg { width:11px; }
|
||||
.timeline-keys { position:absolute;left:0;right:0;bottom:1px;height:9px;pointer-events:none; }.timeline-keys svg { position:absolute;width:7px;height:7px;color:#f1e9ff;fill:#9f7cff;transform:translateX(-50%);filter:drop-shadow(0 0 3px #9f7cff); }
|
||||
.timeline.multitrack { height:260px;padding:0;overflow:hidden;background:#0d1017; }.multitrack .timeline-head { height:42px;padding:0 12px;border-bottom:1px solid #252b36;background:#11141c; }.timeline-tools { display:flex;align-items:center;gap:9px; }.timeline-tools > button { border:1px solid #2d3441;background:#181c26;color:#8993a5;border-radius:5px;padding:4px 8px;font-size:7px;cursor:pointer; }.timeline-tools > b { min-width:28px;color:#7562b6;font:7px Consolas; }.timeline-tools .zoom input { width:85px; }.timeline-scroll { height:218px;overflow:auto;scrollbar-color:#333a49 #0c0f15;scrollbar-width:thin; }.timeline-content { position:relative;min-width:100%;min-height:100%;background:#0b0e14; }.track-ruler,.track-row { position:relative;display:grid;grid-template-columns:145px minmax(500px,1fr);min-width:100%; }.track-ruler { height:24px;position:sticky;top:0;z-index:12;background:#10131a;border-bottom:1px solid #272d38; }.track-label { position:sticky;left:0;z-index:8;display:flex;align-items:center;gap:6px;padding:0 8px;min-width:0;background:#12151d;border-right:1px solid #2a303b;border-bottom:1px solid #242a34;color:#697386; }.ruler-label { z-index:14;font-size:7px;letter-spacing:1px;color:#505a6c; }.ruler-lane,.track-lane { position:relative;min-width:0;background-image:linear-gradient(90deg,#252b3538 1px,transparent 1px);background-size:calc(100% / 15) 100%; }.ruler-lane { cursor:col-resize; }.ruler-lane > span { position:absolute;top:7px;transform:translateX(-50%);color:#545e70;font:6px Consolas; }.track-row { height:39px; }.track-row.scene-track { height:43px; }.track-label > svg { width:12px;color:#7761c1; }.track-label > i { display:grid;place-items:center;cursor:pointer; }.track-label > i svg { width:9px; }.track-label > div { min-width:0;flex:1; }.track-label b,.track-label span { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }.track-label b { color:#a9b0bd;font-size:7px; }.track-label span { margin-top:2px;color:#4f596b;font-size:6px; }.track-type { width:20px;height:20px;display:grid;place-items:center;border-radius:4px;background:#252a35;color:#a68cf7; }.track-type.shape { color:#43cfa8; }.track-type.image { color:#65a9f4; }.track-type svg { width:9px; }.layer-track.selected .track-label { background:#1b1729;box-shadow:inset 2px 0 #8b6bf2; }.track-lane { cursor:col-resize;border-bottom:1px solid #202630; }.scene-clip { position:absolute;top:4px;bottom:4px;border:1px solid color-mix(in srgb,var(--accent),transparent 30%);border-top:2px solid var(--accent);background:color-mix(in srgb,var(--accent) 16%,#131722);border-radius:4px;padding:4px 5px;overflow:hidden;cursor:pointer; }.scene-clip.active { box-shadow:inset 0 0 14px color-mix(in srgb,var(--accent),transparent 75%),0 0 0 1px var(--accent); }.scene-clip > span { display:inline-grid;place-items:center;width:13px;height:13px;background:var(--accent);color:#080a0f;border-radius:2px;font-size:6px;font-weight:900; }.scene-clip > b { margin-left:5px;font-size:7px;white-space:nowrap; }.scene-clip > small { position:absolute;right:5px;top:6px;color:#7e8798;font-size:6px; }.layer-clip { position:absolute;z-index:2;top:7px;height:24px;min-width:8px;border:1px solid color-mix(in srgb,var(--layer-color),#384150 70%);border-left:3px solid var(--layer-color);border-radius:3px;background:linear-gradient(90deg,color-mix(in srgb,var(--layer-color) 20%,#181c26),#151923);padding:4px 8px;overflow:hidden;cursor:grab;touch-action:none; }.layer-clip:active { cursor:grabbing; }.layer-clip.locked { opacity:.5;cursor:not-allowed; }.layer-clip > span { color:color-mix(in srgb,var(--layer-color),white 25%);font:5px Consolas;display:block; }.layer-clip > b { display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#c3c9d4;font-size:6px;margin-top:2px; }.trim { position:absolute;z-index:3;top:0;bottom:0;width:5px;background:color-mix(in srgb,var(--layer-color),white 20%);opacity:0;cursor:ew-resize; }.layer-clip:hover .trim { opacity:.8; }.trim.start { left:0; }.trim.end { right:0; }.track-key { position:absolute;z-index:5;top:25px;width:12px;height:12px;transform:translate(-50%,-50%);padding:0;border:0;background:transparent;color:#d7c9ff;cursor:ew-resize;touch-action:none; }.track-key svg { width:8px;fill:#9d7bf5;filter:drop-shadow(0 0 3px #8b63f7); }.track-key.rotation svg { fill:#f0a95d; }.track-key.opacity svg { fill:#54cce0; }.track-key.scale svg { fill:#58d49e; }.multi-playhead { position:absolute;z-index:20;top:0;bottom:0;width:1px;background:#e8eaf0;pointer-events:none; }.multi-playhead > i { position:absolute;top:0;left:-4px;border-left:4px solid transparent;border-right:4px solid transparent;border-top:7px solid #f4f5f7; }.multi-playhead > span { position:absolute;top:4px;left:5px;padding:2px 4px;border-radius:3px;background:#e8eaf0;color:#11131a;font:6px Consolas; }.empty-track .track-lane { display:flex;align-items:center;padding-left:14px;color:#485264;font-size:7px; }.empty-track { heightLine truncated
|
||||
@media (max-width:700px) { .timeline.multitrack { height:240px; }.timeline-scroll { height:198px; }.track-ruler,.track-row { grid-template-columns:110px minmax(480px,1fr); }.multi-playhead { display:none; } }
|
||||
.center-tools { justify-self:center;display:flex;align-items:center;gap:7px; }.mode-switch { display:flex;padding:3px;border:1px solid #2b3140;border-radius:7px;background:#0d1017; }.mode-switch button { height:25px;padding:0 9px;border:0;border-radius:5px;background:transparent;color:#697386;font-size:8px;font-weight:700;display:flex;align-items:center;gap:5px;cursor:pointer; }.mode-switch button svg { width:11px; }.mode-switch button.active { background:#29233e;color:#b8a6f7;box-shadow:inset 0 0 0 1px #6048ad; }.center-tools .project-name { justify-self:auto; }.cut-workspace { height:calc(100vh - 82px);min-height:680px;margin-top:6px;display:grid;grid-template-columns:250px minmax(430px,1fr) 270px;grid-template-rows:minmax(390px,1fr) 272px;gap:6px; }.cut-panel { min-width:0;background:#0e1118;border:1px solid #242a35;border-radius:6px;overflow:hidden; }.cut-panel-head { height:40px;padding:0 10px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #252b36;background:#12151d;color:#7b8598; }.cut-panel-head > div { display:flex;align-items:center;gap:6px; }.cut-panel-head svg { width:12px; }.cut-panel-head b { color:#aab2c0;font-size:8px;letter-spacing:.7px; }.cut-panel-head > span { font:7px Consolas;color:#525d70; }.cut-panel-head label { height:25px;padding:0 7px;display:flex;align-items:center;gap:4px;border:1px solid #343b49;border-radius:5px;background:#1a1e28;color:#9da6b5;font-size:7px;cursor:pointer; }.cut-panel-head label.loading { color:#a78bfa; }.cut-panel-head label input { display:none; }.media-bin { position:relative; }.media-grid { max-height:calc(100% - 40px);padding:8px;display:grid;grid-template-columns:1fr 1fr;gap:7px;overflow-y:auto; }.media-item { min-width:0;padding:5px;border:1px solid #272d38;border-radius:6px;background:#11151d; }.media-preview { position:relative;aspect-ratio:16/9;display:grid;place-items:center;border-radius:4px;background:#07090d;overflow:hidden;color:#7662b8; }.media-preview video { width:100%;height:100%;object-fit:cover; }.media-preview > svg { width:24px; }.media-preview > span { position:absolute;right:3px;bottom:3px;padding:2px 3px;border-radius:2px;background:#050608cc;color:#c9ced7;font:5px Consolas; }.media-item > b,.media-item > small { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }.media-item > b { margin-top:5px;color:#c0c6d1;font-size:7px; }.media-item > small { margin-top:2px;color:#566174;font-size:5px; }.media-item > div:last-child { display:flex;gap:3px;margin-top:5px; }.media-item button { height:20px;border:1px solid #303745;border-radius:4px;background:#191d27;color:#8993a5;font-size:6px;display:flex;align-items:center;justify-content:center;gap:2px;cursor:pointer; }.media-item button:first-child { flex:1; }.media-item button:last-child { width:22px;color:#b25d6c; }.media-item button svg { width:8px; }.media-empty { position:absolute;inset:40px 0 0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#4d586a; }.media-empty svg { width:34px;margin-bottom:10px; }.media-empty b { color:#818b9d;font-size:9px; }.media-empty span { margin-top:5px;font-size:7px; }.program-panel { display:flex;flex-direction:column; }.program-stage { flex:1;min-height:0;display:flex;align-items:center;justify-content:center;padding:15px;background-color:#080a0e;background-image:linear-gradient(45deg,#10131a 25%,transparent 25%),linear-gradient(-45deg,#10131a 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#10131a 75%),linear-gradient(-45deg,transparent 75%,#10131a 75%);background-size:18px 18px;background-position:0 0,0 9px,9px -9px,-9px 0; }.program-stage > div { max-width:100%;max-height:100%;aspect-ratio:16/9;background:#000;box-shadow:0 15px 50px #000; }.program-transport { height:42px;display:flex;align-items:center;justify-content:center;gap:9px;border-top:1px solid #242a35;background:#11141c; }.program-transport > span { width:62px;color:#7f899b;font:7px Consolas;text-align:center; }.program-transport button { width:25px;height:25px;border:0;background:transparent;color:#7f899b;display:grid;place-items:center;cursor:pointer; }.program-transport button.play { width:31px;height:31px;border:1px solid #3b4352;border-radius:50%;background:#202531;color:#fff; }.program-transport svg { width:12px; }.clip-inspector { overflow-y:auto; }.clip-controls { padding:11px;display:flex;flex-direction:column;gap:12px; }.cut-dual { display:grid;grid-template-columns:1fr 1fr;gap:7px; }.range-icon { display:flex;align-items:center;gap:6px; }.range-icon svg { width:12px;color:#7460b5; }.range-icon input { flex:1;min-width:0; }.mute-clip { height:29px;border:1px solid #303745;border-radius:5px;background:#171b24;color:#8993a5;font-size:7px;display:flex;align-items:center;justify-content:center;gap:5px;cursor:pointer; }.mute-clip.active { color:#e37182;border-color:#63333f;background:#2c151c; }.mute-clip svg { width:11px; }.no-clip { height:calc(100% - 40px);display:flex;flex-direcLine truncated
|
||||
@media (max-width:1100px) { .center-tools .project-name { display:none; }.cut-workspace { grid-template-columns:210px 1fr; }.clip-inspector { position:fixed;z-index:30;right:6px;top:70px;bottom:6px;width:270px;box-shadow:-20px 0 60px #000b; }.edit-timeline { grid-column:1/-1; } }
|
||||
.clip-action-row { display:grid;grid-template-columns:1fr 1fr;gap:5px; }.clip-action-row button { height:28px;border:1px solid #303745;border-radius:5px;background:#171b24;color:#8993a5;font-size:7px;display:flex;align-items:center;justify-content:center;gap:4px;cursor:pointer; }.clip-action-row button:hover { border-color:#6952b1;color:#b5a1f4; }.clip-action-row svg { width:10px; }.edit-title { gap:12px!important; }.timeline-toolbox { display:flex;gap:3px;padding-left:10px;border-left:1px solid #303644; }.timeline-toolbox button { width:25px!important;padding:0!important;justify-content:center!important; }.timeline-toolbox button.active { border-color:#7c5ce0!important;background:#2b2046!important;color:#bea9ff!important; }.timeline-toolbox button span { display:none; }.timeline-toolbox svg { width:10px!important; }.tool-razor .edit-clip { cursor:crosshair; }.fade-ramp { position:absolute!important;z-index:0;top:0;bottom:0;height:auto!important;pointer-events:none; }.fade-ramp.fade-in { left:0;background:linear-gradient(135deg,#090b10bb 0 48%,transparent 50%);border-right:1px solid #ffffff35; }.fade-ramp.fade-out { right:0;background:linear-gradient(225deg,#090b10bb 0 48%,transparent 50%);border-left:1px solid #ffffff35; }
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
export type SceneLayout = "hero" | "split" | "stat" | "steps" | "quote" | "outro";
|
||||
export type AspectRatio = "9:16" | "16:9" | "1:1";
|
||||
export type EffectType = "bloom" | "grain" | "vignette" | "scanlines" | "chromatic" | "particles" | "shake" | "drift";
|
||||
export type TransitionType = "cut" | "fade" | "slide" | "wipe" | "zoom" | "glitch";
|
||||
export type EntranceType = "fade" | "rise" | "zoom" | "slide" | "elastic";
|
||||
export type LayerType = "text" | "shape" | "image";
|
||||
export type AnimatableProperty = "x" | "y" | "scale" | "rotation" | "opacity";
|
||||
|
||||
export type LayerKeyframe = {
|
||||
id: string;
|
||||
property: AnimatableProperty;
|
||||
time: number;
|
||||
value: number;
|
||||
easing: "linear" | "ease-in" | "ease-out" | "ease-in-out";
|
||||
};
|
||||
|
||||
export type VideoLayer = {
|
||||
id: string;
|
||||
type: LayerType;
|
||||
name: string;
|
||||
visible: boolean;
|
||||
locked: boolean;
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
scale: number;
|
||||
rotation: number;
|
||||
opacity: number;
|
||||
start: number;
|
||||
end: number;
|
||||
text: string;
|
||||
source: string;
|
||||
color: string;
|
||||
fontSize: number;
|
||||
borderRadius: number;
|
||||
blendMode: "normal" | "screen" | "multiply" | "overlay" | "lighten";
|
||||
keyframes: LayerKeyframe[];
|
||||
};
|
||||
|
||||
export type MediaAsset = {
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
mediaType: "video" | "audio";
|
||||
duration: number;
|
||||
size: number;
|
||||
};
|
||||
|
||||
export type EditorClip = {
|
||||
id: string;
|
||||
assetId: string;
|
||||
name: string;
|
||||
track: number;
|
||||
start: number;
|
||||
sourceStart: number;
|
||||
sourceEnd: number;
|
||||
speed: number;
|
||||
volume: number;
|
||||
muted: boolean;
|
||||
fadeIn: number;
|
||||
fadeOut: number;
|
||||
};
|
||||
|
||||
export type SceneEffect = {
|
||||
id: string;
|
||||
type: EffectType;
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
amount: number;
|
||||
speed: number;
|
||||
color: string;
|
||||
};
|
||||
|
||||
export type SceneMotion = {
|
||||
entrance: EntranceType;
|
||||
entranceDuration: number;
|
||||
exitDuration: number;
|
||||
transition: TransitionType;
|
||||
transitionDuration: number;
|
||||
};
|
||||
|
||||
export type VideoScene = {
|
||||
id: string;
|
||||
layout: SceneLayout;
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
body: string;
|
||||
accent: string;
|
||||
duration: number;
|
||||
effects: SceneEffect[];
|
||||
motion: SceneMotion;
|
||||
layers: VideoLayer[];
|
||||
};
|
||||
|
||||
export type VideoProject = {
|
||||
title: string;
|
||||
format: AspectRatio;
|
||||
fps: number;
|
||||
background: string;
|
||||
textColor: string;
|
||||
font: "modern" | "editorial" | "mono";
|
||||
activeMode: "motion" | "cut";
|
||||
media: MediaAsset[];
|
||||
clips: EditorClip[];
|
||||
scenes: VideoScene[];
|
||||
};
|
||||
|
||||
export const dimensions: Record<AspectRatio, {width: number; height: number}> = {
|
||||
"9:16": {width: 1080, height: 1920},
|
||||
"16:9": {width: 1920, height: 1080},
|
||||
"1:1": {width: 1080, height: 1080},
|
||||
};
|
||||
|
||||
export const defaultProject: VideoProject = {
|
||||
title: "PDEV Product Launch",
|
||||
format: "9:16",
|
||||
fps: 30,
|
||||
background: "#090b12",
|
||||
textColor: "#f4f5f7",
|
||||
font: "modern",
|
||||
activeMode: "motion",
|
||||
media: [],
|
||||
clips: [],
|
||||
scenes: [
|
||||
{
|
||||
id: "hook",
|
||||
layout: "hero",
|
||||
eyebrow: "PDEV PRESENTS",
|
||||
title: "Ideen werden Bewegung.",
|
||||
body: "Vom ersten Prompt bis zum fertigen Video.",
|
||||
accent: "#8b5cf6",
|
||||
duration: 3.5,
|
||||
effects: [{id: "hook-bloom", type: "bloom", name: "Neon Bloom", enabled: true, amount: 42, speed: 35, color: "#8b5cf6"}],
|
||||
motion: {entrance: "zoom", entranceDuration: 0.65, exitDuration: 0.35, transition: "glitch", transitionDuration: 0.28},
|
||||
layers: [{
|
||||
id: "hook-layer-badge", type: "text", name: "Animated Badge", visible: true, locked: false,
|
||||
x: 50, y: 77, width: 55, height: 8, scale: 100, rotation: 0, opacity: 100,
|
||||
start: 0, end: 3.5, text: "PROMPT / EDIT / RENDER", source: "", color: "#c4b5fd",
|
||||
fontSize: 38, borderRadius: 0, blendMode: "screen",
|
||||
keyframes: [
|
||||
{id: "badge-opacity-0", property: "opacity", time: 0, value: 0, easing: "ease-out"},
|
||||
{id: "badge-opacity-1", property: "opacity", time: 0.65, value: 100, easing: "ease-out"},
|
||||
{id: "badge-scale-0", property: "scale", time: 0, value: 72, easing: "ease-out"},
|
||||
{id: "badge-scale-1", property: "scale", time: 0.65, value: 100, easing: "ease-out"}
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
id: "feature",
|
||||
layout: "split",
|
||||
eyebrow: "LIVE EDITOR",
|
||||
title: "Nicht nur chatten. Direkt gestalten.",
|
||||
body: "Szenen, Timing, Typografie und Farben bleiben jederzeit in deiner Hand.",
|
||||
accent: "#2dd4bf",
|
||||
duration: 4.5,
|
||||
effects: [{id: "feature-particles", type: "particles", name: "Dust Particles", enabled: true, amount: 35, speed: 30, color: "#2dd4bf"}],
|
||||
motion: {entrance: "rise", entranceDuration: 0.55, exitDuration: 0.35, transition: "slide", transitionDuration: 0.35},
|
||||
layers: []
|
||||
},
|
||||
{
|
||||
id: "proof",
|
||||
layout: "stat",
|
||||
eyebrow: "RENDER PIPELINE",
|
||||
title: "4K",
|
||||
body: "Remotion rendert jedes Projekt reproduzierbar und pixelgenau.",
|
||||
accent: "#f59e0b",
|
||||
duration: 3.5,
|
||||
effects: [{id: "proof-grain", type: "grain", name: "Film Grain", enabled: true, amount: 18, speed: 65, color: "#ffffff"}],
|
||||
motion: {entrance: "elastic", entranceDuration: 0.7, exitDuration: 0.3, transition: "zoom", transitionDuration: 0.3},
|
||||
layers: []
|
||||
},
|
||||
{
|
||||
id: "outro",
|
||||
layout: "outro",
|
||||
eyebrow: "CREATE DIFFERENT",
|
||||
title: "PDEV AI Video Studio",
|
||||
body: "Prompt. Edit. Render.",
|
||||
accent: "#8b5cf6",
|
||||
duration: 3.5,
|
||||
effects: [{id: "outro-vignette", type: "vignette", name: "Cinematic Vignette", enabled: true, amount: 65, speed: 0, color: "#000000"}],
|
||||
motion: {entrance: "fade", entranceDuration: 0.7, exitDuration: 0.5, transition: "fade", transitionDuration: 0.4},
|
||||
layers: []
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const clipDuration = (clip: EditorClip) => Math.max(0.05, (clip.sourceEnd - clip.sourceStart) / Math.max(0.1, clip.speed));
|
||||
export const motionDuration = (project: VideoProject) => project.scenes.reduce((sum, scene) => sum + scene.duration, 0);
|
||||
export const editDuration = (project: VideoProject) => Math.max(1, ...project.clips.map((clip) => clip.start + clipDuration(clip)));
|
||||
export const projectDuration = (project: VideoProject) => project.activeMode === "cut" ? editDuration(project) : motionDuration(project);
|
||||
export const projectFrames = (project: VideoProject) => Math.max(1, Math.round(projectDuration(project) * project.fps));
|
||||
|
||||
const defaultMotion: SceneMotion = {entrance: "rise", entranceDuration: 0.55, exitDuration: 0.35, transition: "fade", transitionDuration: 0.3};
|
||||
|
||||
export const normalizeProject = (project: VideoProject): VideoProject => ({
|
||||
...defaultProject,
|
||||
...project,
|
||||
activeMode: project.activeMode ?? "motion",
|
||||
media: project.media ?? [],
|
||||
clips: (project.clips ?? []).map((clip) => ({...clip, fadeIn: clip.fadeIn ?? 0, fadeOut: clip.fadeOut ?? 0})),
|
||||
scenes: project.scenes.map((scene) => ({
|
||||
...scene,
|
||||
effects: scene.effects ?? [],
|
||||
motion: {...defaultMotion, ...(scene.motion ?? {})},
|
||||
layers: (scene.layers ?? []).map((layer) => ({...layer, keyframes: layer.keyframes ?? []})),
|
||||
})),
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
start "PDEV Render Server" cmd /k node server.mjs
|
||||
start "PDEV Web Studio" cmd /k node node_modules\vite\bin\vite.js
|
||||
timeout /t 2 /nobreak >nul
|
||||
start "" http://localhost:4317
|
||||
endlocal
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import {defineConfig} from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 4317,
|
||||
proxy: {
|
||||
"/api": "http://localhost:4318",
|
||||
"/renders": "http://localhost:4318"
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user