or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

animations.mdcameras.mdcoordinate-systems.mdindex.mdmobjects.mdrendering.mdscenes.mdutilities.md
tile.json

tessl/pypi-manim

Animation engine for explanatory math videos.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/manim@0.19.x

To install, run

npx @tessl/cli install tessl/pypi-manim@0.19.0

index.mddocs/

Manim

A comprehensive Python library for creating mathematical animations. Manim (Mathematical Animation Engine) provides a powerful API for programmatically generating precise animated videos, particularly for educational mathematics and science content. It supports both 2D and 3D animations with customizable rendering engines.

Package Information

  • Package Name: manim
  • Version: 0.19.0
  • Language: Python
  • Installation: pip install manim
  • Requires: Python ≥ 3.8

Core Imports

import manim

Common patterns for working with animations:

from manim import *

Or selective imports:

from manim import Scene, Circle, Create, Write, Text

Basic Usage

from manim import *

class MyScene(Scene):
    def construct(self):
        # Create a circle and text
        circle = Circle(radius=2, color=BLUE)
        text = Text("Hello, Manim!", font_size=48)
        
        # Position text below circle
        text.next_to(circle, DOWN, buff=0.5)
        
        # Animate creation
        self.play(Create(circle))
        self.play(Write(text))
        
        # Transform and rotate
        self.play(
            circle.animate.set_color(RED).scale(0.5),
            text.animate.rotate(PI/4)
        )
        self.wait(1)

Architecture

Manim follows a hierarchical architecture designed for mathematical precision and extensibility:

Core Components

  • Scene: The main canvas and animation orchestrator that manages mobjects, coordinates rendering, and handles the animation timeline
  • Mobject: Mathematical objects (the visual elements) including geometry, text, graphs, and 3D shapes
  • Animation: Transformation classes that define how mobjects change over time, from simple movements to complex mathematical transitions
  • Camera: Viewing system that controls perspective, zoom, and coordinate mappings for both 2D and 3D rendering
  • Renderer: Backend engines (Cairo for 2D, OpenGL for 3D) that convert mathematical descriptions into visual output

Design Philosophy

This architecture enables Manim's core strength: programmatic precision. Every visual element is defined mathematically, ensuring reproducible, scalable animations that maintain accuracy across different output formats and resolutions. The separation between mathematical description (mobjects) and temporal behavior (animations) allows for complex transformations while preserving the underlying mathematical relationships.

Capabilities

Scene Management

Core scene classes and animation orchestration system for managing the animation lifecycle, mobject placement, and rendering coordination.

class Scene:
    def construct(self) -> None: ...
    def play(*animations, **kwargs) -> None: ...
    def add(*mobjects) -> None: ...
    def remove(*mobjects) -> None: ...
    def wait(duration: float = 1.0) -> None: ...

class MovingCameraScene(Scene):
    def setup(self) -> None: ...

class ThreeDScene(Scene):
    def set_camera_orientation(phi: float, theta: float) -> None: ...

Scenes

Animation System

Comprehensive animation framework including creation, transformation, indication, and composition animations with precise timing control and mathematical interpolation.

class Animation:
    def __init__(mobject: Mobject, run_time: float = 1.0, rate_func: Callable = smooth) -> None: ...

# Creation animations
def Create(mobject: Mobject, **kwargs) -> Animation: ...
def Write(mobject: Mobject, **kwargs) -> Animation: ...
def DrawBorderThenFill(mobject: VMobject, **kwargs) -> Animation: ...

# Transform animations  
def Transform(mobject: Mobject, target: Mobject, **kwargs) -> Animation: ...
def ReplacementTransform(mobject: Mobject, target: Mobject, **kwargs) -> Animation: ...
def FadeTransform(mobject: Mobject, target: Mobject, **kwargs) -> Animation: ...

# Animation composition
def AnimationGroup(*animations, **kwargs) -> Animation: ...
def Succession(*animations, **kwargs) -> Animation: ...

Animations

Mathematical Objects

Extensive library of mathematical objects including 2D geometry, 3D shapes, text rendering, graphs, and coordinate systems with precise mathematical properties.

# Base classes
class Mobject:
    def shift(vector: np.ndarray) -> Self: ...
    def rotate(angle: float, axis: np.ndarray = OUT) -> Self: ...
    def scale(factor: float) -> Self: ...

class VMobject(Mobject):
    def set_color(color: str) -> Self: ...
    def set_stroke(color: str = None, width: float = None) -> Self: ...
    def set_fill(color: str = None, opacity: float = None) -> Self: ...

# Geometry
def Circle(radius: float = 1.0, **kwargs) -> Circle: ...
def Square(side_length: float = 2.0, **kwargs) -> Square: ...
def Line(start: np.ndarray = LEFT, end: np.ndarray = RIGHT, **kwargs) -> Line: ...
def Arrow(start: np.ndarray = ORIGIN, end: np.ndarray = RIGHT, **kwargs) -> Arrow: ...

# Text and LaTeX
def Text(text: str, font_size: float = 48, **kwargs) -> Text: ...
def MathTex(*tex_strings: str, **kwargs) -> MathTex: ...
def Tex(*tex_strings: str, **kwargs) -> Tex: ...

Mathematical Objects

Coordinate Systems

Mathematical coordinate systems and graphing utilities including 2D/3D axes, number lines, polar coordinates, and function plotting with automatic scaling and labeling.

class Axes(CoordinateSystem):
    def __init__(x_range: Sequence[float] = None, y_range: Sequence[float] = None, **kwargs) -> None: ...
    def plot(function: Callable, x_range: Sequence[float] = None, **kwargs) -> ParametricFunction: ...
    def get_graph(function: Callable, x_range: Sequence[float] = None, **kwargs) -> ParametricFunction: ...

class NumberPlane(Axes):
    def __init__(x_range: Sequence[float] = None, y_range: Sequence[float] = None, **kwargs) -> None: ...

class ThreeDAxes(Axes):
    def __init__(x_range: Sequence[float] = None, y_range: Sequence[float] = None, z_range: Sequence[float] = None, **kwargs) -> None: ...

class NumberLine(Line):
    def __init__(x_range: Sequence[float] = [-8, 8, 1], **kwargs) -> None: ...
    def number_to_point(number: float) -> np.ndarray: ...
    def point_to_number(point: np.ndarray) -> float: ...

Coordinate Systems

Camera System

Flexible camera system supporting 2D and 3D perspectives, camera movement, zooming, and multi-camera setups for complex visual presentations.

class Camera:
    def __init__(pixel_height: int = None, pixel_width: int = None, **kwargs) -> None: ...
    def capture_mobjects(mobjects: list[Mobject]) -> None: ...

class MovingCamera(Camera):
    def __init__(frame: Mobject = None, **kwargs) -> None: ...

class ThreeDCamera(Camera):
    def set_euler_angles(phi: float = None, theta: float = None, gamma: float = None) -> None: ...
    def add_fixed_orientation_mobjects(*mobjects: Mobject) -> None: ...

Cameras

Rendering System

Backend rendering engines and output management supporting multiple formats, quality settings, and both real-time preview and high-quality export.

class CairoRenderer:
    def __init__(camera: Camera, skip_animations: bool = False, **kwargs) -> None: ...

class OpenGLRenderer:
    def __init__(camera: Camera, **kwargs) -> None: ...

# Configuration
from manim import config
config.pixel_height = 1080
config.pixel_width = 1920
config.frame_rate = 60
config.output_file = "my_animation.mp4"

Rendering

Utilities

Essential utility functions including mathematical operations, color management, rate functions, file operations, and debugging tools for animation development.

# Constants and directions
ORIGIN: np.ndarray
UP: np.ndarray
DOWN: np.ndarray  
LEFT: np.ndarray
RIGHT: np.ndarray
PI: float
TAU: float

# Rate functions
def linear(t: float) -> float: ...
def smooth(t: float) -> float: ...
def ease_in_out_cubic(t: float) -> float: ...
def there_and_back(t: float) -> float: ...

# Color utilities
RED: str
BLUE: str
GREEN: str
def interpolate_color(color1: str, color2: str, alpha: float) -> str: ...

# Space operations
def normalize(vector: np.ndarray) -> np.ndarray: ...
def angle_of_vector(vector: np.ndarray) -> float: ...
def rotate_vector(vector: np.ndarray, angle: float, axis: np.ndarray = OUT) -> np.ndarray: ...

Utilities