## File: README.md

[](https://pypi.org/project/manimgl/)
[](http://choosealicense.com/licenses/mit/)
[](https://www.reddit.com/r/manim/)
[](https://discord.com/invite/bYCyhM9Kz2)
[](https://3b1b.github.io/manim/)

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](https://www.3blue1brown.com/) for the purpose of animating those videos, with video-specific code available [here](https://github.com/3b1b/videos).  In 2020 a group of developers forked it into what is now the [community edition](https://github.com/ManimCommunity/manim/), 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](https://docs.manim.community/en/stable/faq/installation.html#different-versions) for more details.

## Installation
> [!Warning]
> **WARNING:** These instructions are for ManimGL _only_. Trying to use these instructions to install [Manim Community/manim](https://github.com/ManimCommunity/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 is `manimgl` instead of `manim` or `manimlib`. Please use `pip install manimgl` to install the version in this repository.

Manim runs on Python 3.10 or higher.

System requirements are [FFmpeg](https://ffmpeg.org/), [OpenGL](https://www.opengl.org/) and [LaTeX](https://www.latex-project.org) (optional, if you want to use LaTeX).
For Linux, [Pango](https://pango.org) along with its development headers are required. See instruction [here](https://github.com/ManimCommunity/ManimPango#building).


### Directly

```sh
# Install manimgl
pip install manimgl

# Try it out
manimgl
```

For more options, take a look at the [Using manim](#using-manim) sections further below.

If you want to hack on manimlib itself, clone this repository and in that directory execute:

```sh
# Install manimgl
pip install -e .

# Try it out
manimgl example_scenes.py OpeningManimExample
# or
manim-render example_scenes.py OpeningManimExample
```

### Linux (Ubuntu/Debian)

1. Install system dependencies.

```sh
sudo apt update

sudo apt install ffmpeg
sudo apt install python3-pip
sudo apt install libpango1.0-dev
```

2. Install a lightweight LaTeX distribution (optional, for LaTeX rendering).

```sh
sudo apt install texlive-science texlive-fonts-extra texlive-latex-extra
```

This lightweight setup is significantly smaller than installing `texlive-full`
while still supporting most Manim projects.

3. Clone and install ManimGL.

```sh
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.

```sh
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:

```sh
sudo apt install python3.12-venv
```



### Directly (Windows)

1. [Install FFmpeg](https://www.wikihow.com/Install-FFmpeg-on-Windows).
2. Install a LaTeX distribution. [MiKTeX](https://miktex.org/download) is recommended.
3. 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

1. Install FFmpeg, LaTeX in terminal using homebrew.
    ```sh
    brew 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](https://formulae.brew.sh/cask/basictex) and then gradually add
      > only the LaTeX packages you actually need. A list of packages sufficient to run examples can 
      > be found [here](https://github.com/3b1b/manim/issues/2133#issuecomment-2414547866).
      > For an overview of the MacTeX installer bundles, see https://www.tug.org/mactex/.
    

2. If you are using an ARM-based processor, install Cairo. 
    ```sh
    arch -arm64 brew install pkg-config cairo
    ```
   
3. Install latest version of manim using these command.
    ```sh
    git clone https://github.com/3b1b/manim.git
    cd manim
    pip install -e .
    manimgl example_scenes.py OpeningManimExample
    ```
    If the last command is not found, make sure the directory pip installed `manimgl` into is on your `PATH`.

## Anaconda Install

1. Install LaTeX as above.
2. Create a conda environment using `conda create -n manim python=3.10`.
3. Activate the environment using `conda activate manim`.
4. Install manimgl using `pip install -e .`.


## Using manim
Try running the following:
```sh
manimgl example_scenes.py OpeningManimExample
```
This should pop up a window playing a simple scene.

Look through the [example scenes](https://3b1b.github.io/manim/getting_started/example_scenes.html) to see examples of the library's syntax, animation types and object types. In the [3b1b/videos](https://github.com/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](https://www.youtube.com/watch?v=rbu7Zu5X1zI) for example.

When running in the CLI, some useful flags include:
* `-w` to write the scene to a file
* `-o` to write the scene to a file and open the result
* `-s` to skip to the end and just show the final frame.
    * `-so` will save the final frame to an image and show it
* `-n <number>` to skip ahead to the `n`'th animation of a scene.
* `-f` to 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](https://github.com/3b1b/videos/blob/master/custom_config.yml) 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](https://3b1b.github.io/manim/). And there is also a Chinese version maintained by [**@manim-kindergarten**](https://manim.org.cn): [docs.manim.org.cn](https://docs.manim.org.cn/) (in Chinese).

[manim-kindergarten](https://github.com/manim-kindergarten/) wrote and collected some useful extra classes and some codes of videos in [manim_sandbox repo](https://github.com/manim-kindergarten/manim_sandbox).


## Contributing
Is always welcome.  As mentioned above, the [community edition](https://github.com/ManimCommunity/manim) 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 to 
`the 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 in
`3b1b/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 consider
`ManimCommunity/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_FPS

Buffs
-----

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_BUFF

Coordinates
-----------

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 * RIGHT

Mathematical 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 from 
`elteoremadebeethoven <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