3b1b setup guide
3Blue1Brown Setup Guide
This is an AI generated guide I wrote for myself that I put up on my blog for safekeeps.
This tutorial covers how to replicate Grant Sanderson's interactive math animation environment (as seen at the start of this video) using the ManimGL engine and the uv package manager.
1. Environment Initialization
Grant uses ManimGL (the OpenGL version), which allows for real-time interaction. Use uv to manage the specific legacy dependencies required.
# Create project and pin stable Python version
mkdir math-animations && cd math-animations
uv init
uv python pin 3.12
# Install ManimGL and legacy compatibility tools
uv add manimgl "setuptools<70.0.0"
2. Fixing LaTeX Dependencies
Manim renders math via LaTeX. If you see .sty file errors, you are likely using a minimal LaTeX install (like BasicTeX) and need to add specific packages via your terminal:
sudo tlmgr install calligra relsize standalone preview doublestroke fundus-calligra
3. The Interactive Script
Create start.py. This script uses self.embed() to open the interactive window and an IPython terminal simultaneously.
from manimlib import *
class InteractiveScene(Scene):
def construct(self):
plane = ComplexPlane()
self.add(plane)
# Input Dot (Yellow)
dot = Dot(color=YELLOW).shift(RIGHT)
self.add(dot)
# Output Dot (Pink) following w = z^2
out_dot = Dot(color=PINK)
out_dot.add_updater(lambda m: m.move_to(
plane.c2p(plane.p2c(dot.get_center())**2)
))
# Visual trail
trace = TracedPath(out_dot.get_center, stroke_color=PINK)
self.add(out_dot, trace)
self.embed()
4. Running the Setup
Execute the following command:
uv run manimgl start.py InteractiveScene
5. Interaction Controls
Once the window opens:
- Mouse: Click and drag the yellow dot to see the pink dot react.
- Terminal: Type
dot.set_color(BLUE)in the IPython prompt to see the change live. - Camera: Right-click and drag to rotate into 3D; use
Z+ scroll to zoom.