Skip to content

cmotion

cmotion is a small, statically-typed programming language for video, motion graphics, and animation. The same source program renders identically as a deterministic offline frame sequence and as a realtime GPU preview.

It is infrastructure, not a product — hosts embed it.

Edit the source below and click Render to see it run. The code is parsed, type-checked, and evaluated by cmotion-render.wasm — the same interpreter that powers cmo on the CLI.

Edit above, click Render to apply. Open in /editor →

A single program contains:

  • Units across domains (1920px, 6s, 280deg, 8.6deg, 0.25) — the type system enforces that a duration is a duration and a length is a length.
  • Perceptual color (oklch(0.78, 0.20, hue)) — animating only the hue gives a smooth color wheel with no muddy midpoints, because oklch / oklab / srgb are first-class color literals in the language.
  • 3D primitives (extrude(text.glyph("C"), depth: 16px)) — mesh3d is part of the stdlib; 3D scenes project back to a 2D Layer via render3d(...) so they compose alongside 2D layers.
  • Composition (compose [bg, render3d(...)]) — layered, typed, declarative.
  • Animation as valuesanimate { ... } with { repeat: forever } for keyframes and wave(amplitude:, period:) for continuous motion. Multiple independent animations drive different properties of the same mesh (x and y rotation, scale, hue) and loop on their own periods.

This is the language and toolchain reference. It is being built in public, in stages — see the Roadmap. The Grammar is the first thing locked.

cmotion is pre-release. The grammar spec is at v0.2; no compiler exists yet. The first milestone is the tree-sitter parser.