
How to Animate Text in Manim
Table of Contents
Text is the first thing most people animate in Manim. A title that writes itself on screen, a label that fades in, an equation that morphs into the next step. This guide covers the common cases, with code you can paste and run.
If you have never run Manim before, read How Manim Works first. Everything below assumes Manim Community Edition is installed and you can render a scene.
The simplest text animation
Every Manim scene is a class with a construct method. To put text on screen and write it out:
from manim import *
class HelloText(Scene):
def construct(self):
title = Text("Hello, Manim!")
self.play(Write(title))
self.wait()
Text creates the object. Write is the animation that draws it stroke by stroke. self.wait() holds the last frame so the video does not cut off instantly.
Render it with:
manim -pql scene.py HelloText
Fade text in and out
Write looks like handwriting. For a cleaner, faster entrance, use FadeIn, and FadeOut to remove it:
class FadeText(Scene):
def construct(self):
label = Text("Fading in")
self.play(FadeIn(label))
self.wait()
self.play(FadeOut(label))
Transform one text into another
This is the animation you see in most math videos: one line of text smoothly becomes the next. Use Transform:
class TransformText(Scene):
def construct(self):
first = Text("Step 1")
second = Text("Step 2")
self.play(Write(first))
self.wait()
self.play(Transform(first, second))
self.wait()
Note you keep playing animations on first. Transform morphs the original object into the shape of the target.
Move, scale, and position text
Text is a regular Manim object, so you can shift it, scale it, and animate those changes:
class MoveText(Scene):
def construct(self):
text = Text("Move me")
self.play(Write(text))
self.play(text.animate.shift(UP * 2))
self.play(text.animate.scale(1.5))
self.play(text.animate.to_edge(LEFT))
self.wait()
The .animate syntax animates any change you would normally apply directly. shift, scale, to_edge, and move_to are the ones you will use most.
Color and style
Set color and weight when you create the text:
class StyledText(Scene):
def construct(self):
text = Text("Important", color=YELLOW, weight=BOLD)
self.play(Write(text))
self.wait()
To recolor part of a string, use t2c (text to color):
text = Text("Red and blue", t2c={"Red": RED, "blue": BLUE})
Animating math, not plain text
For equations, use MathTex instead of Text. It takes LaTeX and renders proper math:
class MathText(Scene):
def construct(self):
eq = MathTex(r"e^{i\pi} + 1 = 0")
self.play(Write(eq))
self.wait()
MathTex needs a LaTeX distribution installed. That is the most common reason this snippet fails on a fresh machine.
The catch
None of this code is hard to read. The hard part is everything around it: installing Manim and a working LaTeX setup, remembering the exact name of every animation and method, fixing the cryptic error when a render fails, and iterating until the timing feels right. A ten second animation can be an afternoon of trial and error.
That is the problem Animo solves. You describe the animation in plain English, and Animo writes the Manim code, renders it, and shows you the video. No Python setup, no LaTeX install, no memorizing the API. When you want to tweak something, you say what you want and it edits the code for you.
The Manim above is worth learning if you want full control. If you just want the animation, try Animo and skip the setup.