Manim Engine
What is Manim?
Manim (Mathematical Animation Engine) is an open-source Python library originally created by 3Blue1Brown for making math explainer videos on YouTube. It lets you write code that produces smooth, precise animations — shapes morphing, text appearing, graphs drawing themselves.
TKK uses Manim Community Edition v0.20 because every frame is defined in code, which means videos are reproducible, tweakable, and can be generated without any manual work.
How a Screenplay Works
Each video is a single Python file ({topic}_manim.py, ~600 lines) containing:
- A docstring with VTT timing cues mapping narration to scenes
- A
TTS_SCRIPTvariable with the full narration text - 6 Scene classes, each extending Manim's
Scene - A
render_previews()function for quick PNG snapshots - A
__main__block that renders all scenes, concatenates, and merges audio
Each Scene class has a construct() method that creates objects (text, shapes, images) and plays animations timed to the narration. A DURATION constant on each scene controls its allocated time slice.
Zone Layout System
The frame is 9x16 (1080x1920). Content must fill the full vertical space using 5 named zones. All positioning uses safe_place(mob, "ZONE") from anim_primitives.py.
| Zone | Y Center | Use |
|---|---|---|
| TITLE | 6.2 | Scene label pills |
| UPPER | 3.5 | Hero visual top |
| MID | 0.0 | Central focal point |
| LOWER | -3.5 | Supporting visuals |
| FOOTER | -6.0 | Captions, source labels |
Animation Verbs
Common Manim animations used in TKK screenplays:
QA Pipeline
Three automated checks run on every screenplay before final render:
- Layout QA — verifies content fills the vertical frame, checks zone coverage and balance
- Readability QA — contrast ratios, margin clearance, text size minimums
- Sync QA — AV drift (video vs audio duration), dead time (animations finishing early), number sync (visual numbers in correct scene), scene budget (minimum 1.5s per scene)
Strengths & Weaknesses
Strengths
- Precision — every pixel is code-defined
- Proven — 44+ published videos
- Mature QA — 3 automated checkers
- Rich animation vocabulary
- Reproducible — same code = same video
Weaknesses
- ~600 lines of Python per video
- 1-2 min render time
- High code complexity per video
- Harder to iterate quickly
- Each video is a bespoke program