Manim, animation engine
Thursday, July 20, 2023
Written by Isaac Castillo
When it comes to creating animations, there are many tools available to developers. However, one of the most popular tools, specifically for mathematical animations, is Manim.
Manim is a free and open-source animation engine for explanatory math videos. It is used to create precise animations programmatically, as opposed to having to animate manually in a GUI.
What is Manim?
Manim is a free and open-source animation based on python. It was created by Grant Sanderson, also known as 3Blue1Brown, a popular math YouTuber.
Manim is a command-line tool, it is also a library that can be imported into python files. This allows users to create animations programmatically.
How does Manim work?
Manim is a python library, meaning that it can be imported into python files. You can use PIP to install Manim.
pip install manim
First Steps
Once you have installed Manim, you can start creating animations. To create an animation, you must create a python file and import the Manim library.
from manim import *
Once you have imported the library, you can start creating animations. In manim all animations are classes that inherit from the Scene class.
from manim import *
class MyAnimation(Scene):
def construct(self):
# Animation code
You can use the different methods of the Scene class to create animations. For example, the play method can be used to play an animation.
from manim import *
class MyAnimation(Scene):
def construct(self):
# Animation code
self.play(Create(Circle()))
Manim has many different classes that can be used to create animations. For example, the Circle class can be used to create a circle.
Text: You can also use the Text class to create text.
MathTex: The MathTex class can be used to create mathematical expressions. Also you can use LaTex to create mathematical expressions.
ImageMobject: The ImageMobject class can be used to create images.
More of Manim
Manim has many more classes that can be used to create animations. You can check out the documentation to learn more about Manim.
You can use transformations to move objects around the screen.
You can also use complex transformations to create more complex animations. For example, you can use the Transform matching text method to transform one text into another.
from manim import *
class MyAnimation(Scene):
def construct(self):
variables = VGroup(MathText("a"), MathText("b"), MathText("c")).arrange_submobjects().shift(UP)
eq1 = MathTex("{{x}}^2", "+" , "{{y}}^2", "=", "{{z}}^2")
eq2 = MathTex("{{a}}^2", "+" , "{{b}}^2", "=", "{{c}}^2")
aq3 = MathTex("{{a}}^2", "=", "{{c}}^2", "-", "{{b}}^2")
self.add(eq1)
self.wait(0.5)
self.play(TransformMatchingTex(Group(eq1, variables), eq2))
self.wait(0.5)
self.play(TransformMatchingTex(eq2, eq3))
self.wait(0.5)
Can obtain the following animation:
For more information about Manim, you can check out the: