videos README

The project's README from github.com/3b1b/videos. As one markdown file: README.md.

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.

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
    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
    git clone [email protected]:3b1b/videos.git
    cd videos
    

Running a video

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

    cd _2023/optics_puzzles
    vi e_field.py
    

    And add the following to the top

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

    manimgl e_field.py
    

    Or

    manimgl e_field.py WavesIn3D
    

Copyright © 2026 3Blue1Brown

videos (3b1b/videos)

Searching Database…

11.4K ·GitHub
这是什么?这是 3Blue1Brown 数学讲解视频背后的源代码:用 manim 动画库编写的 Python 场景,用来生成视频中实际呈现的画面。
这是一个可复用的库,还是只是每个视频各自的脚本合集?它是每个视频各自的场景脚本合集,本身并不是打包好的库;它依赖 3b1b 的个人 manim 分支(3b1b/manim),与社区维护的 ManimCommunity 版本有所不同。
我想自己运行某个视频的场景,该怎么做?从源码安装 manimgl,确保已安装 LaTeX,克隆本仓库,然后运行类似 manimgl (文件) (场景名) 的命令来渲染。
动手之前需要装好什么?你需要从源码构建的 manimgl(已发布的包版本过旧),以及一个可用的 LaTeX 安装,用于渲染数学文本。
老视频的场景能直接跑起来吗?不能。老视频的场景基于更早的 manim 版本编写,不做修改可能无法在当前代码库上运行。
这个仓库对谁真正有用?它面向想研究、复现或摆弄 3Blue1Brown 视频中那些特定动画的人,并不是用于其他项目的通用动画工具包。
我可以把这些代码用于商业用途吗?不可以。虽然 manim 库本身采用 MIT 许可证,但本仓库中的视频场景内容采用知识共享署名-非商业性使用-相同方式共享 4.0(CC BY-NC-SA 4.0)许可,因此不允许将场景代码/内容用于商业用途。
3b1b/manim 和 ManimCommunity 版本有什么区别?本仓库基于 3b1b/manim(Grant Sanderson 的个人分支)运行,而不是社区维护的 ManimCommunity 项目;两个版本的部分功能有所不同。
我可以直接进入场景实时调整,而不用从头重新渲染吗?可以。用 -se 标志运行 manimgl 会让你进入一个交互式 iPython 会话(停在指定行),输入 checkpoint_paste() 可以针对保存的场景状态运行剪贴板里的代码,无需重启就能反复迭代。
使用这套工作流必须用 Sublime Text 吗?不需要,Sublime Text 只是作者个人的编辑器,配置了触发 manim 命令的自定义快捷键;底层的交互式编辑功能在任何文本编辑器里都能复现。
视频可以渲染成文件,而不只是交互式预览吗?可以,checkpoint_paste 命令支持一个 “record” 参数,可以把该代码块运行的动画直接渲染成视频文件。
Creator
3b1b
Size
185 MB
Stars
11.4K
Updated
CommitSep 29
Age
5y
Commits · 90 Days