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: manimlib.mobject.mobject.Mobject, target_mobject: Optional[manimlib.mobject.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 是一个从 (x, y, z, t) 到 (x’, y’, z’) 的函数。 t 的取值范围是 [0, 1], 让 mobject 根据 homotopy 计算的每个点坐标进行变换。 例子中 t = 0 时 mob 是边长为 0 的正方形, t = 1 时是边长为 2 的正方形。 与 Transform 类似,区别在于 Transform 锚点运动轨迹是直线, Homotopy 锚点运动轨迹是根据传入的 homotopy 计算的。
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: manimlib.mobject.mobject.Mobject, target_mobject: Optional[manimlib.mobject.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)¶