# 3b1b/manim architecture

> Architecture diagram of the GitHub repository 3b1b/manim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/3b1b/manim
- Repository: https://github.com/3b1b/manim

## Overview

ManimGL is a Python engine for programmatic explanatory animations. A user selects a scene through the command line; scene extraction loads and runs it, advancing mobjects through animations. The scene asks the camera to capture frames, which the renderer draws; playback and optional video output are handled through the window and scene writer. The map also includes the documented interactive workflow and the core shape, text, animation, configuration, and GPU-rendering layers. Relationships are limited to README statements and source-index references or excerpts; unsampled subsystems are represented at their enclosing paths.

Main entry points: [`manimlib/scene/scene.py`](https://github.com/3b1b/manim/blob/master/manimlib/scene/scene.py) (Scene orchestration), [`manimlib/mobject/types/vectorized_mobject.py`](https://github.com/3b1b/manim/blob/master/manimlib/mobject/types/vectorized_mobject.py) (Vector graphics), [`manimlib/extract_scene.py`](https://github.com/3b1b/manim/blob/master/manimlib/extract_scene.py) (Scene extraction), [`manimlib/renderer/drawing.py`](https://github.com/3b1b/manim/blob/master/manimlib/renderer/drawing.py) (Drawing commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Scene entry"]
  node_extract["Scene extraction<br/>[extract_scene.py]"]
  node_loader["Module loading<br/>[module_loader.py]"]
  node_scene["Scene orchestration<br/>[scene.py]"]
  node_interactive["Interactive scenes"]
end

subgraph group_domain["Scene content"]
  node_animations["Animation system<br/>[animation.py]"]
  node_mobjects["Mobject model<br/>[mobject.py]"]
  node_geometry["Geometric shapes<br/>[geometry.py]"]
  node_vectors["Vector graphics"]
  node_text["Text and TeX<br/>[text_mobject.py]"]
end

subgraph group_visual["Visual pipeline"]
  node_camera["Camera capture<br/>[camera.py]"]
  node_drawing["Drawing commands<br/>[drawing.py]"]
  node_gpu["GPU rendering<br/>[gpu.py]"]
  node_pipeline["Render pipeline<br/>[pipeline.py]"]
  node_shaders["Shader sources<br/>[shader_source.py]"]
end

subgraph group_runtime["Playback and output"]
  node_window["Playback window<br/>[window.py]"]
  node_writer["Scene file writer"]
end

subgraph group_foundation["Shared foundations"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_bezier["Bezier geometry<br/>[bezier.py]"]
  node_color["Color utilities<br/>[color.py]"]
  node_space["Spatial utilities<br/>[space_ops.py]"]
  node_types["Type definitions<br/>[typing.py]"]
end

node_user(("Scene author"))

node_user -->|"selects scene"| node_extract
node_extract -->|"loads module"| node_loader
node_extract -->|"runs scene"| node_scene
node_extract -->|"supports interactive"| node_interactive
node_scene -->|"runs animations"| node_animations
node_scene -->|"manages objects"| node_mobjects
node_scene -->|"captures frame"| node_camera
node_scene -->|"writes output"| node_writer
node_scene -->|"polls events"| node_window
node_mobjects -->|"supports vector objects"| node_vectors
node_geometry -->|"builds paths"| node_vectors
node_camera -->|"uses GPU"| node_gpu
node_camera -->|"uses renderer"| node_drawing
node_drawing -->|"issues draw calls"| node_gpu
node_drawing -->|"uses pipelines"| node_pipeline
node_drawing -->|"loads shaders"| node_shaders
node_window -->|"drives playback"| node_scene
node_scene -->|"reads settings"| node_config
node_vectors -->|"uses curves"| node_bezier
node_vectors -->|"uses colors"| node_color
node_mobjects -->|"uses spatial math"| node_space
node_text -.->|"builds vector text"| node_vectors

click node_extract "https://github.com/3b1b/manim/blob/master/manimlib/extract_scene.py"
click node_loader "https://github.com/3b1b/manim/blob/master/manimlib/module_loader.py"
click node_scene "https://github.com/3b1b/manim/blob/master/manimlib/scene/scene.py"
click node_interactive "https://github.com/3b1b/manim/blob/master/manimlib/scene/interactive_scene.py"
click node_animations "https://github.com/3b1b/manim/blob/master/manimlib/animation/animation.py"
click node_mobjects "https://github.com/3b1b/manim/blob/master/manimlib/mobject/mobject.py"
click node_geometry "https://github.com/3b1b/manim/blob/master/manimlib/mobject/geometry.py"
click node_vectors "https://github.com/3b1b/manim/blob/master/manimlib/mobject/types/vectorized_mobject.py"
click node_text "https://github.com/3b1b/manim/blob/master/manimlib/mobject/svg/text_mobject.py"
click node_camera "https://github.com/3b1b/manim/blob/master/manimlib/camera/camera.py"
click node_drawing "https://github.com/3b1b/manim/blob/master/manimlib/renderer/drawing.py"
click node_gpu "https://github.com/3b1b/manim/blob/master/manimlib/renderer/gpu.py"
click node_pipeline "https://github.com/3b1b/manim/blob/master/manimlib/renderer/pipeline.py"
click node_shaders "https://github.com/3b1b/manim/blob/master/manimlib/renderer/shader_source.py"
click node_window "https://github.com/3b1b/manim/blob/master/manimlib/window.py"
click node_writer "https://github.com/3b1b/manim/blob/master/manimlib/scene/scene_file_writer.py"
click node_config "https://github.com/3b1b/manim/blob/master/manimlib/config.py"
click node_bezier "https://github.com/3b1b/manim/blob/master/manimlib/utils/bezier.py"
click node_color "https://github.com/3b1b/manim/blob/master/manimlib/utils/color.py"
click node_space "https://github.com/3b1b/manim/blob/master/manimlib/utils/space_ops.py"
click node_types "https://github.com/3b1b/manim/blob/master/manimlib/typing.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_extract,node_loader,node_scene,node_interactive toneBlue
class node_animations,node_mobjects,node_geometry,node_vectors,node_text toneAmber
class node_camera,node_drawing,node_gpu,node_pipeline,node_shaders toneMint
class node_window,node_writer toneRose
class node_config,node_bezier,node_color,node_space,node_types,node_user toneIndigo
```

## Components

### Scene entry

- [Scene extraction](https://github.com/3b1b/manim/blob/master/manimlib/extract_scene.py): `manimlib/extract_scene.py`
- [Module loading](https://github.com/3b1b/manim/blob/master/manimlib/module_loader.py): `manimlib/module_loader.py`
- [Scene orchestration](https://github.com/3b1b/manim/blob/master/manimlib/scene/scene.py): `manimlib/scene/scene.py`
- [Interactive scenes](https://github.com/3b1b/manim/blob/master/manimlib/scene/interactive_scene.py): `manimlib/scene/interactive_scene.py`

### Scene content

- [Animation system](https://github.com/3b1b/manim/blob/master/manimlib/animation/animation.py): `manimlib/animation/animation.py`
- [Mobject model](https://github.com/3b1b/manim/blob/master/manimlib/mobject/mobject.py): `manimlib/mobject/mobject.py`
- [Geometric shapes](https://github.com/3b1b/manim/blob/master/manimlib/mobject/geometry.py): `manimlib/mobject/geometry.py`
- [Vector graphics](https://github.com/3b1b/manim/blob/master/manimlib/mobject/types/vectorized_mobject.py): `manimlib/mobject/types/vectorized_mobject.py`
- [Text and TeX](https://github.com/3b1b/manim/blob/master/manimlib/mobject/svg/text_mobject.py): `manimlib/mobject/svg/text_mobject.py`

### Visual pipeline

- [Camera capture](https://github.com/3b1b/manim/blob/master/manimlib/camera/camera.py): `manimlib/camera/camera.py`
- [Drawing commands](https://github.com/3b1b/manim/blob/master/manimlib/renderer/drawing.py): `manimlib/renderer/drawing.py`
- [GPU rendering](https://github.com/3b1b/manim/blob/master/manimlib/renderer/gpu.py): `manimlib/renderer/gpu.py`
- [Render pipeline](https://github.com/3b1b/manim/blob/master/manimlib/renderer/pipeline.py): `manimlib/renderer/pipeline.py`
- [Shader sources](https://github.com/3b1b/manim/blob/master/manimlib/renderer/shader_source.py): `manimlib/renderer/shader_source.py`

### Playback and output

- [Playback window](https://github.com/3b1b/manim/blob/master/manimlib/window.py): `manimlib/window.py`
- [Scene file writer](https://github.com/3b1b/manim/blob/master/manimlib/scene/scene_file_writer.py): `manimlib/scene/scene_file_writer.py`

### Shared foundations

- [Runtime configuration](https://github.com/3b1b/manim/blob/master/manimlib/config.py): `manimlib/config.py`
- [Bezier geometry](https://github.com/3b1b/manim/blob/master/manimlib/utils/bezier.py): `manimlib/utils/bezier.py`
- [Color utilities](https://github.com/3b1b/manim/blob/master/manimlib/utils/color.py): `manimlib/utils/color.py`
- [Spatial utilities](https://github.com/3b1b/manim/blob/master/manimlib/utils/space_ops.py): `manimlib/utils/space_ops.py`
- [Type definitions](https://github.com/3b1b/manim/blob/master/manimlib/typing.py): `manimlib/typing.py`

### Other components

- **Scene author**

## Connections

- Scene author → Scene extraction: selects scene
- Scene extraction → Module loading: loads module (evidence: `manimlib/extract_scene.py`)
- Scene extraction → Scene orchestration: runs scene (evidence: `manimlib/extract_scene.py`)
- Scene extraction → Interactive scenes: supports interactive (evidence: `manimlib/extract_scene.py`)
- Scene orchestration → Animation system: runs animations (evidence: `manimlib/scene/scene.py`)
- Scene orchestration → Mobject model: manages objects (evidence: `manimlib/scene/scene.py`)
- Scene orchestration → Camera capture: captures frame (evidence: `manimlib/scene/scene.py`)
- Scene orchestration → Scene file writer: writes output (evidence: `manimlib/scene/scene.py`)
- Scene orchestration → Playback window: polls events (evidence: `manimlib/scene/scene.py`)
- Mobject model → Vector graphics: supports vector objects (evidence: `manimlib/mobject/mobject.py`)
- Geometric shapes → Vector graphics: builds paths (evidence: `manimlib/mobject/geometry.py`)
- Camera capture → GPU rendering: uses GPU (evidence: `manimlib/camera/camera.py`)
- Camera capture → Drawing commands: uses renderer (evidence: `manimlib/camera/camera.py`)
- Drawing commands → GPU rendering: issues draw calls (evidence: `manimlib/renderer/drawing.py`)
- Drawing commands → Render pipeline: uses pipelines (evidence: `manimlib/renderer/drawing.py`)
- Drawing commands → Shader sources: loads shaders (evidence: `manimlib/renderer/drawing.py`)
- Playback window → Scene orchestration: drives playback (evidence: `manimlib/window.py`)
- Scene orchestration → Runtime configuration: reads settings (evidence: `manimlib/scene/scene.py`)
- Vector graphics → Bezier geometry: uses curves (evidence: `manimlib/mobject/types/vectorized_mobject.py`)
- Vector graphics → Color utilities: uses colors (evidence: `manimlib/mobject/types/vectorized_mobject.py`)
- Mobject model → Spatial utilities: uses spatial math (evidence: `manimlib/mobject/mobject.py`)
- Text and TeX → Vector graphics: builds vector text
