SurroundingRectangle

限定名称: manim.mobject.geometry.shape\_matchers.SurroundingRectangle

class SurroundingRectangle(*mobjects, color=ManimColor('#FFFF00'), buff=0.1, corner_radius=0.0, **kwargs)[source]

基类: RoundedRectangle

一个包围着 Mobject 的矩形

示例

示例: SurroundingRectExample

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

class SurroundingRectExample(Scene):
    def construct(self):
        title = Title("A Quote from Newton")
        quote = Text(
            "If I have seen further than others, \n"
            "it is by standing upon the shoulders of giants.",
            color=BLUE,
        ).scale(0.75)
        box = SurroundingRectangle(quote, color=YELLOW, buff=MED_LARGE_BUFF)

        t2 = Tex(r"Hello World").scale(1.5)
        box2 = SurroundingRectangle(t2, corner_radius=0.2)
        mobjects = VGroup(VGroup(box, quote), VGroup(t2, box2)).arrange(DOWN)
        self.add(title, mobjects)
class SurroundingRectExample(Scene):
    def construct(self):
        title = Title("A Quote from Newton")
        quote = Text(
            "If I have seen further than others, \n"
            "it is by standing upon the shoulders of giants.",
            color=BLUE,
        ).scale(0.75)
        box = SurroundingRectangle(quote, color=YELLOW, buff=MED_LARGE_BUFF)

        t2 = Tex(r"Hello World").scale(1.5)
        box2 = SurroundingRectangle(t2, corner_radius=0.2)
        mobjects = VGroup(VGroup(box, quote), VGroup(t2, box2)).arrange(DOWN)
        self.add(title, mobjects)

方法

属性

animate (动画)

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

animation_overrides (动画覆盖)

颜色

depth (深度)

mobject 的深度。

fill_color (填充颜色)

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

height (高度)

mobject 的高度。

n_points_per_curve (每条曲线的点数)

sheen_factor (光泽因子)

stroke_color (描边颜色)

width (宽度)

mobject 的宽度。

参数:
  • mobjectsMobject

  • colorParsableManimColor

  • buff (浮点数)

  • corner_radius浮点数

  • kwargs任意类型

_original__init__(*mobjects, color=ManimColor('#FFFF00'), buff=0.1, corner_radius=0.0, **kwargs)

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

参数:
  • mobjectsMobject

  • colorParsableManimColor

  • buff (浮点数)

  • corner_radius浮点数

  • kwargs任意类型

返回类型: