This release is a pre-release and may not be stable for production use.
typemotion
typemotion is a lightweight Python text animation engine for transparent
video overlays. It uses Pango/Cairo for text layout and drawing, plus FFmpeg for
encoding ProRes 4444 MOV output.
This repository is in alpha development. See engine_design.md
for the product and architecture design.
Installation
pip install typemotion
typemotion wraps Pango/Cairo (text layout/drawing) and FFmpeg (encoding). The
Python wheels install via pip, but the native C libraries are not
pip-managed — install them once for your OS, then verify with
typemotion doctor:
# macOS
brew install pango cairo glib libffi pkg-config ffmpeg
# Debian / Ubuntu
sudo apt-get install libpango-1.0-0 libpangocairo-1.0-0 libcairo2 libglib2.0-0 ffmpeg
# Fedora
sudo dnf install pango cairo glib2 ffmpeg
# Windows: use WSL (Ubuntu) and the Debian/Ubuntu line above.
Quick start
typemotion doctor
typemotion render examples/specs/caption.yaml -o /tmp/caption.mov
typemotion render --text "Hello\nTypemotion" --animation char-pop --style caption -o /tmp/text.mov
typemotion preview examples/specs/caption.yaml -o /tmp/caption-preview.mp4 --background "#20242a"
typemotion preview examples/specs/glow-slide.yaml -o /tmp/glow-preview.mp4
typemotion render examples/specs/gradient-title.yaml -o /tmp/gradient.mov
typemotion render examples/specs/keyword-highlight.yaml -o /tmp/keyword.mov
typemotion render examples/specs/highlight-sweep.yaml -o /tmp/highlight-sweep.mov
typemotion render examples/specs/karaoke.yaml -o /tmp/karaoke.mov
typemotion render examples/specs/word-karaoke.yaml -o /tmp/word-karaoke.mov
typemotion preview examples/specs/timeline-segments.yaml -o /tmp/timeline-preview.mp4
typemotion render --preset-file examples/presets/brand-presets.yaml \
--text "Brand" --style brand_caption --animation brand_pop -o /tmp/brand.mov
# spring easing, metallic (inner glow + shadow), decode, motion blur, bloom, wave warp
typemotion preview examples/specs/spring-pop.yaml -o /tmp/spring.mp4 --background "#12151a"
typemotion preview examples/specs/metallic-title.yaml -o /tmp/metallic.mp4 --background "#12151a"
typemotion preview examples/specs/decode-title.yaml -o /tmp/decode.mp4 --background "#12151a"
typemotion preview examples/specs/motion-blur.yaml -o /tmp/motionblur.mp4 --background "#12151a"
typemotion preview examples/specs/bloom-neon.yaml -o /tmp/bloom.mp4 --background "#12151a"
typemotion preview examples/specs/wave-text.yaml -o /tmp/wave.mp4 --background "#12151a"
Layout item source (self vs native)
layout.item_source controls how animated items (char / word / line scope)
are sourced from the text:
self(default): each unit is laid out as an independent Pango layout. Cheap, easy to animate per-unit, but loses cross-character shaping and ignoresline_spacingon the char path.native: one fully-shaped Pango block layout, walked viaLayoutIterto read each cluster/line geometry. Preserves font fallback, complex-script shaping, native wrapping andline_spacing. Use for complex scripts or when typographic fidelity matters.
typemotion render examples/specs/native-char-pop.yaml -o /tmp/native-char-pop.mov
Style effects are pure Cairo (no Pillow)
The fancy-text effect pipeline (shadow, glow, gradient, image-texture fill) is implemented entirely with Cairo + numpy — no Pillow dependency.
- shadow / glow: the text mask is rasterized to a Cairo surface and blurred
with a numpy separable box blur (3 passes ≈ Gaussian), then composited via
ctx.mask. No Cairo↔Pillow round-trip. - gradient: native
cairo.LinearGradientclipped to the text path. - texture (PNG image fill): native
cairo.SurfacePatternwithEXTEND_REPEAT/REFLECT, clipped to the text path. Fills text with a gold-foil / pattern / photo texture.
typemotion render examples/specs/texture-title.yaml -o /tmp/texture.mov
style:
preset: outline-bold
texture: { path: "../assets/gold-texture.png", extend: reflect, scale: 1.0 }
Blend modes, inner styles & post-composite FX
Beyond the core pipeline, typemotion supports AE-style layer compositing and frame-level effects (all Cairo + numpy, no new dependencies):
- Blend modes on glow / shadow / gradient / inner styles —
screen,add,multiply,overlay,softLight, … (Cairo native operators). Theneonpreset usesscreenglow for additive light. - Inner styles (
inner_glow,inner_shadow) for depth / metallic titles. - Parametric spring easing (
springSoft/springSnappy/springBouncy, or{spring:{zeta,omega}}) plus the full standard set (elastic, bounce, back, expo, …). - Text-animator selectors (
animation.selector): range (wave reveal) and wiggly (additive float), and character offset / decode (animation.decode). - Post-composite FX applied to the finished frame:
motion_blur(directional, or sub-frameaccumulatefor scale/rotation/per-char motion),bloom,distortion(wave / bulge / twirl),grade(tritone). Compositions take these under a top-leveleffects:block.
animation:
keyframes:
- { t: 0, scale: 0.3 }
- { t: 1, scale: 1, easing: { spring: { zeta: 0.32, omega: 13 } } }
motion_blur: { mode: accumulate, samples: 6, shutter_deg: 360 }
bloom: { threshold: 0.55, radius: 18, intensity: 0.85 }
Preset files can define styles and animations. A preset may use extends to
inherit from a builtin preset and override only the fields that need to change.
Animations can also use declarative timeline tracks or enter / emphasis /
exit segments; see examples/specs/timeline-segments.yaml.
For the full YAML format reference (all style/animation fields, the animatable
property surface, keyframe/modifier/stagger syntax, and worked examples), see
docs/yaml_reference.md.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typemotion-0.1.0a0.tar.gz.
File metadata
- Download URL: typemotion-0.1.0a0.tar.gz
- Upload date:
- Size: 685.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da720534d980a2bf9599ff70ee4a71e07f099c74bd12d677f545b4ced93941e3
|
|
| MD5 |
571468119782faac5c888089a1e128ac
|
|
| BLAKE2b-256 |
ea537b1d30a7316b76de596dd9559dc891e3d5cc4b074d3f0b88a87dcfee23a7
|
File details
Details for the file typemotion-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: typemotion-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 127.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
731b0fb97ecf3c910854e930312739cd5c7d454607cfe50149b5d7b22481431d
|
|
| MD5 |
f493d758977bf72a5430b48069cf4a49
|
|
| BLAKE2b-256 |
2012138afe3c216c2d454035072d0431c0c8ab91e7264d13a9359091305c9787
|