diff --git a/blog/2025-03-09-launching-v1.4.1.md b/blog/2025-03-09-launching-v1.4.1.md index ba7451f..8b0083d 100644 --- a/blog/2025-03-09-launching-v1.4.1.md +++ b/blog/2025-03-09-launching-v1.4.1.md @@ -67,4 +67,4 @@ Thank you for using AniMathIO! We can't wait to see what you create. ## Full Changelogs -[Changelog](https://github.com/AniMathIO/AniMathIO/blob/main/CHANGELOG.md) +[Changelog](https://github.com/AniMathIO/AniMathIO/blob/v1.4.1/CHANGELOG.md) diff --git a/blog/2025-03-17-launching-v1.5.0.md b/blog/2025-03-17-launching-v1.5.0.md index c06ec1c..7b7d851 100644 --- a/blog/2025-03-17-launching-v1.5.0.md +++ b/blog/2025-03-17-launching-v1.5.0.md @@ -54,4 +54,4 @@ We're continuously working to improve AniMathIO based on community feedback. Our Thank you for being part of the AniMathIO community! We can't wait to see the amazing mathematical animations you create with these new tools. -For a complete list of changes, check out our [full changelog](https://github.com/AniMathIO/AniMathIO/blob/main/CHANGELOG.md). +For a complete list of changes, check out our [full changelog](https://github.com/AniMathIO/AniMathIO/blob/v1.5.0/CHANGELOG.md). diff --git a/blog/2026-01-27-launching-v1.6.3.md b/blog/2026-01-27-launching-v1.6.3.md index e49337d..ef7693a 100644 --- a/blog/2026-01-27-launching-v1.6.3.md +++ b/blog/2026-01-27-launching-v1.6.3.md @@ -62,6 +62,6 @@ We're committed to pushing mathematical animation forward: We're grateful for the amazing community support, especially to contributors like zxp19821005 who help make AniMathIO accessible across different platforms. Your feedback and involvement drive our development forward. -For the complete list of changes, visit our [full changelog](https://github.com/AniMathIO/AniMathIO/blob/main/CHANGELOG.md). +For the complete list of changes, visit our [full changelog](https://github.com/AniMathIO/AniMathIO/blob/animathio-v1.6.3/CHANGELOG.md). Happy animating! 🎨✨ \ No newline at end of file diff --git a/blog/2026-09-07-launching-v1.7.0.md b/blog/2026-09-07-launching-v1.7.0.md index d967594..dc0e37a 100644 --- a/blog/2026-09-07-launching-v1.7.0.md +++ b/blog/2026-09-07-launching-v1.7.0.md @@ -20,7 +20,7 @@ It supports a practical subset of Manim β€” `Text`, `Tex`, `MathTex`, `Circle`, This is a translation, not an emulation: AniMathIO doesn't run Python, so there's nothing extra to install. -See [Importing Manim Scenes](/docs/tutorial-advanced/importing-manim-scenes) for the full guide. +See [Importing Manim Scenes](/docs/v1/tutorial-advanced/importing-manim-scenes) for the full guide. ### A New Canvas Engine @@ -73,6 +73,6 @@ Shortly after v1.7.0 we published **v1.7.1**, which restores the Flatpak build. Thank you to everyone who reported issues and stuck with us through this one β€” the known-issues list that this release finally clears had been open a long time. -For the complete list of changes, see the [full changelog](https://github.com/AniMathIO/AniMathIO/blob/main/CHANGELOG.md). +For the complete list of changes, see the [full changelog](https://github.com/AniMathIO/AniMathIO/blob/animathio-v1.7.0/CHANGELOG.md). Happy animating! 🎨✨ diff --git a/blog/2026-10-06-launching-v1.8.0.md b/blog/2026-10-06-launching-v1.8.0.md index 54f7a14..51aee00 100644 --- a/blog/2026-10-06-launching-v1.8.0.md +++ b/blog/2026-10-06-launching-v1.8.0.md @@ -22,6 +22,6 @@ Version 1.8 includes 13 tools in total, with two new additions: ## Keep an editable copy -Use `save_project` separately to save an editable project. Read the [AI agent integration guide](/docs/tutorial-advanced/ai-agent-integration) for client setup, all 13 tools, and examples. Download the release from [GitHub](https://github.com/AniMathIO/AniMathIO/releases/tag/animathio-v1.8.0). +Use `save_project` separately to save an editable project. Read the [AI agent integration guide](/docs/v1/tutorial-advanced/ai-agent-integration) for client setup, all 13 tools, and examples. Download the release from [GitHub](https://github.com/AniMathIO/AniMathIO/releases/tag/animathio-v1.8.0). Use a generous client timeout for exports and avoid editing or changing playback while recording. The tool reports recording, conversion, and writing failures instead of reporting a partial file as a successful export. diff --git a/blog/2026-11-16-launching-v2.0.0.mdx b/blog/2026-11-16-launching-v2.0.0.mdx new file mode 100644 index 0000000..82811ec --- /dev/null +++ b/blog/2026-11-16-launching-v2.0.0.mdx @@ -0,0 +1,66 @@ +--- +title: Announcing AniMathIO 2.0 +slug: launching-v2.0.0 +tags: [release, v2.0.0, rust, plugins, migration] +authors: MemerGamer +--- + +AniMathIO 2.0 exports a 60-second 1080p video in **37 seconds instead of 117**, opens projects **five times faster** and uses **half the memory** of 1.x. + +| | 1.8.3 (Electron) | 2.0 (Rust) | +| --- | ---: | ---: | +| Export, 60 s 1080p30 MP4 | 116.8 s | **37.4 s** (3.1Γ— faster) | +| Export, 10 s 1080p30 MP4 | 20.4 s | **6.5 s** | +| Open a project | 1.08 s | **0.21 s** | +| Start to a usable window | 0.81 s | **0.20 s** | +| Memory, idle with a project open | 923 MiB | **487 MiB** | +| Peak memory, 10 s export (1) | 1252 MiB | **128 MiB** | +| Size on disk (2) | 658 MiB | **293 MiB** | + +Measured on one Linux machine (Ryzen 7 5800X) under a virtual X display, medians of three runs. (1) Export memory compares the 1.x app exporting from its window with the 2.0 command-line exporter. (2) The unpacked 1.x build against a 2.0 install. The method, raw numbers and caveats are in [benchmarks.md](https://github.com/AniMathIO/AniMathIO/blob/main/docs/benchmarks.md). + +The speed comes from the design: 2.0 is a native Rust app with one renderer shared by preview and export, and everything math-specific lives in sandboxed WebAssembly plugins. + + + +## What 2.0 is + +- **A simple video editor at the core:** media clips, a multi-track timeline, transforms and keyframes, audio, preview and export. +- **Plugins for everything else:** text, LaTeX, graphs, shapes, effects, animation presets, audio effects, the Manim importer and the v1 importer are WebAssembly components that run in a sandbox with memory, time and file limits. +- **One render function:** preview, export and tests share the same deterministic renderer, so an exported frame matches what you saw. +- **Every edit is a command:** each change is a serializable, invertible command. Undo and redo, the command line, the local control protocol and the MCP server all go through it. +- **Installers for Windows, macOS and Linux:** see the [install page](/docs/install). + +## Why the rewrite + +Most of the bugs we kept fighting in 1.x came from how it was built, so fixing them one at a time would never make them stop. Preview and export were two different pipelines (canvas and HTML media for preview, a real-time `captureStream` recording for export), which is why audio could drift and export ran at a fixed 30 fps in real time. Positions were stored in absolute pixels, so elements moved when the canvas was resized. Every media file was embedded as base64 inside one JSON file, which made projects huge and slow to save. There was no command layer, so there was no undo. And Electron, Next.js and native Node modules made installs and builds fragile. + +2.0 removes those causes rather than the symptoms: one pure render function used by preview, export and tests; resolution-independent coordinates; a zip project with content-addressed assets; every edit as an invertible command, so undo and redo come for free; and a single Rust binary with plugins behind a versioned, sandboxed API. Rust was not the reason for the rewrite, but it makes this architecture easy to enforce. + +## Highlights + +- Math objects as clips: LaTeX with a live preview and a Write-on reveal, plots, vectors, polygons and grids. See [math objects](/docs/math-objects). +- Local automatic subtitles with styled and word-highlight captions, SRT and WebVTT import and export, plus silence and scene-cut detection, auto reframe, beat markers and auto ducking. See [captions and automation](/docs/captions-and-automation). +- A Premiere-style keymap. See [keyboard shortcuts](/docs/keyboard-shortcuts). +- `animathio-cli` for headless rendering and the same tools through [MCP](/docs/mcp). +- A documented [plugin API](/docs/plugins). + +## Showcase + +Three short explainers made entirely in 2.0, with LaTeX, graphs, shapes and music, built through the command line and MCP: + + + + + + + +Vertical 9:16 versions are on the [website](https://animathio.com). + +## Migrating from 1.x + +Import a 1.x project with `animathio-cli import-v1 project.animathio -o imported.amio`, or through the Manim importer for Manim scenes. The import is one-way and has known gaps, for example graphs arrive as images. Read [migrating from 1.x](/docs/migrating-from-v1) before moving a project, and keep your originals. The 1.x documentation stays available under [v1 (legacy)](/docs/v1/getting-started), and the 1.x changelogs are linked from the earlier release posts. + +## Get it + +Download 2.0.0 from the [GitHub release](https://github.com/AniMathIO/AniMathIO/releases/tag/v2.0.0). The Windows and macOS installers are unsigned for now; the install page explains the warnings you will see. diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..3b032a9 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,882 @@ +--- +title: "Architecture" +sidebar_label: "Architecture" +sidebar_position: 10 +description: "Crate map, layering, the time model and the data flow." +--- + + + +# Architecture + +This document describes the 2.0 crate map, the layering rules, the time model and +the render/audio/export data flow. The authority for these rules is +[issue #156](https://github.com/AniMathIO/AniMathIO/issues/156). + +## Crate map + +| Crate | Owns | +| --- | --- | +| `core` | Plain project data (`Project`, `Track`, `Clip`, `ClipKind`, `Transform`, `Animation`), exact timeline arithmetic (`Time`, `FrameRate`), the `Command` mutation API with undo/redo, and pure `evaluate(&Project, Time) -> Scene`. Effects are plain data (`EffectInstance`: plugin id + effect id + numeric params); the `EffectProcessor` port is how the renderer asks a plugin host to run one. **No IO, GPU, decoder or UI dependencies.** | +| `format` | Versioned `project.json` (schema version 7) and content-addressed `.amio` ZIP containers. Stream APIs support custom storage; filesystem save helpers validate and atomically replace targets using synced temporary files in the same directory. | +| `render` | Deterministic, GPU-free Vello CPU backend (the reference for tests and export), the clip-effect chain mechanics (rasterize a clip layer, hand each effect to the context's `EffectProcessor`, composite), an optional `gpu` feature with a Vello/wgpu `GpuBackend` for preview, embedded font shaping, the engine `ResourcePool`, `Frame` (RGBA8), PNG encoding and PNG/JPEG decoding. Also the shared `sample` demo project and the `FrameSource` video seam. | +| `audio` | Engine-owned audio pools (one seekable `PcmReader` per asset; nothing holds a whole decoded asset), lazy block-wise resampling and channel mapping behind an LRU-budgeted cache, immutable mixer snapshots, Opus/Symphonia decoding, and cpal/rtrb device playback. No audio resources live in `Project`. Also pure offline beat detection (`detect_beats`). | +| `media` | FilmCraft decode behind the `MediaBackend` trait (probe, frame-exact video seek, audio PCM), an LRU-budgeted engine `MediaPool` with prefetch, and the H.264 + AAC `Mp4Encoder` (BT.709-tagged). Untrusted-input limits (dimensions, frame counts, rates, checked arithmetic) are enforced before codec work. | +| `export` | Deterministic offline MP4 export: steps `render(evaluate(project, t))` frame by frame plus the audio mixer, encoded with `Mp4Encoder`. Never a recording of playback. | +| `transcribe` | Local automatic subtitles: whisper.cpp speech recognition behind the opt-in `whisper` cargo feature (whisper.cpp through the whisper-rs bindings; needs cmake, a C++ toolchain and libclang), on-demand SHA-256-verified model downloads with resumable atomic writes, 16 kHz mono audio preparation on top of `audio`, pure cue splitting (line/duration/overlap rules) and SRT/WebVTT reading and writing. Everything but the engine works without the feature. | +| `control` | Local JSON-RPC 2.0 control protocol over a user-only socket/named pipe: methods (including `export`), token auth, headless handler and client. | +| `plugin-api` | The WIT world (`crates/plugin-api/wit/plugin.wit`), the `plugin.toml` manifest format, `.amplugin` package (zip of `plugin.toml` + `plugin.wasm`), the inspector schema, guest SDK and first-party clip authoring helpers (`sources`). | +| `plugin-host` | wasmtime Component Model runtime: loading/compiling plugins, the sandbox (fuel, epoch, memory, output caps), host imports (shape-text, svg-to-paths, typeset-math, limits, log, and `read-sibling` for importers), ABI 1.1.0 (1.0.0 components load unchanged) plus an explicit 0.2.x adapter, plugin scene resolution, pixel-effect plugins (`PluginHost::effects`, `effect_processor`: instance-pre cached components, a fresh fuel/memory/epoch-limited store per call, frame-size caps), animation presets (`PluginHost::animation_presets`, `animation_preset_command`) and importers (`PluginHost::importers`, `PluginHost::import`). | +| `typeset` | Host-side math typesetting: Typst as a library plus MiTeX for LaTeXβ†’Typst conversion, turned into vector path outlines plus a tight bbox. | +| `import-v1` | One-way importer for v1 `.animathio` projects (deflated JSON + base64 media). Still native (see "Importers" below). | +| `import-manim` | One-way importer for Manim Community scene scripts (`.py`), parsed with a small pure-Rust Python parser (`pyparse`) whose node vocabulary follows tree-sitter-python. The app runs it only inside the `org.animathio.import-manim` importer plugin. | +| `apps/animathio-cli` | Headless validation, PNG rendering, MP4 export, importers and the MCP sidecar. | +| `apps/animathio` | The GPUI desktop editor: a thin view over the command-only core, plus an export worker and dialog. | +| `plugins/*` | Standalone first-party WebAssembly plugins: `shapes`, `text`, `latex`, `graph`, `effects-basic`, `audio-basic`, `animations` (animation presets), `import-manim` (Manim importer), `trap` (sandbox fixture), and `examples/hello`. | + +Video clips decode through `render::FrameSource` via the `media` crate's +`MediaPool`, so real video frames appear in preview, the CLI and headless +renders. `export` encodes MP4 (H.264 + AAC, BT.709-tagged) offline. WebM export +and an FFmpeg fallback backend remain future work; `MediaBackend` is shaped so a +second backend can be added without touching callers. + +## Layering + +Dependencies point inward. The core owns its domain types and exposes no +`&mut` outside command application; the UI and control layers change state only +through `Command`s. + +```mermaid +flowchart TD + UI[apps/animathio Β· apps/animathio-cli] --> CTL[control] + CTL --> IMP[import-v1] + CTL --> RENDER[render] + CTL --> AUDIO[audio] + CTL --> EXPORT[export] + RENDER --> MEDIA[media] + EXPORT --> RENDER + EXPORT --> MEDIA + EXPORT --> AUDIO + MEDIA --> AUDIO + IMP --> FORMAT[format] + CTL --> FORMAT + FORMAT --> CORE[core] + AUDIO --> CORE + MEDIA --> CORE + RENDER --> CORE + EXPORT --> CORE + CTL --> HOST[plugin-host] + HOST --> API[plugin-api Β· WIT/SDK] + HOST --> TYPESET[typeset] + HOST --> CORE + TYPESET --> CORE +``` + +`render` and `export` share `media`; `export` additionally uses `audio`'s mixer +and `render`'s rasterizer, and `media` reuses `audio`'s Symphonia decode for +non-indexed audio assets. Every crate bottoms out in `core`. + +Rules that keep the layers honest: + +- `core` has no IO/GPU/decoder deps. `Project` contains no runtime resources. +- `format`, `render`, `audio`, `media`, `export`, `import-v1`, `import-manim`, + `control` and `plugin-host` all depend on `core` and never the reverse. +- `control` sits above `format`/`render`/`export`/`import-v1` so the MCP sidecar + can load, mutate, render, export and import headlessly without the editor. + Manim import and animation presets reach `control` only through `plugin-host`; + `import-manim` is compiled into the `plugins/import-manim` component, not linked + into the apps. +- Third-party crates (FilmCraft, vello, GPUI) stay behind adapter boundaries; + no third-party type leaks into `core`. + +## Desktop editor foundations + +`editor_env.rs` supplies production defaults and a headless test environment (monotonic +playback clock, CPU preview, built plugins or no plugins, private settings/cache paths). +`editor/ui_tests` mounts the real editor in gpui's test window and exercises actions and +shared panel handlers, asserting project and view state without devices or pixel snapshots. + + +`apps/animathio/src/editor.rs` owns view state and composes implementation modules +under `editor/`: `menus`, `workspace`, `viewer`, `transport`, `timeline_view`, +`fields`, `audio_effects` (inspector audio-effect cards), `animations` (the inspector +Animations section and the Effects-tab preset library), `video_effects` (inspector video-effect cards), `inspector_view`, `media_pool`, `math` (Math tab, typed object dialog and inspector), `titles` (Titles tab), `dialogs`, `export_panel` +(export queue popover), `start_screen`, `templates`, `clip_ops`, `commands`, `project_io`, +`control_bridge`, `playback_glue`, `timeline_thumbnails` and `actions`. Shared drawing/resource helpers live in +`support`; `color_edit` owns the live-preview transaction (colour pickers, sliders, +number scrubbing and the viewer's transform gizmo all preview through it, so one +gesture is one history entry). The gizmo maths in `viewer` shares the renderer's +canvas mapping and builds its edit with `inspector::transform_edit_commands`, which +merges plain properties into one `SetTransform` and keyframes animated ones. `editing.rs` holds pure +shuttle, in/out, blade and ripple command planning. In/out points and tool mode stay +in view state. Ripple trim uses one `Command::Batch` on the source track; +Shift+Delete uses `RippleDelete`. The ruler and export range share half-open bounds. +The audio device clock stays master at every shuttle speed; with no output device a signed +monotonic clock stands in. + +Audible shuttle lives in `crates/audio` (`Speed`, `BlockGenerator`, `varispeed`). +`Player::set_speed` restarts the session at the latency-corrected position like a seek. +Timeline painting uses GPUI canvas quads/paths and culls clips before building +labels or requesting previews. A separate `timeline_thumbnails` worker decodes +five source-time samples per visible video clip, resizes them to low-resolution +BGRA tiles and repeats one tile for still images. Keys include asset, source time +and track height; the queue holds 16 requests and the UI retains at most 256 tiles. +The worker keeps at most eight video decoders and eight small still images. +Waveforms reuse the editor's cached 4096-peak audio summaries and a bounded cache +of 128 paint-ready paths, invalidated by clip geometry, zoom, scroll or window +position changes. These resources +never enter the project model. The overview uses only lightweight clip ranges; +zoom interpolates view state over the design token's 180ms motion duration. + +The mixer worker (never the device callback) renders blocks: it mixes the timeline span a +block covers and resamples it by the signed rate with linear interpolation, carrying the +fractional position so blocks join seamlessly. Negative speeds read backwards, so the block +is the reversed PCM. Forward up to 8x and reverse up to 4x are audible (pitch follows +speed); faster rates push silence. The callback's clock is `origin + frames * speed` +computed with a rational speed (reverse counts down), so video stays exact at each rate. +Half-speed K+J/K+L jog uses `Speed::HALF`. + +Exports run through `export_queue`: each job owns a project snapshot, jobs run sequentially +on the export worker (`crates/export` honours the cancel flag through its progress +callback and leaves no partial file), and the editor polls the queue to drive the Export +queue popover and toasts. Control-protocol exports appear in the same queue. + +`start_screen` provides project presets, recents and importer entry points. +`templates` supplies launcher cards, the placeholder fill dialog and user-library save/delete. +Template manifests stay outside the project schema; source replacements are ordinary +undoable command batches. Media fitting uses the typed `Clip::fit` field in both +rendering backends. Workflow +dialogs use gpui-component forms; export works on an immutable snapshot, so selecting +a delivery preset does not change the open project. `control::ExportPreset` is the +shared table for editor, CLI and MCP. Preferences persist under the application +config directory (`preferences.json`, renderer selection in `preview.json`), the +main-window geometry (`window-state.json`, written atomically from a debounced +save, with display UUID and display-local position; restored on that display or +the primary if disconnected, clamped to its usable area; maximized sessions retain +the initial restore size) and never enter project serialization. + +The `actions` module registers GPUI actions and a contextual keymap (`Editor`, +`Timeline`, `Viewer`, `Inspector`, `MediaPool`). `secondary-` bindings are resolved +with GPUI's OS-aware loader: Cmd on macOS and Ctrl elsewhere. App menus and button +tooltips read hints from those bindings. Text and numeric inputs own their editing +keys, clipboard, selection and IME; timeline Delete/Space never intercept a focused +input. The Help menu opens the shortcut reference. + +The workspace uses horizontal and vertical resizable panel groups. Sizes, visibility +and S/M/L track density (28/44/72 logical pixels) persist in `dock-layout.json` under +the application config directory. Older files default to medium tracks. Headers and +clips share a vertical scroll surface, so every track remains accessible. Wheel +scrolls vertically; Alt+wheel scrolls horizontally; Ctrl/Cmd+wheel zooms. + +Chrome uses the active dark theme, a 12 px base and monospaced timecodes. A single +custom title bar hosts the application menus, project/dirty state, control-server +status and Export. The status bar contains project output settings, duration and +autosave age. Transient errors, information and successful work use typed +notifications hosted by `Root`. + +A colour drag applies `Command`s for immediate preview. On pointer release, it +restores the original value with the inverse command and records the final command +once in `History`. Other commands and control calls finish a pending drag first, +so a colour change undoes in one step without swallowing adjacent edits. Asset +parameter selectors display names but commit asset identities (or `null` for None). + +## Time model (integer ticks) + +AniMathIO 2.0 uses **integer ticks** at a fixed rate, with **rational frame rates** +on top. The rate is 705,600,000 ticks per second β€” the *flicks* constant, chosen so +frame and audio-sample boundaries are always exact: + +```text +TICKS_PER_SECOND = 705_600_000 +``` + +It is divisible by 24, 25, 30, 50, 60, 120, the NTSC numerators 24000/30000/60000/ +120000 (so 23.976, 29.97, 59.94 and 119.88 fps are exact), and the audio rates +44100/48000/96000/192000. An `i64` of ticks still spans over 400 years in either +direction. Code and CLI flags call the unit "ticks"; the underlying rate is the +flicks rate. + +- `Time(i64)` β€” a signed tick position. Negative values are allowed for intermediate math. +- `FrameRate { numerator, denominator }` β€” a positive, reduced rational rate. + `frame_to_time(frame, rounding)` and `time_to_frame(time, rounding)` convert with + an explicit `Rounding` policy (`Floor`, `Ceil`, `Nearest`) so rational frame + boundaries that fall between ticks are never silently rounded. +- `TimeRange { start, end }` β€” a half-open `[start, end)` nonnegative interval. + +The `core` model stores no `f64` seconds and no absolute pixels. `Transform` is +resolution-independent (position/scale are fractions of the canvas, rotation is +radians, opacity is `[0, 1]`). Pixel conversion happens only at the render/UI +boundary. + +## Engine rules from #156 + +Each rule exists because of a specific v1 failure, and each is enforced by a test. + +| v1 failure | 2.0 rule | Enforced by | +| --- | --- | --- | +| Live Konva nodes, `