Creation

声明

这一页部分翻译自elteoremadebeethoven的 manim_3feb_docs

后面两个类由鹤翔万里添加

ShowPartial

class manimlib.animation.creation.ShowPartial(mobject: manimlib.mobject.mobject.Mobject, **kwargs)

ShowCreation 和 ShowPassingFlash 的抽象类

ShowCreation

class manimlib.animation.creation.ShowCreation(mobject: manimlib.mobject.mobject.Mobject, **kwargs)

显示创建过程

ShowCreationExample
class ShowCreationExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Circle(),
            Circle(fill_opacity=1),
            Text("Text").scale(2)
        )
        mobjects.scale(1.5)
        mobjects.arrange(RIGHT, buff=2)

        self.play(
            *[ShowCreation(mob) for mob in mobjects]
        )

        self.wait()

Uncreate

class manimlib.animation.creation.Uncreate(mobject: manimlib.mobject.mobject.Mobject, **kwargs)

显示销毁过程( ShowCreation 的倒放)

UncreateExample
class UncreateExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Circle(),
            Circle(fill_opacity=1),
            Text("Text").scale(2)
        )
        mobjects.scale(1.5)
        mobjects.arrange(RIGHT, buff=2)

        self.add(mobjects)

        self.wait(0.3)

        self.play(
            *[Uncreate(mob) for mob in mobjects]
        )

        self.wait()

DrawBorderThenFill

class manimlib.animation.creation.DrawBorderThenFill(vmobject: manimlib.mobject.types.vectorized_mobject.VMobject, **kwargs)

画出边缘,然后填充颜色

DrawBorderThenFillExample
class DrawBorderThenFillExample(Scene):
    def construct(self):
        vmobjects = VGroup(
            Circle(),
            Circle(fill_opacity=1),
            Text("Text").scale(2)
        )
        vmobjects.scale(1.5)
        vmobjects.arrange(RIGHT, buff=2)

        self.play(
            *[DrawBorderThenFill(mob) for mob in vmobjects]
        )

        self.wait()

Write

class manimlib.animation.creation.Write(vmobject: manimlib.mobject.types.vectorized_mobject.VMobject, **kwargs)

写(对子物件逐个使用 DrawBorderThenFill

WriteExample
class WriteExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Circle(),
            Circle(fill_opacity=1),
            Text("Text").scale(2)
        )
        mobjects.scale(1.5)
        mobjects.arrange(RIGHT, buff=2)

        self.play(
            *[Write(mob) for mob in mobjects]
        )

        self.wait()

ShowIncreasingSubsets

class manimlib.animation.creation.ShowIncreasingSubsets(group: Mobject, **kwargs)
ShowIncreasingSubsetsExample
class ShowIncreasingSubsetsExample(Scene):
    def construct(self):
        text = Text("ShowIncreasingSubsets")
        text.set_width(11)
        self.wait()
        self.play(ShowIncreasingSubsets(text, run_time=4))
        self.wait()

ShowSubmobjectsOneByOne

class manimlib.animation.creation.ShowSubmobjectsOneByOne(group: Mobject, **kwargs)
ShowSubmobjectsOneByOneExample
class ShowSubmobjectsOneByOneExample(Scene):
    def construct(self):
        text = Text("ShowSubmobjectsOneByOne")
        text.set_width(11)
        self.wait()
        self.play(ShowSubmobjectsOneByOne(text, run_time=4))
        self.wait()