Python library for mathematical visualizations and animations. Lighter than Manim, with live preview.
pip install pillow svgelementsLaTeX support (optional):
# Ubuntu/Debian
sudo apt install texlive-latex-extra dvisvgmfrom mingraf import *
scene = Scene(width=1280, height=720, fps=30)
circle = scene.add(Circle((0, 0), radius=1.5, color=BLUE, fill=True))
scene.play(circle.animate.shift(RIGHT * 2), duration=1.5)
scene.render("animation.mp4")import numpy as np
from mingraf import *
scene = Scene(width=1280, height=720)
axes = scene.add(Axes(x_range=[-3, 3, 1], y_range=[-2, 2, 1]))
sin_graph = axes.plot(lambda x: np.sin(x), color=RED)
cos_graph = axes.plot(lambda x: np.cos(x), color=GREEN)
scene.add(sin_graph, cos_graph)
riemann = axes.get_riemann_rectangles(sin_graph, [0, np.pi], dx=0.5, color=YELLOW)
scene.add(riemann)
scene.render("functions.mp4")from mingraf.live_preview import export as preview_export
with preview_export("output.mp4", preview=True) as scene:
circle = scene.add(Circle((0, 0), radius=1.5, color=BLUE))
scene.play(circle.animate.shift(RIGHT), duration=2)
# Adjust parameters in real-time while preview runsCircle, Square, Rectangle, Line, Arrow, Dot, Triangle, Polygon, Ellipse
Axes, NumberPlane, FunctionGraph, Surface, Brace, get_riemann_rectangles(), get_area()
animate.shift(), animate.scale(), animate.rotate(), Create, FadeIn, FadeOut, Transform
scene = Scene(width=640, height=480, fps=30, bg=(10, 10, 15))
scene.add(obj) # Add object
scene.remove(obj) # Remove object
scene.play(anim, duration=1) # Play animation
scene.wait(seconds) # Pause
scene.render("output.mp4") # Render to file- MP4 —
scene.render("animation.mp4") - PNG —
scene.render("frame.png") - GIF —
scene.render("animation.gif")
python mingraf_mcp_server.py --port 8080See the examples/ directory for complete examples.
- Python 3.9+
- pillow, svgelements
- ffmpeg (for MP4 export)
MIT