Indication

声明

这一页翻译自elteoremadebeethoven的 manim_3feb_docs

FocusOn

class manimlib.animation.indication.FocusOn(focus_point: numpy.ndarray, **kwargs)
FocusOnExample
class FocusOnExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Dot(),
            Tex("x")
        )
        mobjects.arrange(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: Mobject, target_mobject: Mobject | None = None, **kwargs)
IndicateExample
class IndicateExample(Scene):
    def construct(self):
        #              0     1    2
        formula = Tex("f(", "x", ")")
        dot = Dot()

        VGroup(formula, dot)\
            .scale(3)\
            .arrange(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: np.ndarray, color: ManimColor = '#FFFF00', **kwargs)
FlashExample
class FlashExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Dot(),
            Tex("x")
        ).scale(2)
        mobjects.arrange(RIGHT, buff=2)

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

        colors = [GREY, 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: Mobject, **kwargs)
CircleIndicateExample
class CircleIndicateExample(Scene):
    def construct(self):
        mobjects = VGroup(
            Dot(),
            Tex("x")
        ).scale(2)
        mobjects.arrange(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: manimlib.mobject.mobject.Mobject, **kwargs)

ShowCreationThenDestruction

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

        self.wait()

ShowCreationThenFadeOut

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

        self.wait()

AnimationOnSurroundingRectangle

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

ShowPassingFlashAround

class manimlib.animation.indication.ShowPassingFlashAround(mobject: Mobject, **kwargs)
ShowPassingFlashAroundExample
class ShowPassingFlashAroundExample(Scene):
    # 目前有显示不全的 bug
    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.play(
            *[ShowPassingFlashAround(mob) for mob in mobjects]
        )

        self.wait()

ShowCreationThenDestructionAround

class manimlib.animation.indication.ShowCreationThenDestructionAround(mobject: Mobject, **kwargs)
ShowCreationThenDestructionAroundExample
class ShowCreationThenDestructionAroundExample(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.play(
            *[ShowCreationThenDestructionAround(mob) for mob in mobjects]
        )

        self.wait()

ShowCreationThenFadeAround

class manimlib.animation.indication.ShowCreationThenFadeAround(mobject: Mobject, **kwargs)
ShowCreationThenFadeAroundExample
class ShowCreationThenFadeAroundExample(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.play(
            *[ShowCreationThenFadeAround(mob) for mob in mobjects]
        )

        self.wait()

ApplyWave

class manimlib.animation.indication.ApplyWave(mobject: 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),
            Text("Text").scale(2)
        )
        mobjects.scale(1.5)
        mobjects.arrange(RIGHT, buff=2)

        self.add(mobjects)

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

        self.wait()

WiggleOutThenIn

class manimlib.animation.indication.WiggleOutThenIn(mobject: manimlib.mobject.mobject.Mobject, **kwargs)
WiggleOutThenInExample
class WiggleOutThenInExample(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.play(
            *[WiggleOutThenIn(mob) for mob in mobjects]
        )

        self.wait()

TurnInsideOut

class manimlib.animation.indication.TurnInsideOut(mobject: Mobject, target_mobject: Mobject | None = None, **kwargs)
TurnInsideOutExample
class TurnInsideOutExample(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.play(
            *[TurnInsideOut(mob) for mob in mobjects]
        )

        self.wait()

FlashyFadeIn

class manimlib.animation.indication.FlashyFadeIn(vmobject: manimlib.mobject.types.vectorized_mobject.VMobject, stroke_width: float = 2, **kwargs)