Indication

声明

这一页翻译自elteoremadebeethoven的 manim_3feb_docs

FocusOn

class manimlib.animation.indication.FocusOn(focus_point, **kwargs)
FocusOnExample
class FocusOnExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Dot(),
            TexMobject("x")
        )
        mobjects.arrange_submobjects(RIGHT,buff=2)

        mobject_or_coord = [
            *mobjects,                    # Mobjects: Dot and "x"
            mobjects.get_right()+RIGHT*2  # Coord
        ]

        colors=[GRAY,RED,BLUE]

        self.add(mobjects)

        for obj,color in zip(mobject_or_coord,colors):
            self.play(FocusOn(obj,color=color))

        self.wait(0.3)

Indicate

class manimlib.animation.indication.Indicate(mobject, target_mobject=None, **kwargs)
IndicateExample
class IndicateExample(Scene):
    def construct(self):
        #                     0    1   2
        formula = TexMobject("f(","x",")")
        dot = Dot()

        VGroup(formula,dot)\
                           .scale(3)\
                           .arrange_submobjects(DOWN,buff=3)

        self.add(formula,dot)

        for mob in [formula[1],dot]:
            self.play(Indicate(mob))

        self.wait(0.3)

Flash

class manimlib.animation.indication.Flash(point, color='#FFFF00', **kwargs)
FlashExample
class FlashExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Dot(),
            TexMobject("x")
        ).scale(2)
        mobjects.arrange_submobjects(RIGHT,buff=2)

        mobject_or_coord = [
            *mobjects,                    # Mobjects: Dot and "x"
            mobjects.get_right()+RIGHT*2  # Coord
        ]

        colors=[GRAY,RED,BLUE]

        self.add(mobjects)

        for obj,color in zip(mobject_or_coord,colors):
            self.play(Flash(obj,color=color,flash_radius=0.5))

        self.wait(0.3)

CircleIndicate

class manimlib.animation.indication.CircleIndicate(mobject, **kwargs)
CircleIndicateExample
class CircleIndicateExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Dot(),
            TexMobject("x")
        ).scale(2)
        mobjects.arrange_submobjects(RIGHT,buff=2)

        self.add(mobjects)
        self.wait(0.2)

        for obj in mobjects:
            self.play(CircleIndicate(obj))

ShowPassingFlash

class manimlib.animation.indication.ShowPassingFlash(mobject, **kwargs)

ShowCreationThenDestruction

class manimlib.animation.indication.ShowCreationThenDestruction(mobject, **kwargs)
ShowCreationThenDestructionExample
class ShowCreationThenDestructionExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                TextMobject("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange_submobjects(RIGHT,buff=2)

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

        self.wait()

        self.wait(0.3)

ShowCreationThenFadeOut

class manimlib.animation.indication.ShowCreationThenFadeOut(mobject, **kwargs)
ShowCreationThenFadeOutExample
class ShowCreationThenFadeOutExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                TextMobject("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange_submobjects(RIGHT,buff=2)

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

        self.wait()

        self.wait(0.3)

AnimationOnSurroundingRectangle

class manimlib.animation.indication.AnimationOnSurroundingRectangle(mobject, **kwargs)

ShowPassingFlashAround

class manimlib.animation.indication.ShowPassingFlashAround(mobject, **kwargs)
ShowPassingFlashAroundExample
class ShowPassingFlashAroundExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                TextMobject("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange_submobjects(RIGHT,buff=2)

        self.add(mobjects)

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

        self.wait()

ShowCreationThenDestructionAround

class manimlib.animation.indication.ShowCreationThenDestructionAround(mobject, **kwargs)
ShowCreationThenDestructionAroundExample
class ShowCreationThenDestructionAroundExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                TextMobject("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange_submobjects(RIGHT,buff=2)

        self.add(mobjects)

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

        self.wait()

        self.wait(0.3)

ShowCreationThenFadeAround

class manimlib.animation.indication.ShowCreationThenFadeAround(mobject, **kwargs)
ShowCreationThenFadeAroundExample
class ShowCreationThenFadeAroundExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                TextMobject("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange_submobjects(RIGHT,buff=2)

        self.add(mobjects)

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

        self.wait()

        self.wait(0.3)

ApplyWave

class manimlib.animation.indication.ApplyWave(mobject, **kwargs)

Homotopy is a function from (x, y, z, t) to (x’, y’, z’)

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

        self.add(mobjects)

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

        self.wait()

        self.wait(0.3)

WiggleOutThenIn

class manimlib.animation.indication.WiggleOutThenIn(mobject, **kwargs)
WiggleOutThenInExample
class WiggleOutThenInExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                TextMobject("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange_submobjects(RIGHT,buff=2)

        self.add(mobjects)

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

        self.wait()

        self.wait(0.3)

TurnInsideOut

class manimlib.animation.indication.TurnInsideOut(mobject, target_mobject=None, **kwargs)
TurnInsideOutExample
class TurnInsideOutExample(Scene):
    def construct(self):
        mobjects = VGroup(
                Circle(),
                Circle(fill_opacity=1),
                TextMobject("Text").scale(2)
            )
        mobjects.scale(1.5)
        mobjects.arrange_submobjects(RIGHT,buff=2)

        self.add(mobjects)

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

        self.wait()

        self.wait(0.3)