抠图

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

class Cutout(main_shape, *mobjects, **kwargs)[source]

基类: VMobject

带有较小抠图的形状。

参数:
  • main_shape (VMobject) – 用于创建抠图的主要形状。

  • mobjects (VMobject) – 将从 main_shape 中抠出的小形状。

  • kwargs (Any) – 传递给 VMobject 构造函数的其他关键字参数。

警告

从技术上讲,这个类的行为类似于对称差集:如果 mobjects 的某些部分不在 main_shape 内,这些部分将被添加到生成的 VMobject 中。

示例

示例: CutoutExample

from manim import *

class CutoutExample(Scene):
    def construct(self):
        s1 = Square().scale(2.5)
        s2 = Triangle().shift(DOWN + RIGHT).scale(0.5)
        s3 = Square().shift(UP + RIGHT).scale(0.5)
        s4 = RegularPolygon(5).shift(DOWN + LEFT).scale(0.5)
        s5 = RegularPolygon(6).shift(UP + LEFT).scale(0.5)
        c = Cutout(s1, s2, s3, s4, s5, fill_opacity=1, color=BLUE, stroke_color=RED)
        self.play(Write(c), run_time=4)
        self.wait()
class CutoutExample(Scene):
    def construct(self):
        s1 = Square().scale(2.5)
        s2 = Triangle().shift(DOWN + RIGHT).scale(0.5)
        s3 = Square().shift(UP + RIGHT).scale(0.5)
        s4 = RegularPolygon(5).shift(DOWN + LEFT).scale(0.5)
        s5 = RegularPolygon(6).shift(UP + LEFT).scale(0.5)
        c = Cutout(s1, s2, s3, s4, s5, fill_opacity=1, color=BLUE, stroke_color=RED)
        self.play(Write(c), run_time=4)
        self.wait()

方法

属性

animate (动画)

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

animation_overrides (动画覆盖)

颜色

depth (深度)

mobject 的深度。

fill_color (填充颜色)

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

height (高度)

mobject 的高度。

n_points_per_curve (每条曲线的点数)

sheen_factor (光泽因子)

stroke_color (描边颜色)

width (宽度)

mobject 的宽度。

_original__init__(main_shape, *mobjects, **kwargs)

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

参数:
返回类型: