4. Text-MObjects

TextMobjects or Text Mathematical Object, defined in manim/manimlib/mobject/svg/tex_mobject.py, are another classifications of mobject (the other one that we came across was VMobject aka Vectorized Mathematical Object).

Glossing over simplicity, TextMobjects converts the string to latex formatted text which is then shown on the Scene.
To create a TextMobject:

display_text = TextMobject(“<String>”)

Type out the following code and run it

For most part, TextMobjects have the same properties as VMobjects (i.e move_to, rotation, transform etc). I’ll not be going over them one by one, as it’s just a matter of changing variables, However, I’ve attached a code snippet containing all of the above operations. Play around with it and you’ll find it’s pretty straightforward.

PS: Don’t forget to change the class name before rendering.

If you get an error stating: Exception: Latex error converting to dvi. See log output above or the log file: ... It means there’s some problem with the latex installation. See if all the packages mentioned here are installed

Adding equations

Adding equations is trivial if you know latex. All you have to do is put your latex equation in TextMobject and render.

Adding Colours


One thought on “4. Text-MObjects

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.