File: README.md
Manim is an engine for precise programmatic animations, designed for creating explanatory math videos.
Note, there are two versions of manim. This repository began as a personal project by the author of 3Blue1Brown for the purpose of animating those videos, with video-specific code available here. In 2020 a group of developers forked it into what is now the community edition, with a goal of being more stable, better tested, quicker to respond to community contributions, and all around friendlier to get started with. See this page for more details.
Installation
[!Warning]
WARNING: These instructions are for ManimGL only. Trying to use these instructions to install Manim Community/manim or instructions there to install this version will cause problems. You should first decide which version you wish to install, then only follow the instructions for your desired version.
[!Note]
Note: To install manim directly through pip, please pay attention to the name of the installed package. This repository is ManimGL of 3b1b. The package name ismanimglinstead ofmanimormanimlib. Please usepip install manimglto install the version in this repository.
Manim runs on Python 3.10 or higher.
System requirements are FFmpeg, OpenGL and LaTeX (optional, if you want to use LaTeX).
For Linux, Pango along with its development headers are required. See instruction here.
Directly
# Install manimgl
pip install manimgl
# Try it out
manimglFor more options, take a look at the Using manim sections further below.
If you want to hack on manimlib itself, clone this repository and in that directory execute:
# Install manimgl
pip install -e .
# Try it out
manimgl example_scenes.py OpeningManimExample
# or
manim-render example_scenes.py OpeningManimExampleLinux (Ubuntu/Debian)
- Install system dependencies.
sudo apt update
sudo apt install ffmpeg
sudo apt install python3-pip
sudo apt install libpango1.0-dev- Install a lightweight LaTeX distribution (optional, for LaTeX rendering).
sudo apt install texlive-science texlive-fonts-extra texlive-latex-extraThis lightweight setup is significantly smaller than installing texlive-full
while still supporting most Manim projects.
- Clone and install ManimGL.
git clone https://github.com/3b1b/manim.git
cd manim
python3 -m pip install -e .
manimgl example_scenes.py OpeningManimExampleπ‘ Optional: Using a virtual environment (venv)
It is recommended to use a virtual environment to avoid conflicts with system packages.
sudo apt install python3-venv
python3 -m venv venv
source venv/bin/activate
python3 -m pip install -e .If python3-venv is unavailable on your system, try installing the version-specific package instead:
sudo apt install python3.12-venvDirectly (Windows)
- Install FFmpeg.
- Install a LaTeX distribution. MiKTeX is recommended.
- Install the remaining Python packages.sh
git clone https://github.com/3b1b/manim.git cd manim pip install -e . manimgl example_scenes.py OpeningManimExample
Mac OSX
Install FFmpeg, LaTeX in terminal using homebrew.
shbrew install ffmpeg mactexπ‘ An alternative to heavyweight MacTeX bundle.
To avoid installing the full MacTeX bundle, which is ~6GB, you can alternatively install the
lightweight BasicTeX and then gradually add
only the LaTeX packages you actually need. A list of packages sufficient to run examples can
be found here.
For an overview of the MacTeX installer bundles, see https://www.tug.org/mactex/.If you are using an ARM-based processor, install Cairo.
sharch -arm64 brew install pkg-config cairoInstall latest version of manim using these command.
shgit clone https://github.com/3b1b/manim.git cd manim pip install -e . manimgl example_scenes.py OpeningManimExampleIf the last command is not found, make sure the directory pip installed
manimglinto is on yourPATH.
Anaconda Install
- Install LaTeX as above.
- Create a conda environment using
conda create -n manim python=3.10. - Activate the environment using
conda activate manim. - Install manimgl using
pip install -e ..
Using manim
Try running the following:
manimgl example_scenes.py OpeningManimExampleThis should pop up a window playing a simple scene.
Look through the example scenes to see examples of the library's syntax, animation types and object types. In the 3b1b/videos repo, you can see all the code for 3blue1brown videos, though code from older videos may not be compatible with the most recent version of manim. The readme of that repo also outlines some details for how to set up a more interactive workflow, as shown in this manim demo video for example.
When running in the CLI, some useful flags include:
-wto write the scene to a file-oto write the scene to a file and open the result-sto skip to the end and just show the final frame.-sowill save the final frame to an image and show it
-n <number>to skip ahead to then'th animation of a scene.-fto make the playback window fullscreen
Take a look at custom_config.yml for further configuration. To add your customization, you can either edit this file, or add another file by the same name "custom_config.yml" to whatever directory you are running manim from. For example this is the one for 3blue1brown videos. There you can specify where videos should be output to, where manim should look for image files and sounds you want to read in, and other defaults regarding style and video quality.
Documentation
Documentation is in progress at 3b1b.github.io/manim. And there is also a Chinese version maintained by @manim-kindergarten: docs.manim.org.cn (in Chinese).
manim-kindergarten wrote and collected some useful extra classes and some codes of videos in manim_sandbox repo.
Contributing
Is always welcome. As mentioned above, the community edition has the most active ecosystem for contributions, with testing and continuous integration, but pull requests are welcome here too. Please explain the motivation for a given change and examples of its effect.
License
This project falls under the MIT license.
File: docs/source/development/about.rst
About
About Manim
Manim is an animation engine for explanatory math videos.
You can use it to make math videos (or other fields) like 3Blue1Brown.
There are mainly two versions here:
3b1b/manim <https://github.com/3b1b/manim>_ : Maintained by Grant Sanderson of 3Blue1Brown.
Using OpenGL and its GLSL language to use GPU for rendering. It has higher efficiency,
faster rendering speed, and supports real-time rendering and interaction.
ManimCommunity/manim <https://github.com/ManimCommunity/manim>_ : Maintained by Manim Community Dev Team.
Using multiple backend rendering. There is better documentation and
a more open contribution community.
About this documentation
This documentation is based on the version in 3b1b/manim <https://github.com/3b1b/manim>.
Created by TonyCrane <https://github.com/TonyCrane> ("ιΉ€ηΏδΈι" in Chinese) and in production.
Among them, the manim_example_ext extension for Sphinx refers tothe documentation of ManimCommunity <https://docs.manim.community/>_.
If you want to contribute to manim or this document, please see: :doc:contributing
File: docs/source/development/contributing.rst
Contributing
Accept any contribution you make :)
Choose the right Manim project first
This repository is the ManimGL version used by 3Blue1Brown. It focuses on
OpenGL rendering, interactive workflows, and the needs of the videos in3b1b/videos <https://github.com/3b1b/videos>_. Pull requests are welcome here,
but reviews can take some time.
For broad community features, packaging changes, or beginner-oriented
documentation, also considerManimCommunity/manim <https://github.com/ManimCommunity/manim>_, which has a
larger contributor workflow and more active community review. If your change is
specific to ManimGL, keep it in this repository.
- Contribute to the manim source code:
Please fork to your own repository and make changes, submit a pull request, and fill in
the motivation for the change following the instructions in the template. We will check
your pull request in detail (this usually takes a while, please be patient)
- Contribute to the documentation:
Also submit a pull request and write down the main changes.
- If you find a bug in the code:
Please open an issue and fill in the found problem and your environment according
to the template. (But please note that if you think this problem is just a problem
of yourself, rather than a problem of source code, it is recommended that you ask a
question in the Q&A category <https://github.com/3b1b/manim/discussions/categories/q-a>_
of the discussion page)
- You are welcome to share the content you made with manim:
Post it in the show and tell category <https://github.com/3b1b/manim/discussions/categories/show-and-tell>_
of the discussion page.
- You are also welcome to share some of your suggestions and ideas:
Post them in the ideas category <https://github.com/3b1b/manim/discussions/categories/ideas>_
of the discussion page.
How to build this documentation
- Clone the 3b1b/manim repository
.. code-block:: sh
git clone https://github.com/3b1b/manim.git
# or your own repo
# git clone https://github.com/<your user name>/manim.git
cd manim- Install python package dependencies
.. code-block:: sh
pip install -r docs/requirements.txt- Go to the
docs/folder and build
.. code-block:: sh
cd docs/
make html- The output document is located in
docs/build/html/
File: docs/source/documentation/constants.rst
constants
The constants.py in the manimlib folder defines the constants
needed when running manim. Some constants are not explained here because
they are only used inside manim.
Frame and pixel shape
These values will be determined based on the camera configuration in default_config.yml or custom_config.yml
.. code-block:: python
ASPECT_RATIO
FRAME_HEIGHT
FRAME_WIDTH
FRAME_Y_RADIUS
FRAME_X_RADIUS
DEFAULT_PIXEL_HEIGHT
DEFAULT_PIXEL_WIDTH
DEFAULT_FPSBuffs
These values will be determined based on the size configuration in default_config.yml or custom_config.yml
.. code-block:: python
SMALL_BUFF
MED_SMALL_BUFF
MED_LARGE_BUFF
LARGE_BUFF
DEFAULT_MOBJECT_TO_EDGE_BUFF
DEFAULT_MOBJECT_TO_MOBJECT_BUFFCoordinates
manim uses three-dimensional coordinates and uses the type of ndarray
.. code-block:: python
ORIGIN = np.array((0., 0., 0.))
UP = np.array((0., 1., 0.))
DOWN = np.array((0., -1., 0.))
RIGHT = np.array((1., 0., 0.))
LEFT = np.array((-1., 0., 0.))
IN = np.array((0., 0., -1.))
OUT = np.array((0., 0., 1.))
X_AXIS = np.array((1., 0., 0.))
Y_AXIS = np.array((0., 1., 0.))
Z_AXIS = np.array((0., 0., 1.))
# Useful abbreviations for diagonals
UL = UP + LEFT
UR = UP + RIGHT
DL = DOWN + LEFT
DR = DOWN + RIGHT
TOP = FRAME_Y_RADIUS * UP
BOTTOM = FRAME_Y_RADIUS * DOWN
LEFT_SIDE = FRAME_X_RADIUS * LEFT
RIGHT_SIDE = FRAME_X_RADIUS * RIGHTMathematical constant
.. code-block:: python
PI = np.pi
TAU = 2 * PI
DEG = TAU / 360
Text
.. code-block:: python
NORMAL = "NORMAL"
ITALIC = "ITALIC"
OBLIQUE = "OBLIQUE"
BOLD = "BOLD"Colours
Color constants are determined based on the color configuration in default_config.yml or custom_config.yml
Here are the preview of default colours. (Modified fromelteoremadebeethoven <https://elteoremadebeethoven.github.io/manim_3feb_docs.github.io/html/_static/colors/colors.html>_)
.. raw:: html
<h3>BLUE</h3>
BLUE_E
BLUE_D
BLUE_C
BLUE_B
BLUE_A
<h3>TEAL</h3>
TEAL_E
TEAL_D
TEAL_C
TEAL_B
TEAL_A
<h3>GREEN</h3>
GREEN_E
GREEN_D
GREEN_C
GREEN_B
GREEN_A
<h3>YELLOW</h3>
YELLOW_E
YELLOW_D
YELLOW_C
YELLOW_B
YELLOW_A
<h3>GOLD</h3>
GOLD_E
GOLD_D
GOLD_C
GOLD_B
GOLD_A
<h3>RED</h3>
RED_E
RED_D
RED_C
RED_B
RED_A
<h3>MAROON</h3>
MAROON_E
MAROON_D
MAROON_C
MAROON_B
MAROON_A
<h3>PURPLE</h3>
PURPLE_E
PURPLE_D
PURPLE_C
PURPLE_B
PURPLE_A
<h3>GREY</h3>
GREY_E
GREY_D
GREY_C
GREY_B
GREY_A
<h3>Others</h3>
WHITE
BLACK
GREY_BROWN
DARK_BROWN
LIGHT_BROWN
PINK
LIGHT_PINK
GREEN_SCREEN
ORANGE