Skip to main content

Lightweight motion graphics for explainers — Typst math, Skia rendering, PyAV MP4 export, built for speed and LLM-friendly scene code.

Project description

MotionGram 📽️

The grammar of motion graphics.

Lightweight motion graphics for explainers and teaching clips: Typst math → SVG, Skia rasterization, PyAV MP4 export, optional Kitten TTS narration. Scene APIs favor explicit timelines and small composable primitives— approachable for humans and for LLM-assisted authoring.

MotionGram preview

Install and import as motiongram (pip install -e ".[dev]" from this repo).

Goal Target
Cold render Fast path vs typical LaTeX-disk + subprocess-encode pipelines
Install size ~80 MB core ([tts] optional: upstream Kitten stack + HF models, much larger)
Math Typst → SVG (no TeX Live)
Render Skia (no Cairo)
Encode PyAV in-memory (no per-frame disk + FFmpeg subprocess)
Voice-over Kitten TTS local TTS, Apache-2.0 (optional [tts] extra)

Installing [tts] may pull a large dependency tree (for example PyTorch and friends) as required by upstream kittentts 0.8.x — keep it optional. Core animation deps stay separate.

Status: pre-alpha — core rendering pipeline (Skia + Typst + PyAV) is functional; see docs/ for requirements and design.

Tutorial: step-by-step build from ASCII to PyAV-oriented design in learn/ (phases 000100).

Demo

Short reel rendered from examples/showcase_intro.py (720p). The same file is committed as docs/assets/readme-demo.mp4 so it shows up on GitHub without relying on external hosting.

Regenerate locally:

motiongram render examples/showcase_intro.py -o docs/assets/readme-demo.mp4

Running python examples/showcase_intro.py writes showcase_intro.mp4 in the current working directory; move or rename it if you are refreshing the committed demo.

If the preview does not load (some viewers block autoplay), open docs/assets/readme-demo.mp4 directly.

Quick start

# Install (requires Python 3.11+)
uv pip install -e ".[dev]"

# Install Typst CLI for math rendering
curl -fsSL https://github.com/typst/typst/releases/latest/download/typst-x86_64-unknown-linux-musl.tar.xz \
  | tar -xJ --strip-components=1 -C ~/.local/bin/

# Polished 720p showcase (recommended)
motiongram render examples/showcase_intro.py -o showcase.mp4

# Full-stack demo (text + math + code + circle)
motiongram render examples/math_and_text.py -o output.mp4

# Or run directly
python examples/showcase_intro.py
python examples/math_and_text.py

See the Setup Guide for platform-specific instructions.

YAML scenes

Declarative manifests drive the same Node classes and timeline animators as Python scenes — useful for lectures, LLM-authored content, and non-programmers.

# Deep-learning showcase (port of examples/deeplearning_showcase.py)
motiongram render examples/yaml/deeplearning_showcase.yaml -o showcase.mp4

# Lecture with sections, recipes, and auto section titles
motiongram render examples/yaml/weight_decay_lecture.yaml -o weight_decay.mp4

Full field reference: YAML schema (SCHEMA.md). Python scenes remain the escape hatch for custom logic; YAML covers composition, elements, animations, sections, and recipes like ForwardPass.

Principles gallery

Twelve drawing and twelve animation principle demos live under examples/principles/. Each script writes an MP4 next to itself (those outputs stay gitignored).

python examples/principles/04_value.py

Index and topics: Principles examples guide.

Documentation

License

MIT — see LICENSE.

Author

Nabin Oli

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

motiongram-0.4.0.tar.gz (800.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

motiongram-0.4.0-py3-none-any.whl (100.8 kB view details)

Uploaded Python 3

File details

Details for the file motiongram-0.4.0.tar.gz.

File metadata

  • Download URL: motiongram-0.4.0.tar.gz
  • Upload date:
  • Size: 800.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for motiongram-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e3d9a302609804a9af155ed65fbe308b6ff69c1f8355636007c6cd2666e519f0
MD5 6c168bc9645ba2769aed63ea93db4b19
BLAKE2b-256 09b29982cef448785bc97550edff25fc3d11a3e761282e84737d9bd0933ea244

See more details on using hashes here.

File details

Details for the file motiongram-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: motiongram-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 100.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for motiongram-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32691d43ea577ebb764fd7ff95835bc2982c3e9fb77cf42771145d95b8d8ce46
MD5 a5358192ff77c6f5b4e2fba9901a5fe9
BLAKE2b-256 7ec136c0f888251cecc991c33758ee8dbe389e6771bdaa47b337acf43bd868dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page