creation¶
- class janim.anims.creation.ShowPartial(item: Item, bound_func: Callable[[UpdaterParams], tuple[int, int]], *, auto_close_path: bool = False, become_at_end: bool = False, root_only: bool = False, zero_bound: int | None = None, **kwargs)¶
Bases:
DataUpdaterAnimation to show a part of an item, determined by
bound_func.ShowPartialExample ¶
from janim.imports import * class ShowPartialExample(Timeline): def construct(self): group = Group( Line(path_arc=PI), Line(path_arc=PI), Circle(), Circle() ) group.points.arrange(aligned_edge=DOWN) func1 = lambda p: (0, p.alpha) func2 = lambda p: (.5 - .5 * p.alpha, .5 + .5 * p.alpha) self.play( ShowPartial(group[0], func1), ShowPartial(group[1], func2), ShowPartial(group[2], func1), ShowPartial(group[3], func2), duration=3 )
- class janim.anims.creation.Create(item: Item, auto_close_path: bool = True, **kwargs)¶
Bases:
ShowPartialShow the creation process of an item
CreateExample ¶
from janim.imports import * class CreateExample(Timeline): def construct(self): group = Group( Square(), Square(), Circle(fill_alpha=0.5), Text('Text', font_size=48), color=BLUE ) group.points.arrange(buff=LARGE_BUFF) self.play( Create(group[0], auto_close_path=False), Create(group[1:]), duration=3 )
- class janim.anims.creation.Uncreate(item: Item, hide_at_end: bool = True, auto_close_path: bool = True, **kwargs)¶
Bases:
ShowPartialAnimation to show the destruction process of an item (reversed
Create).UncreateExample ¶
from janim.imports import * class UncreateExample(Timeline): def construct(self): group = Group( Square(), Square(), Circle(fill_alpha=0.5), Text('Text', font_size=48), color=BLUE ) group.points.arrange(buff=LARGE_BUFF) self.play( Uncreate(group[0], auto_close_path=False), Uncreate(group[1:]), duration=3 )
- class janim.anims.creation.Destruction(item: Item, hide_at_end: bool = True, auto_close_path: bool = True, **kwargs)¶
Bases:
ShowPartialShow the destruction process of an item
Opposite direction to
Uncreate
DestructionExample ¶
from janim.imports import * class DestructionExample(Timeline): def construct(self): group = Group( Square(), Square(), Circle(fill_alpha=0.5), Text('Text', font_size=48), color=BLUE ) group.points.arrange(buff=LARGE_BUFF) self.play( Destruction(group[0], auto_close_path=False), Destruction(group[1:]), duration=3 )
- class janim.anims.creation.DrawBorderThenFill(item: ~janim.items.item.Item, *, duration: float = 2.0, stroke_radius: float = 0.01, scale_with_camera: bool = False, stroke_color: JAnimColor = None, rate_func: RateFunc = <function double_smooth>, become_at_end: bool = False, root_only: bool = False, **kwargs)¶
Bases:
DataUpdaterDraws the outline and then fills.
You can use the
stroke_radiusparameter to adjust the stroke width when “drawing the outline”, the default value is 0.01If the
scale_with_cameraparameter is set, the stroke width will adjust with changes incamerasize; the smaller the frame size, the thinner the stroke
DrawBorderThenFillExample ¶
from janim.imports import * class DrawBorderThenFillExample(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.arrange(buff=LARGE_BUFF) self.play( DrawBorderThenFill(group), duration=3 ) self.forward() self.play( DrawBorderThenFill(group, stroke_radius=0.02), duration=3 ) self.forward()
- class janim.anims.creation.Write(item: ~janim.items.item.Item, *, duration: float | None = None, lag_ratio: float | None = None, rate_func: RateFunc = <function linear>, skip_null_items: bool = True, root_only: bool = False, **kwargs)¶
Bases:
DrawBorderThenFillShow the writing process (apply
DrawBorderThenFillto each sub-object).WriteExample ¶
from janim.imports import * class WriteExample(Timeline): def construct(self): dots = Dot(color=BLUE) * 10 dots.points.arrange().shift(UP) txt = Text('Text text Text text') txt.points.shift(DOWN) self.play( Write(dots, duration=2), Write(txt, duration=2), )
- class janim.anims.creation.ShowIncreasingSubsets(group: ~janim.items.group.Group[~janim.items.item.Item], *, int_func=<built-in function round>, show_at_begin: bool = True, hide_at_end: bool = False, **kwargs)¶
Bases:
AnimationReveal child items one by one
Note: This animation currently does not work within
FrameEffectShowIncreasingSubsetsExample ¶
from janim.imports import * class ShowIncreasingSubsetsExample(Timeline): def construct(self): text = Text('ShowIncreasingSubsets') text.points.set_width(11) self.forward(0.5) self.play(ShowIncreasingSubsets(text[0], duration=3)) self.forward(0.5)
- class WrapperItem(anim: ShowIncreasingSubsets)¶
Bases:
Item
- class janim.anims.creation.ShowSubitemsOneByOne(group: ~janim.items.group.Group, *, int_func=<built-in function ceil>, hide_at_end: bool = True, **kwargs)¶
Bases:
ShowIncreasingSubsetsShowSubitemsOneByOneExample ¶
from janim.imports import * class ShowSubitemsOneByOneExample(Timeline): def construct(self): text = Text('ShowSubitemsOneByOne') text.points.set_width(11) self.forward(0.5) self.play(ShowSubitemsOneByOne(text[0], duration=3)) self.forward(0.5)