manim.mobject.geometry.Rectangle

class Rectangle(color='#FFFFFF', height=2.0, width=4.0, grid_xstep=None, grid_ystep=None, mark_paths_closed=True, close_new_points=True, **kwargs)[source]

Bases: manim.mobject.geometry.Polygon

A quadrilateral with two sets of parallel sides.

Parameters
  • color (Colors, optional) – The color of the rectangle.

  • height (float, optional) – The vertical height of the rectangle.

  • width (float, optional) – The horizontal width of the rectangle.

  • grid_xstep (float, optional) – Space between vertical grid lines.

  • grid_ystep (float, optional) – Space between horizontal grid lines.

  • mark_paths_closed (bool, optional) – No purpose.

  • close_new_points (bool, optional) – No purpose.

  • kwargs (Any) – Additional arguments to be passed to Polygon

Examples

Example: RectangleExample

../_images/RectangleExample-1.png
from manim import *

class RectangleExample(Scene):
    def construct(self):
        rect1 = Rectangle(width=4.0, height=2.0, grid_xstep=1.0, grid_ystep=0.5)
        rect2 = Rectangle(width=1.0, height=4.0)

        rects = Group(rect1,rect2).arrange(buff=1)
        self.add(rects)

Methods

Attributes

animate

Used to animate the application of a method.

animation_overrides

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.