Creation

声明

这一页部分翻译自elteoremadebeethoven的 manim_3feb_docs

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

ShowPartial

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

ShowCreation 和 ShowPassingFlash 的抽象类

ShowCreation

class manimlib.animation.creation.ShowCreation(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_submobjects(RIGHT,buff=2)

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

        self.wait()

Uncreate

class manimlib.animation.creation.Uncreate(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_submobjects(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, **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_submobjects(RIGHT,buff=2)

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

        self.wait()

Write

class manimlib.animation.creation.Write(mobject, **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_submobjects(RIGHT,buff=2)

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

        self.wait()

ShowIncreasingSubsets

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

ShowSubmobjectsOneByOne

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