Square¶
Qualified name: manim.mobject.geometry.polygram.Square
- class Square(side_length=2.0, **kwargs)[source]¶
Bases:
RectangleA rectangle with equal side lengths.
- Parameters:
side_length (float) – The length of the sides of the square.
kwargs (Any) – Additional arguments to be passed to
Rectangle.
Examples
Example: SquareExample ¶
from manim import * class SquareExample(Scene): def construct(self): square_1 = Square(side_length=2.0).shift(DOWN) square_2 = Square(side_length=1.0).next_to(square_1, direction=UP) square_3 = Square(side_length=0.5).next_to(square_2, direction=UP) self.add(square_1, square_2, square_3)
class SquareExample(Scene): def construct(self): square_1 = Square(side_length=2.0).shift(DOWN) square_2 = Square(side_length=1.0).next_to(square_1, direction=UP) square_3 = Square(side_length=0.5).next_to(square_2, direction=UP) self.add(square_1, square_2, square_3)Methods
Attributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridescolordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorside_lengthstroke_colorwidthThe width of the mobject.
- _original__init__(side_length=2.0, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
side_length (float)
kwargs (Any)
- Return type:
None