28000 stars! A great tool for making mathematical Animation: manim


[introduction]: manim is an animation engine, mainly used to make explanatory videos related to mathematics. It uses programming to make precise animations.

28000 stars! A great tool for making mathematical Animation: manim

There are videos on this website:

Project address



Manim requires Python 3.6 and above. You can install through PIP:

pip3 install manimlib

The system requires Cairo, ffmpeg, Sox (optional, if you want to be prompted when running), latex (optional, if you want to use latex). You can use the system through manim command:

manim my_project.py MyScene

If you want to modify manimlib yourself, clone the library and execute the following command in the directory where the library is located:

#Install Python requirements
python3 -m pip install -r requirements.txt
python3 ./manim.py example_scenes.py SquareToCircle -pl

Installation under Windows

  1. To install ffmpeg, visit the following link for details:https://www.wikihow.com/Insta…
  2. Install Cairo. For most users, pycairo {1.18.0} cp37 {cp37m} win32.whl works well. Visit the following link for details:https://www.lfd.uci.edu/\~gohlke/pythonlibs/#pycairo
  3. Install a latex distribution. Miktex is recommended. Visit the following link for details:https://miktex.org/download
  4. Install Sox. Visit the following links for details:https://sourceforge.net/proje…
  5. Install the remaining Python packages.

    git clone https://github.com/3b1b/manim.git   
    cd manim    
    pip3 install -r requirements.txt    
    python3 manim.py example_scenes.py SquareToCircle -pl

Install Anaconda

  1. Install Sox and latex above
  2. Create the CONDA environment with the following command:
conda env create -f environment.yml
  1. Windows only needs to be installed through the following command:
pyreadline via pip install pyreadline

Install virtualenv and virtualenvwrapper

git clone https://github.com/3b1b/manim.git
mkvirtualenv -a manim -r requirements.txt manim
python3 -m manim example_scenes.py SquareToCircle -p

Using docker to install

It’s a bit difficult to install all the dependencies. To solve this problem, the docker hub provides the dokcer file and compose file of this library, as well as the preset image. The docker file describes how to build a manim image, and the compose file describes how to run the image.

The image access of docker is as follows:https://hub.docker.com/r/eule…

The pre generated container image contains the manim library_ OUTPUT\_ PATH_ Is the path for the container to find the scene file_ OUTPUT\_ PATH_ Is the multimedia file output path.

You have to set environment variables for both paths.

  1. Install docker. visit:https://docs.docker.com/
  2. Install docker compose. visit:https://docs.docker.com/compo…
  3. Render an animation
INPUT_PATH=/path/to/dir/containing/source/code \OUTPUT_PATH=/path/to/output/ \docker-compose run manim example_scenes.py SquareToCircle -l

The above command requires root permission.

28000 stars! A great tool for making mathematical Animation: manim

Using manim

Try the following command:

python3 -m manim example_scenes.py SquareToCircle -pl

The – P option in the command indicates preview. When rendering is finished, the video will open automatically- The purpose of the L option is to reduce the image quality and render quickly. Here are some useful options:

  • -S jumps to the end, showing only the last frame
  • -N < number > jump to the front of the nth animation in a scene
  • -F display files in Finder (in OSX)

Set media\_ Dir environment variable to confirm the writing position of image and animation files.

Can browse   old\_ projects   Directory to view past video codes. This part of the code developers did not consider the compatibility with these old projects. When running an old project, to make sure it works, you have to go back to the place where the project was submitted.

When developing a scene, if you want to see what the final result looks like, you can use the – SP option instead of waiting for all the animations to complete. In addition, you can skip some animations with the – N option.

Open source outpostShare popular, interesting and practical open source projects everyday. Participate in the maintenance of 100000 + star open source technology resource library, including python, Java, C / C + +, go, JS, CSS, node.js, PHP,. Net, etc.

Recommended Today

The road of high salary, a more complete summary of MySQL high performance optimization in history

preface MySQL for many linux practitioners, is a very difficult problem, most of the cases are because of the database problems and processing ideas are not clear. Before the optimization of MySQL, we must understand the query process of MySQL. In fact, a lot of query optimization work is to follow some principles so that […]