Growing

声明

这一页翻译自elteoremadebeethoven的 manim_3feb_docs

GrowFromPoint

class manimlib.animation.growing.GrowFromPoint(mobject: Mobject, point: np.ndarray, **kwargs)
GrowFromPointExample
class GrowFromPointExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                Text("Text").scale(2)
            )
        mobjects.arrange(RIGHT,buff=2)

        directions=[UP,LEFT,DOWN,RIGHT]

        for direction in directions:
            self.play(
                *[GrowFromPoint(mob,mob.get_center()+direction*3) for mob in mobjects]
            )

        self.wait()

GrowFromCenter

class manimlib.animation.growing.GrowFromCenter(mobject: Mobject, **kwargs)
GrowFromCenterExample
class GrowFromCenterExample(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(
            *[GrowFromCenter(mob) for mob in mobjects]
        )

        self.wait()

GrowFromEdge

class manimlib.animation.growing.GrowFromEdge(mobject: Mobject, edge: np.ndarray, **kwargs)
GrowFromEdgeExample
class GrowFromEdgeExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                Text("Text").scale(2)
            )
        mobjects.arrange(RIGHT,buff=2)

        directions=[UP,LEFT,DOWN,RIGHT]

        for direction in directions:
            self.play(
                *[GrowFromEdge(mob,direction) for mob in mobjects]
            )

        self.wait()

GrowArrow

class manimlib.animation.growing.GrowArrow(arrow: Arrow, **kwargs)
GrowArrowExample
class GrowArrowExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Arrow(LEFT,RIGHT),
                Vector(RIGHT*2).set_color(YELLOW)
            )
        mobjects.scale(3)
        mobjects.arrange(DOWN,buff=2)

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

        self.wait()

SpinInFromNothing

class manimlib.animation.growing.SpinInFromNothing(mobject: Mobject, **kwargs)
SpinInFromNothingExample
class SpinInFromNothingExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Square(),
                RegularPolygon(fill_opacity=1, color=GREEN),
                Text("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange(RIGHT,buff=2)

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

        self.wait()