growing¶
- class janim.anims.growing.GrowFromPoint(item: Points, point: ndarray, root_only: bool = False, **kwargs)¶
基类:
DataUpdater[Points]从指定的位置放大显现
GrowFromPointExample ¶
from janim.imports import * class GrowFromPointExample(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) directions=[UP,LEFT,DOWN,RIGHT] for direction in directions: self.play( *[ GrowFromPoint(item, item.points.box.center + direction * 3) for item in group ] ) self.forward()
- class janim.anims.growing.GrowFromCenter(item: Points, **kwargs)¶
-
从物件的中心放大显现
GrowFromCenterExample ¶
from janim.imports import * class GrowFromCenterExample(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(*map(GrowFromCenter, group)) self.forward()
- class janim.anims.growing.GrowFromEdge(item: Points, edge: ndarray, **kwargs)¶
-
从物件的指定边角放大显现
GrowFromEdgeExample ¶
from janim.imports import * class GrowFromEdgeExample(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) directions=[UP,LEFT,DOWN,RIGHT] for direction in directions: self.play( *[ GrowFromEdge(item, direction) for item in group ] ) self.forward()
- class janim.anims.growing.ShrinkToPoint(item: Points, point: ndarray, root_only: bool = False, hide_at_end: bool = True, become_at_end: bool = False, **kwargs)¶
基类:
DataUpdater[Points]缩小到指定的位置消失
ShrinkToPointExample ¶
from janim.imports import * class ShrinkToPointExample(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) directions=[UP,LEFT,DOWN,RIGHT] for direction in directions: self.play( *[ ShrinkToPoint(item, item.points.box.center + direction * 3) for item in group ] ) self.forward()
- class janim.anims.growing.ShrinkToCenter(item: Points, **kwargs)¶
-
缩小到物件的中心消失
ShrinkToCenterExample ¶
from janim.imports import * class ShrinkToCenterExample(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(*map(ShrinkToCenter, group)) self.forward()
- class janim.anims.growing.ShrinkToEdge(item: Points, edge: ndarray, **kwargs)¶
-
缩小到物件的指定边角消失
ShrinkToEdgeExample ¶
from janim.imports import * class ShrinkToEdgeExample(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) directions=[UP,LEFT,DOWN,RIGHT] for direction in directions: self.play( *[ ShrinkToEdge(item, direction) for item in group ] ) self.forward()
- class janim.anims.growing.SpinInFromNothing(item: Points, *, path_arc=1.5707963267948966, **kwargs)¶
-
从物件的中心旋转半圈放大显现
SpinInFromNothingExample ¶
from janim.imports import * class SpinInFromNothingExample(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( *map(SpinInFromNothing, group), duration=2 ) self.forward()
- class janim.anims.growing.SpinOutToNothing(item: ~janim.items.points.Points, *, path_arc=1.5707963267948966, rate_func=<function rush_into>, **kwargs)¶
-
向物件的中心旋转半圈缩小消失
SpinOutToNothingExample ¶
from janim.imports import * class SpinOutToNothingExample(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( *map(SpinOutToNothing, group), duration=2 ) self.forward()
- class janim.anims.growing.GrowArrowByBoundFunc(arrow: Arrow, bound_func: Callable[[float], tuple[float, float]], **kwargs)¶
基类:
GroupUpdaterGrowArrow和GrowDoubleArrow的基类
- class janim.anims.growing.GrowArrow(arrow: Arrow, **kwargs)¶
-
显示箭头的显现过程,从开头到结尾画出,并自动调整箭头标志位置
GrowArrowExample ¶
from janim.imports import * class GrowArrowExample(Timeline): def construct(self): group = Group( Arrow(ORIGIN, RIGHT * 6), Vector(RIGHT * 6, color=YELLOW) ) group.points.arrange(DOWN, buff=2) self.play( *map(GrowArrow, group), duration=2 ) self.forward()
- class janim.anims.growing.GrowDoubleArrow(arrow: Arrow, start_ratio: float = 0.5, **kwargs)¶
-
显示箭头的显现过程,默认从中间向两边显现,并自动调整箭头标志位置
传入
start_ratio(默认0.5) 可以调整开始的位置
GrowDoubleArrowExample ¶
from janim.imports import * class GrowDoubleArrowExample(Timeline): def construct(self): group = DoubleArrow(ORIGIN, RIGHT * 7) * 3 group.points.arrange(DOWN, buff=LARGE_BUFF) self.play( GrowDoubleArrow(group[0], start_ratio=0.2), GrowDoubleArrow(group[1]), GrowDoubleArrow(group[2], start_ratio=0.8), duration=2 ) self.forward()