1---2name: motion-editor3description: "Build a local, offline motion-design editor app (After Effects / Screen Studio-lite) with scenes, layers, keyframes, spring easing, presets, stagger, a cursor layer, timeline, undo/redo, save/open, and deterministic MP4 export via Playwright + ffmpeg. The deliverable is the editor itself, not a video."4version: "1.0.0"5license: MIT6metadata:7 source: https://skillmd.com/skills/cowork-os/motion-editor8 author: CoWork OS Contributors <info@coworkosapp.com>9---1011# Motion Editor1213## Before starting1415Confirm the target folder and the user's OS (adapt shortcuts: Ctrl on Windows/Linux, Cmd on macOS). Phases span many steps: keep a `PROGRESS.md` in the project noting what's built and which verifications passed. If an essential ambiguity remains, ask the user — the requirements below take priority over any outside source.1617<goal>18Build a local motion-design editor app. The deliverable is the EDITOR ITSELF, not a video.19Do NOT invent a video concept, create demo content, or render anything automatically.20On first launch, open an empty project. Rendering happens only when the user clicks Export.21</goal>2223<environment>24- Windows, macOS or Linux; Node 20+, ffmpeg available in PATH.25- Stack: Vite + React + TypeScript frontend, small local Node (Express) server for filesystem access and render jobs. Zustand for state, zod for project schema validation.26- No AI/API calls at runtime. Editing, playback, undo/redo, saving must work fully offline.27- Run: `npm install && npm run dev`. CLI render: `npm run render -- <projectFolder> <out.mp4>`.28- If you deviate from this stack, justify it in README.29</environment>3031<architecture>32- Single source of truth: project.json (schema-validated).33- One pure function `renderFrame(project, timeSec, ctx, scale)` draws a frame on Canvas 2D. Used by BOTH preview and export.34- Output depends only on (project, time): no Date.now(), no unseeded Math.random(), no CSS animations, no rAF-accumulated state. Any timestamp must be directly seekable.35- Preview renders scaled to viewport (devicePixelRatio-aware). Export renders at full project resolution.36- Text and vector graphics must stay crisp at 4K (render at target resolution, never upscale a bitmap of the canvas).37</architecture>3839<data_model>40- Project: settings {durationSec=15, aspect=16:9, width=3840, height=2160, fps=30, background}, scenes[], assets[] {id, originalName, relativePath, type, hash}.41- Scene: id, name, start, duration, layers[] (array order = z-order).42- Layer: id, type (text | image | shape | cursor), name, visible, locked, start, duration (relative to scene), anchor, x, y, scale, rotation, opacity, type-specific props.43 Text props: content, fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, align, color.44- Keyframes per property: [{time, value, easing}].45- Easing: linear, ease-in/out/in-out, custom cubic-bezier, spring {stiffness, damping, mass}.46- Animation presets (slide/fade/scale in & out with direction, distance, delay, duration, easing) GENERATE regular editable keyframes. Re-applying a preset replaces them and is undoable.47- Stagger: applied to a multi-selection; params: order (forward / reverse / seeded random), interval. Offsets layer start times.48</data_model>4950<phase_1_core>51Build and verify ALL of this before starting Phase 2:521. Project settings: duration, aspect ratio (16:9, 9:16, 1:1, 4:5, custom), resolution, fps. Changing them never deletes layers.532. Asset import (button + drag&drop): PNG, JPG, WebP, SVG, fonts (TTF/OTF/WOFF2). Originals copied byte-for-byte, never modified.543. Add text and shapes. Scenes: create, duplicate, rename, reorder, delete.554. Layers panel: reorder, show/hide, lock, rename, duplicate, delete.565. Preview: click to select, drag to move, handles to scale/rotate, Shift to constrain. Selection stays synced across preview, timeline, and properties panel.576. Timeline: scene blocks with draggable boundaries, layer bars with draggable start/end, keyframe diamonds draggable in time, playhead scrubbing, zoom.587. Properties panel: transform, opacity, typography, alignment, spacing, color; per-property keyframe toggle at playhead; easing picker with live curve preview. Plain-language labels; tooltip on every non-obvious control explaining what it changes.598. Playback: play/pause, replay, loop, Space, frame step with ←/→, time + frame counter. Any parameter change updates the preview instantly.609. Undo/redo (Ctrl/Cmd+Z, Ctrl/Cmd+Shift+Z) for every edit; one drag = one history step.6110. Save/Open: project folder `<name>.motion/` with project.json + assets/. Unsaved-changes dot in title + warning on close. Missing assets show a placeholder with a "Relink" button. Also export/import the whole project as a single .zip.62</phase_1_core>6364<phase_2_advanced>65- Spring easing UI, stagger UI, animation presets UI.66- Cursor layer: path points draggable in preview, target positions, editable click times with click ripple, path smoothing.67</phase_2_advanced>6869<export>70- "Export MP4" button → server launches headless Chromium (Playwright) on a render-only page with NO editor UI, calls renderFrame for every frame, pipes raw frames into ffmpeg: libx264, yuv420p, CRF 16, -movflags +faststart.71- Wait for document.fonts.ready and all images decoded before frame 0.72- Progress bar + cancel button. Same pipeline available via CLI.73- If ffmpeg is not found, show a clear error with the install step and the exact CLI command to render the saved project.74</export>7576<out_of_scope_v1>77Audio, video clips as layers, scene transitions, blur/effects, AI generation, cloud sync. Mark them as "Not available" in UI if referenced anywhere; no dead buttons.78</out_of_scope_v1>7980<verification>81Actually run these, do not just claim them:82- Unit tests: interpolation, every easing type, determinism (render the same t twice → identical pixels).83- Playwright e2e test: new project → import fixture image → place it → add keyframes on x and opacity → move second keyframe in time → scrub to midpoint and screenshot → undo (value reverts) → redo → save → reload app → open project → deep-compare project.json (scenes, layers, keyframes, settings, asset refs) and confirm assets load.84- Export test: 3-second 1080p project → MP4 → extract first, middle, last frames with ffmpeg → compare to renderFrame output at the same timestamps (pixel diff below threshold).85</verification>8687<deliverable>88Working app + source + README with: install, run, editing basics, save/open, export (UI and CLI).89README must contain "Works (tested)", "Not implemented", "Known limitations". List as working ONLY what passed the tests above.90</deliverable>9192## Related9394The spring formula and render/QA pipeline in `references/techniques.md` (shared with the `motion-film` skill) apply here too (closed-form springs keep `renderFrame` pure; subframe blending can be added to export later).9596## Routing9798- Use when: the user asks to build a motion editor, animation editor, keyframe timeline app, or a tool for making motion-design videos.99- Do not use when: the user wants a single finished film (use `motion-film`), a Manim explainer (use `manim-video`), or edits to existing video footage.100- Outputs: a working Vite + React + Express editor app with tests, a `PROGRESS.md`, and a README with "Works (tested)", "Not implemented", and "Known limitations".101- Success criteria: Phase 1 verified before Phase 2; unit, e2e and export tests actually run and pass; README lists as working only what passed.102103## Trigger Examples104105### Positive106107- Build me a motion-design editor app with a keyframe timeline.108- Create an After Effects-lite animation editor that exports MP4.109- Make a local Screen Studio-style tool for making motion videos.110- Use the motion-editor skill for this request.111112### Negative113114- Render our launch film for Friday's announcement.115- Explain binary search trees with an equation-style walkthrough.116- Cut the silences out of this podcast episode.117- Write release notes for the new version.118119## Parameters120121| Name | Type | Required | Description |122| ---------- | ------ | -------- | ---------------------------------------------------------------- |123| output_dir | string | No | App folder (default `motion-editor` in the workspace) |124| phase | select | No | auto, phase-1-core, phase-2-advanced, export |125126## Runtime Prompt127128- Runtime prompt is defined directly in `../motion-editor.json`.