Manim Lab

A guided path where NAMSSN UI students learn to turn ideas into short Manim clips: from installing the library, to writing scenes, to animating graphs and integrals for talks and events.

How this lab works

Manim is a Python library for turning mathematical ideas into clear, structured animations. You can show how a graph changes as a parameter shifts, how a pattern emerges step by step, or how a concept fits together when each piece appears at the right moment. It helps you present mathematics in a way that feels organised, visual, and easy to follow.

This lab is designed so that a student can go from “I have never animated anything” to “I can confidently generate my own clip.” You move through small modules: setup, first scene, text & mathematics, shapes, graphs, and finally more advanced animations.

🧩 Setup & first scene ✏️ Text & LaTeX maths 🔷 Shapes & number lines 📈 Graphs & animations 🎬 Camera, scenes & polish

Use the modules on the left to learn concepts and copy patterns. Use the editor on the right to build your own scenes, save them, and then run them on your laptop or in a shared notebook.

Manim Lab path
Choose a stage, study the detailed page, then come back here to design and refine your own scenes.

🛠️ Setup & test run

For students who find installation confusing. Step-by-step instructions for Windows, macOS, Linux, plus an online-notebook option and a first test video.

✏️ Text, maths & shapes

Learn the core building blocks: Scene, Text, MathTex, positioning, colours, and simple transitions that already look professional.

Core building blocks Open basics

🎬 Graphs & event clips

Graphs, parameter changes, highlights, and short clips for events like the ODE–Integration Bee, course projects, and outreach videos.

For more confidence Open projects track

Module 0 • Setup & where to run Manim Beginner

Before you write scenes, you need a place to run them. You have two realistic options: your own laptop or an online notebook.

0.1 Choosing a platform (laptop vs. online)
  • Laptop (recommended long-term): install Python and Manim once, then run from your terminal.
  • Online notebook: use a shared Jupyter / Google Colab notebook where Manim is pre-installed.

For a student community, a shared notebook can be a gentle starting point, while those who want full control set up Manim locally using the detailed setup guide.

0.2 Basic local installation idea

The exact commands depend on operating system and Python version, but the rough pattern is:

# 1. Create a virtual environment (optional but recommended)
python -m venv manim-env
# Activate the environment (on Windows)
manim-env\Scripts\activate
# or (on macOS / Linux)
source manim-env/bin/activate

# 2. Install Manim Community Edition
pip install manim

After installation, you should be able to run a command like manim -h in your terminal and see Manim’s help text. The full step-by-step version, including screenshots ideas and troubleshooting, lives in the Manim setup guide.

0.3 Running a scene from the terminal

Suppose you save a file called hello_manim.py containing one Scene class. A typical command to render it looks like:

manim hello_manim.py HelloWorld -pqh
  • HelloWorld is the name of the Scene class.
  • -p opens the video after rendering.
  • -q sets quality (e.g. -ql for low, -qh for high).

The editor on this page helps you write the code. To actually see the animation, you copy it into a .py file or notebook and run Manim there.

Module 1 • Your very first scene Beginner

A Manim project is just Python code. The smallest useful scene has three ingredients: a Scene subclass, a construct method, and one or two animations.

1.1 The basic pattern of a scene
from manim import *

class HelloWorld(Scene):
    def construct(self):
        text = Tex("Hello, NAMSSN UI!")
        self.play(Write(text))
        self.wait(1)

This creates a white screen, writes the text, and holds for one second.

1.2 The Manim “dictionary”

You will see three recurring types of objects:

  • Scenes — containers for animations (subclasses of Scene).
  • Mobjects — “mathematical objects”: text, shapes, graphs, etc.
  • Animations — actions that move or transform mobjects (Write, FadeIn, Transform, …).

Think of it as: define mobjects → choose animations → play them in order. The detailed story, with more labelled examples, is in Basics Module A.

Module 2 • Text & LaTeX mathematics Beginner

Manim can display plain text and LaTeX mathematics. This is the foundation for lecture clips, ODE–Bee intros, and little “fact of the week” animations.

2.1 Plain text vs. LaTeX maths
title = Text("ODE–Integration Bee 2.0")
equation = MathTex(r"\int_0^1 x^n\,dx = \frac{1}{n+1}")
  • Text handles regular words.
  • MathTex (or Tex) handles LaTeX maths strings.
2.2 Arranging text on the screen
title.to_edge(UP)
equation.next_to(title, DOWN, buff=0.5)

Common positioning helpers: to_edge, next_to, shift, scale.

A typical slide-like scene: a title at the top, an equation in the centre, a short remark below. The full explanation with diagrams is under Basics Module C.

Module 3 • Shapes, number lines & highlights Intermediate

Shapes and lines let you illustrate intervals, regions, and “movement” on the real line.

3.1 Basic shapes & colours
square = Square().set_fill(color=BLUE, opacity=0.5)
circle = Circle().set_stroke(color=YELLOW, width=4)
circle.next_to(square, RIGHT)

You can change set_fill, set_stroke, and use colours like BLUE, GREEN, RED, GOLD, …

3.2 Number line & moving point
line = NumberLine(x_range=[-1, 4, 1])
dot = Dot(color=RED).move_to(line.n2p(0))

self.play(Create(line))
self.play(FadeIn(dot))
self.play(dot.animate.move_to(line.n2p(3)))

This simple idea (a moving point on a line) already gives you a nice way to demonstrate limits, sequences, or “time” along a process.

Module 4 • Graphs & parameter changes Intermediate

Graphs are central for calculus and ODEs: you can show how functions behave and how parameters change their shape.

4.1 Plotting a simple function
axes = Axes(
    x_range=[-2, 2, 1],
    y_range=[-1, 4, 1],
    x_length=6,
    y_length=4,
)

graph = axes.plot(lambda x: x**2, color=GREEN)
self.play(Create(axes), Create(graph))
4.2 Showing a parameter changing
k = ValueTracker(1)

def get_graph():
    return axes.plot(lambda x: x**2 + k.get_value(), color=BLUE)

graph = get_graph()
self.play(Create(axes), Create(graph))

for new_val in [0, 2, -1]:
    self.play(
        k.animate.set_value(new_val),
        Transform(graph, get_graph()),
        run_time=1.2
    )

ValueTracker + Transform is a powerful pattern for “live” mathematics. The projects page builds on this to create full clips.

Module 5 • Animation language & polish Advanced

Finally, you can make your scenes feel professional by combining animations, camera moves, and multiple scenes that tell one story.

5.1 A small “story” scene
from manim import *

class IntegralStory(Scene):
    def construct(self):
        title = Text("A friendly integral").to_edge(UP)
        eq1 = MathTex(r"\int_0^1 x^n\,dx").next_to(title, DOWN)
        eq2 = MathTex(r"= \frac{1}{n+1}").next_to(eq1, DOWN)

        self.play(Write(title))
        self.play(Write(eq1))
        self.wait(0.5)
        self.play(Transform(eq1, eq2))
        self.wait(1)
5.2 Camera frame & zoom effect (idea)

Once you are comfortable, you can use self.camera.frame to zoom into part of the screen, or move attention across a long derivation. This is more advanced and can be explored from the Manim documentation and shared example files linked from NAMSSN resources.

For NAMSSN UI, it is enough in the first year if students can produce clear, static scenes with clean animations. Camera tricks can come later.

When you are comfortable with all modules above, you are ready to script short clips for the ODE–Integration Bee, course projects, and outreach videos. At that stage, use the projects page and official Manim documentation as a playground for your own ideas.

Manim code editor

Use this box to draft Manim scenes. The code is regular Python, so you can copy it into a .py file or a notebook and run it with Manim on your computer or in an online environment.

Load a prepared example:
Quick patterns
Insert:
Editor
Write code as if you were in a Python file. The lab can save your current draft in this browser and lets you copy it easily.
Your current draft is saved locally on this device. You can copy and paste it into a file like hello_namssn.py and run Manim from your terminal or notebook.
Saved locally as “Manim lab draft”
What to do after writing code

This page does not render video (that would require a full Python environment), but you can run your scene in two steps:

  1. Step 1: Copy the code into my_scene.py on your laptop or into a Manim-enabled notebook.
  2. Step 2: Run a command like manim my_scene.py MyScene -pql in your terminal.

A Manim-ready notebook or shared environment can be linked here so that students without a local installation can still practise and contribute.