Skip to main content

Square

Description

The Square class, which inherits from Polygon, represents a square.

Details

The default drawing style for a square is a fill rather than a stroke.

Constructor Parameters

  • side_length (float, default=2.0): Length of the square's sides.
  • kwargs (dict): Additional arguments for Polygon.
    • corner_radius (float, default=0.0): Radius for rounding corners.

Attributes

  • side_length (float): Length of the square's sides.
  • vertices (Point3D_Array): Array of vertex points, where the units are manim coordinates.

Examples

Example 1

A square with a custom side length.

from smanim import *

s = Square(side_length=1)
canvas.add(s)
canvas.draw(crop=True, ignore_bg=True)
Example 1