MMFX
MMFX is MMRecode’s portable scene, layout, animation, transition, and visual-effect system. It separates two authoring needs:
- artists describe text, rectangles, images, media, groups, layout, styling, and animation with a strict CSS-shaped scene language;
- effect authors will implement custom generators, filters, and transitions with a separate safe, bounded kernel language.
It looks like CSS, but it is not a browser
MMFX keeps familiar property names where their behavior fits deterministic video rendering. It does not include a DOM, JavaScript, selector specificity, browser compatibility recovery, or a global cascade.
Unknown declarations are errors. A misspelling should produce a source-spanned diagnostic and a useful suggestion rather than silently changing the render.
@scene lower-third {
width: 1280px;
height: 720px;
@font Inter {
src: "../../assets/fonts/Inter.ttf";
}
@group card {
left: 6%;
bottom: 8%;
width: 58%;
height: 150px;
overflow: hidden;
border-radius: 24px;
background: #192433e8;
@text title {
content: "MMRecode";
font-family: Inter;
font-size: 38px;
color: #f4f7f8;
}
}
}
CPU execution defines correctness
Scene evaluation, layout, text shaping, and the scalar reference renderer run on the CPU. The first optional wgpu project compositor already consumes the outer backend-neutral graph for RGBA overlays. Tiled/SIMD scene execution and broader WGSL/wgpu preview are accelerators consuming the same typed intermediate representations; they do not define separate effect semantics.
General composition uses linear-light, premultiplied alpha. Codec YUV is converted at the render boundary and converted back only for delivery.
Current executable foundation
The mmrecode-mmfx crate currently provides:
- typed
Scene,Group,Rect,Font,Text, andImageobjects; - strict, source-spanned parsing and validation;
- nested overlay, row, and column layout with absolute children, padding, gap, alignment, and justification;
- pixel, percentage, and intrinsic
autosizes with min/max constraints; - typed public parameters with strict
var(--name)references and persisted editor bindings; - colors, opacity, clipping, and rounded corners;
- image
contain,cover, andfillfitting; - exact local-frame keyframes, easing, translation, scaling, rotation, and cover-style scrolling;
- Parley text shaping and layout;
- Swash/Zeno glyph coverage and antialiasing;
- explicit font resources with no silent system-font fallback; and
- a linear-premultiplied scalar CPU renderer;
- backend-neutral scene and project composition graphs; and
- stable frame-resource identities with a bounded, backend-owned device cache policy; and
- a cached wgpu backend for positioned RGBA project composition, enabled by default in the terminal application with a non-blocking monitor readback ring and CPU fallback.
The terminal editor creates declarative content with add scene, edits embedded source, or links an
external .mmfx module with a persisted last-valid cache. Linked files are polled and debounced;
only source that parses and type-checks replaces the cache, while missing or invalid files retain
the current preview/export snapshot. The animated timeline remains scrubbable while embedded source
is open. The default monitor project view composites the draft scene over underlying media at the
project playhead. monitor local explicitly isolates the current hierarchy context and its
descendants, while monitor toggle switches views without moving either mapped playhead. Merely
using cd never changes monitor scope. The fx namespace is reserved for the future
filter/transition/kernel workflow; legacy add fx remains compatible. The same exact placement-time
evaluation is used for nested timeline preview and MPEG-2/TS project export.
What comes next
Media slots, fallback fonts, richer animation controls, named reusable styles, Kernel IR, transitions, GPU scene rendering, GPU scaling/color conversion, direct native-surface delivery, optimized CPU execution, and the plugin boundary are not implemented yet.
See the executable Scene 0.4 reference and inline, rendered examples.
See the complete design record in mmfx-concept.md.