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)¶
Bases:
DataUpdater[Dot]Show a circular shrinking animation that gradually focuses on the specified item
FocusOnExample ¶
from janim.imports import * class FocusOnExample(Timeline): def construct(self): group = Group( Dot(), TypstMath('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)¶
Bases:
DataUpdaterShow an animation where the specified item scales up to yellow and then returns to its original state
IndicateExample ¶
from janim.imports import * class IndicateExample(Timeline): def construct(self): formula = TypstMath('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, circle_kwargs: dict = {}, **kwargs)¶
Bases:
DataUpdater[Circle]Show an animation with a circle fading in and out around the specified item for emphasis
You can use
rate_func=there_and_back_with_pauseto make the animation pause for a while in the middleYou can pass
scaleto specify scaling, for examplescale=1.2means fading in while shrinking and fading out while expanding
CircleIndicateExample ¶
from janim.imports import * class CircleIndicateExample(Timeline): def construct(self): group = Group( Dot(), TypstMath('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)¶
Bases:
ShowPartialDisplay a small segment of the item based on
time_width
- class janim.anims.indication.ShowCreationThenDestruction(item: Points, *, time_width: float = 2.0, duration: float = 1, **kwargs)¶
Bases:
ShowPassingFlashShow creation animation followed by destruction animation
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 = {}, collapse: bool = True, **kwargs)¶
Bases:
SuccessionShow creation animation followed by fade-out animation
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 = {}, collapse: bool = True, **kwargs)¶
Bases:
AnimGroupBase class for
ShowPassingFlash,ShowCreationThenDestructionAround, andShowCreationThenFadeAround
- class janim.anims.indication.ShowPassingFlashAround(item: Points, **kwargs)¶
Bases:
AnimationOnSurroundingRectAnimation of an incomplete line circling around the specified item
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)¶
Bases:
AnimationOnSurroundingRectAnimation that first creates a complete line around the specified item and then destroys it
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)¶
Bases:
AnimationOnSurroundingRectAnimation that first creates a complete line around the specified item and then fades it out
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)¶
Bases:
ShowCreationThenDestructionShow an animation with radial lines for emphasis
FlashExample ¶
from janim.imports import * class FlashExample(Timeline): def construct(self): group = Group( Dot(), TypstMath('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)¶
Bases:
HomotopyApplyWaveExample ¶
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)¶
Bases:
DataUpdaterWiggleOutThenInExample ¶
from janim.imports import * class WiggleOutThenInExample(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(WiggleOutThenIn, group)) self.forward()