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

6.0 KiB

name, description, metadata
name description metadata
shapes Circle, Square, Rectangle, Polygon and geometric primitives
tags
shapes, circle, square, rectangle, polygon, geometry

Geometric Shapes

Basic geometric primitives in Manim.

Circle

from manim import *

class CircleExample(Scene):
    def construct(self):
        # Default circle
        c1 = Circle()

        # With parameters
        c2 = Circle(
            radius=2,
            color=BLUE,
            fill_opacity=0.5,
            stroke_width=4
        )

        self.add(c1, c2)

Circle Methods

circle = Circle()

# Get properties
circle.get_radius()
circle.get_center()

# Create from points
Circle.from_three_points(p1, p2, p3)

# Surround another mobject
triangle = Triangle()
circle = Circle().surround(triangle)  # Circle wraps around triangle
circle = Circle().surround(triangle, buffer_factor=1.5)  # With padding
circle = Circle().surround(triangle, stretch=True)  # Stretch to fit

Ellipse

class EllipseExample(Scene):
    def construct(self):
        ellipse = Ellipse(
            width=4,
            height=2,
            color=GREEN
        )
        self.add(ellipse)

Square

class SquareExample(Scene):
    def construct(self):
        # Default square
        s1 = Square()

        # With parameters
        s2 = Square(
            side_length=2,
            color=RED,
            fill_opacity=0.8
        )

        self.add(s1, s2)

Rectangle

class RectangleExample(Scene):
    def construct(self):
        rect = Rectangle(
            width=4,
            height=2,
            color=YELLOW,
            fill_opacity=0.5
        )
        self.add(rect)

RoundedRectangle

class RoundedRectExample(Scene):
    def construct(self):
        rounded = RoundedRectangle(
            width=4,
            height=2,
            corner_radius=0.5,
            color=BLUE,
            fill_opacity=0.8
        )
        self.add(rounded)

Triangle

class TriangleExample(Scene):
    def construct(self):
        # Equilateral triangle
        tri = Triangle(color=PURPLE)

        # Custom triangle (using Polygon)
        custom_tri = Polygon(
            ORIGIN, RIGHT * 2, UP * 3,
            color=GREEN
        )

        self.add(tri, custom_tri.shift(RIGHT * 3))

Polygon

Create any polygon from vertices.

class PolygonExample(Scene):
    def construct(self):
        # Pentagon
        pentagon = RegularPolygon(n=5, color=ORANGE)

        # Hexagon
        hexagon = RegularPolygon(n=6, color=TEAL)

        # Custom polygon
        custom = Polygon(
            [-2, -1, 0],
            [2, -1, 0],
            [2, 1, 0],
            [0, 2, 0],
            [-2, 1, 0],
            color=PINK
        )

        VGroup(pentagon, hexagon, custom).arrange(RIGHT, buff=1)
        self.add(pentagon, hexagon, custom)

RegularPolygon

class RegularPolygonExamples(Scene):
    def construct(self):
        shapes = VGroup(
            RegularPolygon(n=3),   # Triangle
            RegularPolygon(n=4),   # Square
            RegularPolygon(n=5),   # Pentagon
            RegularPolygon(n=6),   # Hexagon
            RegularPolygon(n=8),   # Octagon
        ).arrange(RIGHT)
        self.add(shapes)

Star

class StarExample(Scene):
    def construct(self):
        star = Star(
            n=5,                    # Number of points
            outer_radius=2,
            inner_radius=1,         # Optional: auto-calculated if not specified
            density=2,              # How vertices connect (affects shape)
            color=YELLOW,
            fill_opacity=1
        )
        self.add(star)

        # Different densities create different star patterns
        star_d2 = Star(7, outer_radius=2, density=2, color=RED)
        star_d3 = Star(7, outer_radius=2, density=3, color=PURPLE)

RegularPolygram

Star-like shapes with vertices connected by density.

class PolygramExample(Scene):
    def construct(self):
        # Pentagram (5-pointed star pattern)
        pentagram = RegularPolygram(5, radius=2)
        self.add(pentagram)

Annulus (Ring)

class AnnulusExample(Scene):
    def construct(self):
        ring = Annulus(
            inner_radius=1,
            outer_radius=2,
            color=BLUE,
            fill_opacity=0.5
        )
        self.add(ring)

Sector and Arc

class SectorArcExample(Scene):
    def construct(self):
        # Sector (pie slice)
        sector = Sector(
            radius=2,
            angle=PI/2,
            start_angle=0,
            color=RED,
            fill_opacity=0.8
        ).shift(LEFT * 2)

        # Arc (just the curve)
        arc = Arc(
            radius=2,
            angle=PI/2,
            start_angle=PI,
            color=BLUE
        ).shift(RIGHT * 2)

        self.add(sector, arc)

ArcBetweenPoints

class ArcBetweenPointsExample(Scene):
    def construct(self):
        arc = ArcBetweenPoints(
            start=LEFT * 2,
            end=RIGHT * 2,
            angle=PI/2,  # Curvature
            color=GREEN
        )
        self.add(arc)

Dot

class DotExample(Scene):
    def construct(self):
        # Default dot
        d1 = Dot()

        # Customized
        d2 = Dot(
            point=RIGHT * 2,
            radius=0.2,
            color=YELLOW
        )

        self.add(d1, d2)

Common Shape Operations

shape = Square()

# Transform
shape.scale(2)
shape.rotate(PI/4)
shape.stretch(2, dim=0)  # Stretch horizontally

# Style
shape.set_fill(RED, opacity=0.5)
shape.set_stroke(WHITE, width=4)

# Position
shape.move_to(ORIGIN)
shape.shift(UP * 2)
shape.next_to(other, RIGHT)

Best Practices

  1. Use RegularPolygon for regular shapes - More precise than manual Polygon
  2. Set fill_opacity for visibility - Default is often 0 (transparent)
  3. Use Dot for points - Better than Circle with small radius
  4. Use RoundedRectangle for UI elements - More polished look
  5. Combine shapes with VGroup - For complex figures