Running Manim Scripts
Pymations runs Manim Community scripts. Paste a script that starts with from manim import * into a Python file, press Run, and it plays in the preview. Nothing needs installing.
Pymations is its own implementation of the same script language, written for Circuitry and the browser. It is not made by, or connected with, the Manim Community project.
What runs as it is
- Both forms:
class MyScene(Scene): def construct(self): ..., any number of scenes per file (they all play, in order), andMovingCameraScene. - The names: shapes,
Text,MathTex,Tex,Axes,NumberPlane,VGroup, the animations, rate functions, colour constants, direction constants (UP,UR...) and buffers (SMALL_BUFF...),np, andconfig. - The numbers: default sizes, colours, gaps and timings were measured against Manim Community 0.22 and match it: a circle is red with radius 1,
Writeis linear and takes 1 or 2 seconds,smoothis Manim's own curve, arrows have the same tips and gaps, axes are 12 by 6, andnext_to,arrangeandto_edgeplace things in the same spots. - Sound:
add_soundplays the sound at that point of the timeline, and it is mixed into a recorded video. - Updaters (
add_updater,always_redraw,ValueTracker),self.camera.frame.animate,next_section,save_state/Restore,generate_target/MoveToTarget.
What is different
| Area | In Pymations |
|---|---|
| Maths | Laid out by KaTeX instead of LaTeX. Almost all maths looks the same, within a few percent in size. Custom LaTeX preambles (TexTemplate) and rare LaTeX packages are not available |
| Text font | Built-in fonts: a sans-serif, "serif" and "mono". Another family name picks the nearest of those, so text can be a little wider or narrower than with your computer's fonts. A font file next to the .py (font="Brand.ttf") is used as it is |
| 3D | ThreeDScene scripts run, but play flat, in 2D; camera turns are skipped with a note |
| Rendering | No command line, quality flags or manim.cfg: press Run to watch, and Record Video to make the file. config.background_color and config.frame_height in the script work |
| Reading positions | Positions are worked out in the preview, so turning one into plain numbers needs await (how). Using them in placement, Line(a.get_center(), ...) and sums works without |
| interactive_embed | Skipped |
Something Pymations doesn't have yet stops the run with a plain message naming it, for example "Square has no apply_complex_function() in the preview yet", and the line it is on. The rest of the file is fine; replace or remove that line.
The import
from manim import * and from pymations import * give the same names. Use pymations in new files; keep manim in a pasted script so it still runs with Manim itself.
Tips for pasted scripts
- A script made for Manim often ends with
self.wait(); that is fine. Ascene.render()at the bottom is fine too. - Scripts written by AI sometimes use names from older Manim versions (
ShowCreation,get_graph); those work. - If a long equation fails, the message under the preview quotes KaTeX's reason. Usually a command from a LaTeX package is the cause; write it another way.
Related
- Reference: every name, one line each
- Scenes and sections
- Text and maths
- Recording videos