Creating 3Blue1Brown-Style Animated Videos with Hermes Agent's Manim Skill
Manim CE animations: 3Blue1Brown math/algo videos.
Written by Neura Market from the official Hermes Agent documentation for Manim Video. Commands, paths, and version numbers are reproduced from the source unchanged.
Read the official documentationNeura Market Manim Animation Reference
Overview
This reference documents the complete pipeline for producing 3Blue1Brown-style animated explainer videos using Manim Community Edition. The tool is designed for educational, mathematical, and technical content, including animated explanations, math animations, concept visualizations, algorithm walkthroughs, and technical explainers. It handles programmatic animation with geometric or mathematical content, algorithm visualizations, equation derivations, architecture diagrams, data stories, paper explainers, and 3D visualizations.
Prerequisites
Before beginning any project, ensure the following dependencies are installed:
- Python 3.10 or later
- Manim Community Edition v0.20 or later (install with
pip install manim) - A LaTeX distribution:
texlive-fullon Linux,mactexon macOS - ffmpeg
Run scripts/setup.sh to verify all dependencies are present.
Project Structure
Every project must follow this directory layout:
project-name/
plan.md # Narrative arc, scene breakdown
script.py # All scenes in one file
concat.txt # ffmpeg scene list
final.mp4 # Stitched output
media/ # Auto-generated by Manim
videos/script/480p15/
Full Video Production Pipeline
The pipeline follows six ordered steps:
PLAN --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW
Step 1: Plan
Write plan.md containing the narrative arc, scene list, visual elements, color palette, and voiceover script. Before coding, articulate the narrative arc: what misconception is corrected, what is the "aha moment", and what visual story takes the viewer from confusion to understanding.
Step 2: Code
Write script.py with one class per scene, each independently renderable. Use shared color constants at the file top. Set self.camera.background_color in every scene. Add subcaptions on every animation. End each scene with FadeOut of all mobjects.
Use this template for every scene file:
from manim import *
BG = "#1C1C1C"
PRIMARY = "#58C4DD"
SECONDARY = "#83C167"
ACCENT = "#FFFF00"
MONO = "Menlo"
class Scene1_Introduction(Scene):
def construct(self):
self.camera.background_color = BG
title = Text("Why Does This Work?", font_size=48, color=PRIMARY, weight=BOLD, font=MONO)
self.add_subcaption("Why does this work?", duration=2)
self.play(Write(title), run_time=1.5)
self.wait(1.0)
self.play(FadeOut(title), run_time=0.5)
Step 3: Render
Run Manim with the appropriate quality flag. Always iterate at -ql quality for drafts; only use -qh for final output.
manim -ql script.py Scene1_Introduction Scene2_CoreConcept # draft
manim -qh script.py Scene1_Introduction Scene2_CoreConcept # production
Step 4: Stitch
Create concat.txt listing scene MP4 files in order, then run ffmpeg concat to produce final.mp4.
cat > concat.txt << 'EOF'
file 'media/videos/script/480p15/Scene1_Introduction.mp4'
file 'media/videos/script/480p15/Scene2_CoreConcept.mp4'
EOF
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4
Step 5: Audio (Optional)
Add voiceover and/or background music via ffmpeg. Voiceover can be generated using ElevenLabs or Qwen3-TTS.
Step 6: Review
Render preview stills without full video render to verify against the plan.
manim -ql --format=png -s script.py Scene2_CoreConcept # preview still
Parameters
Quality Flag
The quality flag determines resolution and FPS:
-ql: 854x480 at 15 FPS (draft)-qm: 1280x720 at 30 FPS (medium)-qh: 1920x1080 at 60 FPS (production)
run_time (Animation Speed)
Duration of an animation in seconds. Standard values:
- Title/intro: 1.5s
- Key equation reveal: 2.0s
- Transform/morph: 1.5s
- Supporting label: 0.8s
- FadeOut cleanup: 0.5s
- "Aha moment" reveal: 2.5s
self.wait() Duration
Pause after an animation. Standard values:
- After title/intro: 1.0s
- After key equation reveal: 2.0s
- After transform/morph: 1.5s
- After supporting label: 0.5s
- After FadeOut cleanup: 0.3s
- After "aha moment" reveal: 3.0s
font_size
Text size in Manim units. Scale:
- Title: 48
- Heading: 36
- Body: 30
- Label: 24
- Caption: 20
Minimum is font_size=18 for readability.
buff (For Edge Text)
Padding when placing text at screen edge. Must be 0.5 or greater.
label.to_edge(DOWN, buff=0.5) # never < 0.5
subcaption
Text for voiceover or subtitle synced to an animation. Can be passed as argument to self.play() or via self.add_subcaption().
self.add_subcaption("text", duration=N)
# or
self.play(..., subcaption="text")
Typography and Colors
Font
Use monospace fonts for all text. Manim's Pango renderer produces broken kerning with proportional fonts at all sizes. Define the font once at the top of the file:
MONO = "Menlo" # define once at top of file
Text("Fourier Series", font_size=48, font=MONO, weight=BOLD) # titles
Text("n=1: sin(x)", font_size=20, font=MONO) # labels
MathTex(r"\nabla L") # math (uses LaTeX)
Color Palette
All scenes in a project must share a cohesive color palette. Standard palettes include:
- Dark theme:
#1C1C1Cbackground,#58C4DDprimary,#83C167secondary,#FFFF00accent - Alternative dark:
#2D2B55background,#FF6B6Bprimary,#FFD93Dsecondary,#6BCB77accent - Neon:
#0A0A0Abackground,#00F5FFprimary,#FF00FFsecondary,#39FF14accent - Light:
#1A1A2Ebackground,#EAEAEAprimary,#888888secondary,#FFFFFFaccent
For visual design guidance, see references/visual-design.md.
Per-Scene Variation Requirement
Every scene must vary from the others in these four ways:
- Choose a different dominant color from the palette for each scene.
- Use a different layout (not always center everything).
- Use a different animation entry method (Write, FadeIn, GrowFromCenter, Create).
- Vary visual weight: some scenes dense, others sparse.
Creative Divergence (Experimental/Creative Requests Only)
For experimental or creative requests, select one of two strategies:
SCAMPER
Apply one of these operations to the standard visualization metaphor: Substitute, Combine, Reverse, Modify, or Eliminate.
Assumption Reversal
List standard assumptions about how the topic is visualized, pick the most fundamental one, reverse it, and explore what the reversal reveals.
LaTeX Handling
Always use raw strings for LaTeX. Never use regular strings.
# WRONG: MathTex("\frac{1}{2}")
# RIGHT:
MathTex(r"\frac{1}{2}")
Animation Rules
Mobject Management
Never animate a mobject that hasn't been added to the scene.
self.play(Create(circle)) # must add first
self.play(circle.animate.set_color(RED)) # then animate
Text Replacement
FadeOut old text before writing new text in the same position. Use ReplacementTransform instead of Write on top.
self.play(ReplacementTransform(note1, note2)) # not Write(note2) on top
Opacity Layering
- Primary elements: 1.0
- Contextual elements: 0.4
- Structural elements (axes, grids): 0.15
Breathing Room
Every animation must be followed by self.wait() for breathing room. A 2-second pause after a key reveal is never wasted.
Scene Cleanup
End each scene with a fade out of all mobjects:
self.play(FadeOut(Group(*self.mobjects)))
Content Principles
- Show geometry before algebra: show the shape first, the equation second.
- Use
.animatefor property transitions on existing mobjects (seereferences/animations.md). - For algorithm visualizations, see
references/graphs-and-data.md. - For equation derivations, see
references/equations.md. - For architecture diagrams, see
references/mobjects.md. - For 3D visualizations, see
references/camera-and-3d.md. - For paper explainers, see
references/paper-explainer.md. - For scene planning, see
references/scene-planning.md. - For decorations, see
references/decorations.md. - For updaters and trackers, see
references/updaters-and-trackers.md. - For production quality, see
references/production-quality.md. - For animation design thinking, see
references/animation-design-thinking.md. - For troubleshooting, see
references/troubleshooting.md. - For rendering details, see
references/rendering.md.
Failure Modes
Avoid these common failures:
- Cluttered, poorly timed, or "AI-generated slides" appearance (violates first-render excellence).
- Random different colors across scenes (violates cohesive visual language).
- Broken kerning in text (using proportional fonts instead of monospace).
- LaTeX errors (missing raw string prefix).
- Animation on non-added mobject (causes runtime error).
- Text overlapping or clipped at edge (buff less than 0.5).
- Rushing from one animation to the next without
self.wait(). - Missing subcaptions on animations.
- Using Write on top of existing text instead of
ReplacementTransform.
Example Modes
The tool supports these modes, each with specific reference documents:
- Concept explainer: topic/concept input, animated explanation with geometric intuition output. See
references/scene-planning.md. - Equation derivation: math expressions input, step-by-step animated proof output. See
references/equations.md. - Algorithm visualization: algorithm description input, step-by-step execution with data structures output. See
references/graphs-and-data.md. - Data story: data/metrics input, animated charts, comparisons, counters output. See
references/graphs-and-data.md. - Architecture diagram: system description input, components building up with connections output. See
references/mobjects.md. - Paper explainer: research paper input, key findings and methods animated output. See
references/scene-planning.md. - 3D visualization: 3D concept input, rotating surfaces, parametric curves, spatial geometry output. See
references/camera-and-3d.md.