圆角矩形

限定名称: manim.mobject.geometry.polygram.RoundedRectangle

class RoundedRectangle(corner_radius=0.5, **kwargs)[source]

基础类: Rectangle

一个带有圆角的矩形。

Parameters:
  • corner_radius (float | list[float]) – 矩形角的曲率。

  • kwargs – 传递给Rectangle的额外参数

示例

示例:RoundedRectangleExample

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

class RoundedRectangleExample(Scene):
    def construct(self):
        rect_1 = RoundedRectangle(corner_radius=0.5)
        rect_2 = RoundedRectangle(corner_radius=1.5, height=4.0, width=4.0)

        rect_group = Group(rect_1, rect_2).arrange(buff=1)
        self.add(rect_group)
class RoundedRectangleExample(Scene):
    def construct(self):
        rect_1 = RoundedRectangle(corner_radius=0.5)
        rect_2 = RoundedRectangle(corner_radius=1.5, height=4.0, width=4.0)

        rect_group = Group(rect_1, rect_2).arrange(buff=1)
        self.add(rect_group)

方法

属性

animate

用于动画化self的任何方法的应用。

animation_overrides

color

depth

mobject的深度。

fill_color

如果有多种颜色(用于渐变),则返回第一个颜色

height

mobject的高度。

n_points_per_curve

sheen_factor

stroke_color

width

mobject的宽度。

_original__init__(corner_radius=0.5, **kwargs)

初始化自身。有关准确的签名,请参阅 help(type(self))。

Parameters:

corner_radius (float | list[float])