Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

videos

> 编程语言
Open source

Code for the manim-generated scenes used in 3blue1brown videos

11.0K stars0 likes0 views
WebsiteGitHub

About

Code for the manim-generated scenes used in 3blue1brown videos

This project contains the code used to generate the explanatory math videos found on 3Blue1Brown.

This almost entirely consists of scenes generated using the library Manim. See also the community maintained version at ManimCommunity.

Older projects may have code dependent on older versions of manim, and so may not run out of the box here.

Note, while the library Manim itself is open source software and under the MIT license, the contents of this repository are available under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

Workflow

I made this video to show more of how I use manim. Note that I'm using 3b1b/manim, not the community edition, some functionality may differ between the two. Aside from installing manim itself, replicating the workflow involves some custom plugins with Sublime, the text editor I use.

If you use another text editor, the same functionality can be mimicked. The key is to make use of two facts.

  • Running manimgl (file name) (scene name) -se (line_number) will drop you into an interactive mode at that line of the file, like a debugger, with an iPython terminal that can be used to interact with the scene.

  • Within that interactive mode, if you enter "checkpoint_paste()" to the terminal, it will run whatever bit of code is copied to the clipboard. Moreover, if that copied code begins with a comment, the first time it sees that comment it will save the state of the scene at that point, and for all future calls on code beginning with the same comment, it will first revert to that state of the scene before running the code.

    • The argument "skip" of checkpoint_paste will mean it runs the code without animating, as if all run times set to 0.
    • The argument "record" of checkpoint_paste will cause whatever animations are run with that copied code to be rendered to file.

For my own workflow, I set up some keyboard shortcuts to kick off each of these commands. For those who want to try it out themselves, here's what's involved.

Sublime-specific instructions

Install Terminus (via package control). This is a terminal run within sublime, and it lets us write some plugins that take the state in sublime, like where your cursor is, what's highlighted, etc., and use that to run a desired command line instruction.

Take the files in the "sublime_custom_commands" sub-directory of this repo, and copy them into the Packages/User/ directory of your Sublime Application. This should be a directory with a path that looks something like /wherever/your/sublime/lives/Packages/User/

Add some keybindings to reference these commands. Here's what I have inside my key_bindings file, you can find your own under the menu Sublime Text -> Settings -> Keybindings

    { "keys": ["shift+super+r"], "command": "manim_run_scene" },
    { "keys": ["super+r"], "command": "manim_checkpoint_paste" },
    { "keys": ["super+alt+r"], "command": "manim_recorded_checkpoint_paste" },
    { "keys": ["super+ctrl+r"], "command": "manim_skipped_checkpoint_paste" },
    { "keys": ["super+e"], "command": "manim_exit" },
    { "keys": ["super+option+/"], "command": "comment_fold"},

For example, I bind the "command + shift + R" to a custom "manim_run_scene" command. If the cursor is inside a line of a scene, this will drop you into the interactive mode at that point of the scene. If the cursor is on the line defining the scene, it will copy to the clipboard the command needed to render that full scene to file.

I bind "command + R" to a "manim_checkpoint_paste" command, which will copy whatever bit of code is highlighted, and run "checkpoint_paste()" in the interactive terminal.

Of course, you could set these to whatever keyboard shortcuts you prefer.

Installation

  1. Install manimgl from source since the latest version published is not up to date.
  2. Ensure Latex is installed, for example on Ubuntu
    bash
    sudo apt install texlive
    sudo apt install texlive-latex-extra
    sudo apt install texlive-fonts-extra
    sudo apt install texlive-science
  3. Clone this repository to run the video samples
    bash
    git clone [email protected]:3b1b/videos.git
    cd videos

Running a video

  1. Setup includes (if you don't want to modify your path)

    bash
    cd _2023/optics_puzzles
    vi e_field.py

    And add the following to the top

    python
    import sys
    sys.path.append(".")
    sys.path.append("..")
    sys.path.append("../..")
  2. Run an example

    bash
    manimgl e_field.py

    Or

    bash
    manimgl e_field.py WavesIn3D

Copyright © 2026 3Blue1Brown

Issues· 48 open

View all issuesOpen on GitHub
  • #137

    Module error

    Updated Jul 6, 2026
  • #129

    N

    Updated Mar 20, 2026
  • #126

    Visual: metro Coach aur khaali VO: “Coach khaali ho raha tha… par uski awaaz ab bhi paas thi.”

    Updated Jan 7, 2026
  • #121

    Dropbox is not available error from manimgl

    Updated Nov 23, 2025
  • #123

    Personal blog of Harshit Pathak

    Updated Nov 7, 2025
  • #122

    [question] Running fourier_montage_scenes.py or other scripts

    Updated Oct 20, 2025
  • #120

    Normal text not appearing in LaTeX font

    Updated Aug 27, 2025
  • #112

    Some experience of how to start

    Updated Aug 13, 2025
  • #107

    xml.etree.ElementTree.ParseError: syntax error: line 1, column 0 (and temporary solution)

    Updated Jun 8, 2025
  • #117

    VectorField not properly instantiated?

    Updated May 22, 2025

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言