Code for the manim-generated scenes used in 3blue1brown videos
Find a file
2025-05-05 11:17:53 -05:00
_2015 Replace numbers_with_elongated_ticks -> big_tick_numbers 2024-02-22 11:48:08 -08:00
_2016 Merge pull request #60 from dziadzisko/bugFixChapter8p2 2024-11-09 16:56:19 -06:00
_2017 Fixed a minor syntax issue 2024-10-07 21:59:08 +05:30
_2018 Misc naming updates 2024-03-16 11:10:09 -03:00
_2019 Replace numbers_with_elongated_ticks -> big_tick_numbers 2024-02-22 11:48:08 -08:00
_2020 Replace numbers_with_elongated_ticks -> big_tick_numbers 2024-02-22 11:48:08 -08:00
_2021 Animations for a lecture on eigenvalues in matrix exponentiation 2024-11-15 09:08:25 -08:00
_2022 Merge pull request #52 from woctezuma/create-block-matrix 2024-11-09 16:57:01 -06:00
_2023 Remove unnecessary parameter 2025-04-27 07:16:39 -05:00
_2024 Remove blank line 2025-04-27 07:16:23 -05:00
_2025 Separate blocks and grover into distinct folders 2025-05-05 11:17:53 -05:00
custom Bug fix on banner image 2025-03-19 16:47:58 -05:00
once_useful_constructs DEFAULT_MOBJECT_TO_MOBJECT_BUFFER -> DEFAULT_MOBJECT_TO_MOBJECT_BUFF 2024-12-23 16:01:54 -06:00
outside_videos Final inscribed rectangle animations 2024-12-26 09:53:52 -07:00
sublime_custom_commands Add references to my sublime workflow 2024-10-09 12:54:50 -05:00
.gitignore Ignore pyrightconfig.json 2023-11-06 12:39:32 -05:00
custom_config.yml Update custom_config to match new format 2024-12-23 16:01:03 -06:00
LICENSE.txt Create LICENSE.txt 2024-10-15 23:00:25 +02:00
manim_imports_ext.py Rename MTex -> Tex, and Tex -> OldTex 2022-12-27 16:31:01 -08:00
README.md Update README.md to reflect CC BY-NC-SA 4.0 2024-10-15 23:11:12 +02:00
stage_scenes.py Scenes for holomorphic dynamics video 2021-10-11 06:21:04 -07:00

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.

Copyright © 2024 3Blue1Brown