# ManimGX > The animation engine for agents: blazingly fast math and 3D videos with Manim's Python API, on a Rust GPU core. manimgx is a self-contained animation engine for AI agents: it makes mathematical and 3D videos from Python scenes. Scenes use the API of Manim Community Edition, and manimgx annotates all of it with types, so a type checker finds errors before a render. A Rust core draws each frame on the GPU, typesets text and LaTeX mathematics with Typst, and encodes the video and its sound to MP4. The engine calculates each frame at its exact time, so a scene is the same at all frame rates. A check command runs a scene without video, prints its timeline and layout problems, for example text over other text, and writes a storyboard. In a web browser, Pyodide runs the same scenes in a Web Worker, and a WebAssembly build of the core draws them with WebGPU. These are instructions for an AI agent asked to make a video with manimgx. Follow them in order. ## 1. Install ```sh uv tool install --python 3.14 manimgx # puts `manimgx` on PATH manimgx --version ``` - Keep `--python 3.14`: manimgx needs Python 3.13 or 3.14, and uv downloads one if the machine has none. Without it, uv takes the machine's default Python (macOS's is 3.9) and finds no manimgx. - No `uv`? Install it: `curl -LsSf https://astral.sh/uv/install.sh | sh`, then `source $HOME/.local/bin/env` (or call `~/.local/bin/uv`). - Without installing: `uvx --python 3.14 manimgx ` runs the same CLI. - pip works in a virtual environment with Python 3.13 or 3.14 (older Pythons find no manimgx): `python3.14 -m venv .venv && .venv/bin/pip install manimgx`. - manimgx is not the `manim` package: do not install `manim`, ffmpeg or LaTeX, and do not `import manim`. - It draws on the GPU: Metal on macOS, Direct3D 12 on Windows, Vulkan on Linux. With no GPU (a server, a container) it draws on the CPU, with nothing more to install: the Linux wheels bring Mesa's lavapipe. ## 2. Write a scene Save as `scene.py`: ```python import manimgx as m class SquareToCircle(m.Scene): def construct(self) -> None: square = m.Square(side_length=3, color=m.BLUE, fill_opacity=0.5) circle = m.Circle(radius=1.6, color=m.PINK, fill_opacity=0.5) self.play(m.Create(square)) self.play(m.Transform(square, circle)) self.wait() ``` - The API is Manim CE's, and every name is on the package: `m.Circle`, `m.MathTex`, `m.Create`, `m.UP`, `m.BLUE`. - Time passes only in `self.play(...)` (1 s unless `run_time=`) and `self.wait(seconds)`; `self.add(...)` shows a mobject without animating it. - The frame is 14.2 × 8 units centred on the origin: keep everything within x ∈ [-7, 7], y ∈ [-4, 4]. ## 3. Check, then render ```sh manimgx check scene.py # the timeline and layout problems, no video; exit 1 if there are problems manimgx render scene.py # writes SquareToCircle.mp4 beside scene.py and prints its path ``` - `check` lists each play with its line of code, then the problems a viewer would see: text the frame cuts off, texts that overlap, lines through a text, text too small to read. Fix them and check again. It also writes `.storyboard.png`, the frame at the end of each play with problems outlined: look at it if you can view images. - `manimgx still scene.py -t 1.5,end` draws the frames at 1.5 s and at the end into `.png`. - `render` makes 1920×1080 at 60 fps; `-r 1280x720 --fps 30` is quicker for drafts. A file with several scenes needs the scene's name: `manimgx render scene.py MyScene`. - An error prints the scene's line that failed and, for a wrong name, a hint (`ShowCreation is Create in manimgx`). - `no GPU adapter` means the command ran in a sandbox that hides the GPU: run it outside the sandbox (ask the user if your tool needs approval). ## 4. Show it Open the video for the user, and tell them its path: `open SquareToCircle.mp4` on macOS, `xdg-open SquareToCircle.mp4` on Linux. ## 5. API cheat sheet - Shapes: `Square`, `Circle`, `Rectangle`, `Triangle`, `Polygon([x, y, 0], ...)`, `Line`, `Arrow`, `Dot`, `Brace(mob, m.DOWN)`, `NumberPlane`. Points are `[x, y, 0]`. - Text: `Text("plain words")`, `MathTex(r"a^2 + b^2 = c^2")` (LaTeX math), `Tex(r"words and $x^2$")`. Use raw strings. - Animations: `Create`, `Write`, `FadeIn(mob, shift=m.UP)`, `FadeOut`, `Transform`, `ReplacementTransform`, `TransformMatchingTex`, `GrowFromCenter`, `Indicate`, `Circumscribe`, `Rotate(mob, m.PI / 2)`; combine with `AnimationGroup`, `LaggedStart`, `Succession`. `mob.animate.shift(m.RIGHT).scale(2)` animates any method call. - Placement: `.to_edge(m.UP)`, `.next_to(other, m.RIGHT, buff=0.3)`, `.move_to([x, y, 0])`, `.shift(2 * m.LEFT)`, `.scale(k)`, `m.VGroup(a, b).arrange(m.DOWN)`. - Style: `color=m.YELLOW`, `fill_opacity=0.5`, `stroke_width=6`, `font_size=48`. A white background: `m.config.background_color = m.WHITE` after the import. - Graphs: `axes = m.Axes(x_range=[-3, 3], y_range=[-2, 2])`, then `axes.plot(lambda x: x**2, color=m.BLUE)`. - Sound: `self.add_sound("click.wav")` starts a sound now; `self.play(m.FadeIn(mob), m.Sound("whoosh.mp3"))` plays one with an animation. - Narration: `self.say("The derivative of [x squared] is [two x].", m.Indicate(a), m.Write(b))` speaks and plays each animation during its bracketed words; a scene's voice is `voice = m.voices.Fal("", ...)` (fal.ai's text-to-speech, keyed by the environment variable FAL_KEY), by default ElevenLabs' Eleven v3, or any function from text to `m.Speech`. - Slides: `self.next_section("name")` between plays; `manimgx present scene.py` opens them in the browser. ## 6. Look it up The docs follow, each page as Markdown. The User Guide tells how a scene works. The Reference gives each class, the keywords it takes and examples. The Gallery gives the code of thirty films. https://manimgx.academa.ai/llms-full.txt has every page in one file. ## User Guide - [Welcome]() - [Quickstart]() - [Animations]() - [Camera and 3D]() - [Coming from Manim CE]() - [Graphs]() - [Mobjects]() - [Positions]() - [Rendering and sharing]() - [Sound and voice]() - [Text and math]() - [The basics]() - [Updaters]() ## Reference - [Overview]() - [Animate a change]() - [Appear and disappear]() - [Emphasis]() - [Overview]() - [Move and deform]() - [Rate functions]() - [Together and in turn]() - [Transforms]() - [Camera]() - [Overview]() - [Lights and materials]() - [Surfaces and solids]() - [3D scenes]() - [Annotations]() - [Colors]() - [Copies and states]() - [Axes]() - [Charts]() - [Curves]() - [Overview]() - [Number lines]() - [Planes]() - [Plotting]() - [Vector fields]() - [Groups]() - [Images and SVG]() - [Overview]() - [Matrices and tables]() - [Networks]() - [Paths]() - [Point clouds]() - [Positions]() - [Circles and arcs]() - [Combining shapes]() - [Overview]() - [Lines and arrows]() - [Polygons]() - [Size and angle]() - [Style]() - [Overview]() - [Math]() - [Numbers]() - [Text]() - [Command line]() - [Configuration]() - [From Python]() - [Overview]() - [Overview]() - [Ready-made scenes]() - [Scene]() - [Overview]() - [Voice]() - [Overview]() - [Value trackers]() ## Gallery - [All films]() - [Period doubling in the Mandelbrot set]() - [Bending without stretching]() - [Cherenkov light]() - [A torus turned inside out]() - [A coral of random walkers]() - [A harmonic drive]() - [A spinning top]() - [The Hopf fibration]() - [A kaleidoscope on the sphere]() - [Fireflies in sync]() - [Lagrange points]() - [The Game of Life in spacetime]() - [Cubes and the arctic circle]() - [Stars in the Menger sponge]() - [Miura-ori]() - [A network untangles spirals]() - [Steering a beam with phase]() - [Where √z lives]() - [Prince Rupert's cube]() - [Noise into a word]() - [Stacking oranges]() - [Circle or square?]() - [Why a Taylor series stops]() - [The tennis racket flip]() - [A traffic jam from nowhere]() - [Turing patterns on a torus]() - [The Van Allen belts]() - [Crystals and cones]() - [Leapfrogging smoke rings]() - [Quantum tunneling]() ## Optional - [Setup]() - [Documentation]() - [The engine]() - [GitHub workflows]() - [Project management]() - [Testing]() - [Understanding manimgx]() - [Changelog]()