Files
calesthioandHanzo Dev 7ffb943132 Initial release — OpenMontage: the first open-source agentic video production system
11 production pipelines, 47 tools, 124 agent skills.
Supports cloud APIs (fal.ai, OpenAI, ElevenLabs, Suno, HeyGen, Runway) and
free local providers (diffusers, Piper TTS, WAN 2.1, Hunyuan, CogVideo).

Co-authored-by: Hanzo Dev <[email protected]>
2026-03-29 08:25:17 -07:00

2.8 KiB

name, description, metadata
name description metadata
mobjects Mobject types, VMobject, and the mobject hierarchy in Manim
tags
mobject, vmobject, group, submobjects, hierarchy

Mobjects in Manim

Mobject (Mathematical Object) is the base class for all displayable objects in Manim.

Mobject Hierarchy

Mobject (base class)
├── VMobject (Vectorized Mobject - most common)
│   ├── Circle, Square, Rectangle, Polygon
│   ├── Line, Arrow, Vector
│   ├── Text, MathTex, Tex
│   ├── Axes, NumberPlane
│   └── VGroup
├── ImageMobject (for images)
├── PMobject (point clouds)
└── Group (for non-VMobject collections)

VMobject (Vectorized Mobject)

Most shapes you'll use are VMobjects - they're defined by Bézier curves.

# Common VMobjects
circle = Circle()
square = Square()
rect = Rectangle(width=4, height=2)
triangle = Triangle()
polygon = Polygon(ORIGIN, RIGHT, UP)
line = Line(LEFT, RIGHT)
arrow = Arrow(LEFT, RIGHT)

Creating Custom VMobjects

class CustomShape(VMobject):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # Define points using set_points_as_corners or set_points_smoothly
        self.set_points_as_corners([
            LEFT, UP, RIGHT, DOWN, LEFT
        ])

Mobject Properties

Position and Size

mobject.get_center()      # Returns center point
mobject.get_width()       # Returns width
mobject.get_height()      # Returns height
mobject.get_top()         # Top edge center point
mobject.get_bottom()      # Bottom edge center point
mobject.get_left()        # Left edge center point
mobject.get_right()       # Right edge center point

Bounding Box Corners

mobject.get_corner(UL)    # Upper left corner
mobject.get_corner(UR)    # Upper right corner
mobject.get_corner(DL)    # Lower left corner
mobject.get_corner(DR)    # Lower right corner

Submobjects

Mobjects can contain other mobjects as submobjects.

# Access submobjects
group = VGroup(Circle(), Square())
group.submobjects      # List of child mobjects
group[0]               # First submobject (Circle)
group[1]               # Second submobject (Square)

# Iterate over submobjects
for mob in group:
    mob.set_color(RED)

Copying Mobjects

# Create a copy
circle_copy = circle.copy()

# Copy and position
circle_copy = circle.copy().shift(RIGHT * 2)

Method Chaining

Most mobject methods return self, allowing method chaining:

circle = Circle().set_color(RED).shift(LEFT).scale(2)

Best Practices

  1. Use VMobject for custom shapes - Better rendering and animation support
  2. Prefer VGroup over Group - VGroup works better with most animations
  3. Use copy() when reusing - Avoid unintended modifications to original
  4. Chain methods for readability - But break into lines if too long