Coming from Manim CE¶
manimgx has the API of Manim Community Edition: its scenes,
mobjects, animations and constants, with the same names and parameters. Most Manim CE code
runs on manimgx after you replace manim with manimgx. But manimgx decides how that
code behaves. This page shows where it is different.
Imports and rendering¶
- Every name is in the package:
import manimgx as m, thenm.Circle, orfrom manimgx import *. Manim CE's modules are not there: writefrom manimgx import polylabel, notfrom manimgx.utils.polylabel import polylabel. - Render with
manimgx render scene.py MyScene. Manim CE's quality flags (-ql,-qh, …) become-r(--resolution) and--fps.manimgx checkreports a scene's layout problems without a video. See Rendering and sharing. - You don't install LaTeX.
TexandMathTexconvert their LaTeX to Typst, which the engine sets. LaTeX packages and\defdon't convert.
The frame¶
A wide video's frame is the same as in Manim CE: 8 units high, about 14.2 wide. A tall
video's frame (9:16) is 8 units wide and about 14.2 high, where Manim CE's is 4.5 wide:
in manimgx, the frame's short side is 8 units, unless you set config.frame_height. So
a scene made for a wide video fits a tall one if it stays in the middle 8 × 8 square.
Time and animations¶
- Each frame shows the scene at its own exact time, in plays and in waits, at every frame rate. The video ends with a last frame at the scene's end.
- Updaters get the exact time since their last call. They keep running while an
animation plays their mobject. Updaters that take
dtrun on a clock of their own, so a simulation gives the same result at every frame rate. .animateapplies its calls when its animation starts. In aSuccession, each.animatestarts where the one before it ended.- A rotation turns the mobject as one rigid piece, about one point.
- Animations of one mobject that start at the same time combine: their movements add.
See Animations and Updaters.
One name for each thing¶
For most things that Manim CE names twice, manimgx keeps one name. The other still works, but your editor marks it deprecated and names the one to use:
MovingCameraSceneisScene: every scene's camera moves.ApplyMethod(square.scale, 2),ScaleInPlace(square, 2)andFadeToColor(square, m.RED)are.animate:square.animate.scale(2),square.animate.set_color(m.RED).arrange_submobjectsisarrange,rotate_about_origin(angle)isrotate(angle, about_point=m.ORIGIN), andget_edge_center(m.UP)isget_top().PGroupisGroup, and the singularadd_foreground_mobjectisadd_foreground_mobjects.
VGroup and Group are the same class too, and c2p is coords_to_point, but both
names of these are everywhere in Manim code, so both stay. These docs use VGroup and
c2p.
Types¶
Every keyword argument has a type, and so do .animate chains. So a type checker such as
ty finds these mistakes before you render: a name that
manimgx doesn't have, a keyword that a mobject or an animation doesn't take
(m.Circle(colour=m.BLUE)), or an argument of the wrong type. When the scene runs, most
mobjects and animations ignore a keyword they don't take, so only ty tells you about a
misspelled one. Through .animate, ty knows manimgx's methods only. To animate a method of
your own class, give .animate a function: box.animate(lambda b: b.grow(2)). The
Quickstart sets up ty in your editor.
Sound, slides and voiceover¶
manimgx does the work of manim-voiceover and manim-slides, without plugins:
add_soundputs a sound in the video. ASoundcan also be a part of a play.- A voiceover is
self.say("The derivative of [x squared] is [two x].", anim1, anim2). Each animation plays during its words in brackets, and the scene waits until the line ends. This replaceswith self.voiceover(...) as tracker:, bookmarks andrun_time=tracker.duration. Any text-to-speech service can be a voice. next_sectionstarts a section of one video, not a separate file.manimgx presentshows the sections as slides. Useself.next_section()instead ofself.next_slide(), and"presentation.loop"instead ofloop=True.notes=works as before.add_subcaptionadds captions.manimgx renderwrites them next to the video, as subtitles.
See Sound and voice and Rendering and sharing.