indication¶
- class janim.anims.indication.FocusOn(point_or_item: Vect | Item, *, about_edge: Vect = array([0., 0., 0.]), color: JAnimColor = '#888888', alpha: float = 0.2, duration: float = 2, **kwargs)¶
基类:
DataUpdater[Dot]展现一个逐渐聚焦到指定物件的圆形缩小动画
FocusOnExample ¶
from janim.imports import *
class FocusOnExample(Timeline):
def construct(self):
group = Group(
Dot(),
Typst('x')
).show()
group.points.scale(2).arrange(RIGHT, buff=2)
item_or_coord = [
*group, # Items: Dot and "x"
group.points.box.right + RIGHT * 2 # Coord
]
colors=[GREY, RED, BLUE]
for obj, color in zip(item_or_coord, colors):
self.play(FocusOn(obj, color=color))
self.forward(0.3)
- class janim.anims.indication.Indicate(item: ~janim.items.points.Points, *, scale_factor: float = 1.2, color: JAnimColor = '#FFFF00', rate_func: RateFunc = <function there_and_back>, root_only: bool = False, **kwargs)¶
基类:
DataUpdater展现指定物件以放大为黄色后回到原状的动画
IndicateExample ¶
from janim.imports import *
class IndicateExample(Timeline):
def construct(self):
formula = Typst('f(x)')
dot = Dot()
group = Group(formula, dot).show()
group.points.scale(3).arrange(DOWN, buff=3)
for mob in [formula[2], dot]:
self.play(Indicate(mob))
self.forward(0.3)
- class janim.anims.indication.CircleIndicate(item: ~janim.items.points.Points, *, color: JAnimColor = '#FFFF00', rate_func: RateFunc = <function there_and_back>, scale: float = 1, buff: float = 0.25, **kwargs)¶
基类:
DataUpdater[Circle]展现以圆圈在指定物件周围淡入淡出进行强调的动画
可以使用
rate_func=there_and_back_with_pause使得动画中间停留一段时间可以传入
scale指定缩放,例如scale=1.2即缩小的同时淡入,并且放大的同时淡出
CircleIndicateExample ¶
from janim.imports import *
class CircleIndicateExample(Timeline):
def construct(self):
group = Group(
Dot(),
Typst('x')
).show()
group.points.scale(2).arrange(RIGHT, buff=2)
self.forward(0.2)
for obj in group:
self.play(CircleIndicate(obj))
self.forward(0.2)
for obj in group:
self.play(CircleIndicate(obj, scale=1.5))
- class janim.anims.indication.ShowPassingFlash(item: Points, *, time_width: float = 0.1, auto_close_path: bool = False, **kwargs)¶
基类:
ShowPartial基于
time_width显示物件的一小段- label_color: tuple[float, float, float] = (177, 137, 198)¶
- class janim.anims.indication.ShowCreationThenDestruction(item: Points, *, time_width: float = 2.0, duration: float = 1, **kwargs)¶
-
展现创建动画后展现销毁动画
ShowCreationThenDestructionExample ¶
from janim.imports import *
class ShowCreationThenDestructionExample(Timeline):
def construct(self):
group = Group(
Square(fill_alpha=0.5),
Circle(fill_alpha=0.5),
Text('Text', font_size=48),
color=BLUE
)
group.points.scale(1.5).arrange(RIGHT, buff=2)
self.play(
*[
ShowCreationThenDestruction(item, auto_close_path=True)
for item in group
],
duration=2
)
self.forward()
- class janim.anims.indication.ShowCreationThenFadeOut(item: Points, create_kwargs: dict = {}, fadeout_kwargs: dict = {}, **kwargs)¶
基类:
Succession展现创建动画后展现淡出动画
ShowCreationThenFadeOutExample ¶
from janim.imports import *
class ShowCreationThenFadeOutExample(Timeline):
def construct(self):
group = Group(
Square(fill_alpha=0.5),
Circle(fill_alpha=0.5),
Text('Text', font_size=48),
color=BLUE
)
group.points.scale(1.5).arrange(RIGHT, buff=2)
self.play(
*map(ShowCreationThenFadeOut, group)
)
self.forward()
- class janim.anims.indication.AnimationOnSurroundingRect(item: Points, rect_anim: type[Animation], surrounding_rect_config: dict = {}, **kwargs)¶
基类:
AnimGroupShowPassingFlash、ShowCreationThenDestructionAround、ShowCreationThenFadeAround的基类- label_color: tuple[float, float, float] = (177, 137, 198)¶
- create_rect() SurroundingRect¶
- updater(data: Points, p: UpdaterParams)¶
ShowPassingFlashAroundExample ¶
from janim.imports import *
class ShowPassingFlashAroundExample(Timeline):
def construct(self):
group = Group(
Square(fill_alpha=0.5),
Circle(fill_alpha=0.5),
Text('Text', font_size=48),
color=BLUE
).show()
group.points.scale(1.5).arrange(RIGHT, buff=2)
self.play(
*map(ShowPassingFlashAround, group)
)
self.forward()
- class janim.anims.indication.ShowCreationThenDestructionAround(item: Points, **kwargs)¶
-
在指定物件周围先创建出完整线条再销毁线条的动画
ShowCreationThenDestructionAroundExample ¶
from janim.imports import *
class ShowCreationThenDestructionAroundExample(Timeline):
def construct(self):
group = Group(
Square(fill_alpha=0.5),
Circle(fill_alpha=0.5),
Text('Text', font_size=48),
color=BLUE
).show()
group.points.scale(1.5).arrange(RIGHT, buff=2)
self.play(
*map(ShowCreationThenDestructionAround, group)
)
self.forward()
- class janim.anims.indication.ShowCreationThenFadeAround(item: Points, **kwargs)¶
-
在指定物件周围先创建出完整线条再淡出线条的动画
ShowCreationThenFadeAroundExample ¶
from janim.imports import *
class ShowCreationThenFadeAroundExample(Timeline):
def construct(self):
group = Group(
Square(fill_alpha=0.5),
Circle(fill_alpha=0.5),
Text('Text', font_size=48),
color=BLUE
).show()
group.points.scale(1.5).arrange(RIGHT, buff=2)
self.play(
*map(ShowCreationThenFadeAround, group)
)
self.forward()
- class janim.anims.indication.Flash(point_or_item: Vect | ~janim.items.item.Item, *, color: JAnimColor = '#FFFF00', line_length: float = 0.2, num_lines: int = 12, flash_radius: float = 0.3, line_stroke_radius: float = 0.015, rate_func=<function flash_rate_function>, **kwargs)¶
基类:
ShowCreationThenDestruction展现以放射状线条进行强调的动画
FlashExample ¶
from janim.imports import *
class FlashExample(Timeline):
def construct(self):
group = Group(
Dot(),
Typst('x')
).show()
group.points.scale(2).arrange(RIGHT, buff=2)
item_or_coord = [
*group, # Items: Dot and "x"
group.points.box.right + RIGHT * 2 # Coord
]
colors = [GREY, RED, BLUE]
self.forward(0.3)
for obj, color in zip(item_or_coord, colors):
self.play(Flash(obj, color=color, flash_radius=0.5))
self.forward(0.3)
- class janim.anims.indication.ApplyWave(item: Item, direction: Vect = array([0., 1., 0.]), amplitude: float = 0.2, *, duration: float = 1.0, root_only: bool = False, **kwargs)¶
基类:
Homotopy
ApplyWaveExample ¶
from janim.imports import *
class ApplyWaveExample(Timeline):
def construct(self):
group = Group(
Square(fill_alpha=0.5),
Circle(fill_alpha=0.5),
Text('Text', font_size=48),
color=BLUE
).show()
group.points.scale(1.5).arrange(RIGHT, buff=2)
self.play(*map(ApplyWave, group))
self.forward()
- class janim.anims.indication.WiggleOutThenIn(item: Item, *, scale: float = 1.1, angle: float = 0.06283185307179587, n_wiggles: int = 6, scale_about_point: Vect | None = None, rotate_about_point: Vect | None = None, duration: float = 2, root_only: bool = False, **kwargs)¶
基类:
DataUpdater
WiggleOutThenInExample ¶
from janim.imports import *
class WiggleOutThenInExample(Timeline):
def construct(self) -> None:
group = Group(
Square(fill_alpha=0.5),
Circle(fill_alpha=0.5),
Text('Text', font_size=48),
color=BLUE
).show()
group.points.scale(1.5).arrange(RIGHT, buff=2)
self.play(*map(WiggleOutThenIn, group))
self.forward()