Manim: Mathematical Animation Engine

SheTechSavant
2 min readMar 19, 2021

--

Have you watched videos of YouTube channel — 3Blue1Brown?

It teaches mathematics through visualisations and uses Manim animation engine for its animations.

Manim is an animation engine used to create explanatory mathematical videos programmatically. It is an open source python library which can used by anyone to create interesting mathematical animations. So Lets get started and create our own animations.

First of all, to install manim you can refer to docs — https://docs.manim.community/en/stable/installation.html

Note: You need to have python installed in order to use Manim.

We will first learn to animate a circle, to produce our first scene, create a new python file and import Manim using the following line:

from manim import *

Now under the ‘construct’ method of ‘Shapes’ class, we will animate our shapes. Write the following code to create a circle:

To run this file, use the command:

$python3 -m manim shapes.py shapes -pl

The above command will create and open the animation in your system’s media player.

In a similar manner we can create various other shapes like square, rectangle, triangle etc.

Let us now transform circle to square.

And the output looks like this:

We can create many more interesting animations using Manim. These animations look cool on various presentations and make it easy to explain concepts.

Stay tuned for more interesting programming stuff :)

--

--

SheTechSavant
SheTechSavant

Written by SheTechSavant

Software Engineer at a leading financial firm | Crafting code with passion and precision | Championing a community of empowered women

No responses yet