SurroundingRectangle
Description
The SurroundingRectangle
class, which inherits from Rectangle
, represents a rectangle that surrounds a given Mobject
.
It can be applied to emphasize a shape or some text to the user.
Constructor Parameters
mobject
(Mobject): The object to be surrounded by the rectangle.stroke_color
(ManimColor, default=GRAY): The color of the rectangle's stroke.buff
(float, default=SMALL_BUFF): The padding between theMobject
and the rectangle.corner_radius
(float, default=0.0): Radius for rounding corners, in manim units (a reasonable value is often 0.1 to 0.3).kwargs
(dict): Additional arguments forRectangle
.
Attributes
buff
(float): Padding between theMobject
and the rectangle.surrounded
(Mobject): TheMobject
that is being surrounded.
Examples
Example 1
A surrounding rectangle around a square with custom padding.
from smanim import *
square = Square(side_length=2, color=DARK_GRAY)
surrounding_rect = SurroundingRectangle(square, buff=0.5)
canvas.add(square, surrounding_rect)
canvas.draw(crop=True, ignore_bg=True)