arrow¶
- class janim.items.geometry.arrow.CenterAnchor(*values)¶
基类:
StrEnum箭头原点所处位置的选项
图形示意:
.----- | ----- | ----- [Back] [Center] [Front] | ----- | ----- .-----
- Back = 'back'¶
- Center = 'center'¶
- Front = 'front'¶
- class janim.items.geometry.arrow.ArrowTip(body_length: float = 0.2, back_width: float = 0.2, angle: float = 0, scale: float = 1, *, center_anchor: CenterAnchor | Literal['back', 'center', 'front'] = CenterAnchor.Back, rotation: float | None = None, fill_alpha: float = 1.0, stroke_radius: float = 0.005, **kwargs)¶
基类:
VItem箭头标志
body_length: 箭头的宽度back_width: 箭头的长度center_anchor: 原点所处的位置,请参考CenterAnchorrotation: 绕方向轴转动的角度,一般用于 3D 中
- get_center_anchor() ndarray¶
根据设定的
center_anchor得到原点位置, 请参考ArrowTip.CenterAnchor
- property direction: ndarray¶
得到箭头的方向(单位向量)
- property body_length: float¶
得到箭头的长度
- property back_width: float¶
得到箭头的宽度
- rotate_about_anchor(angle: float) Self¶
相对于原点位置进行旋转
- move_anchor_to(pos: ndarray) Self¶
将原点移动到指定位置
- class janim.items.geometry.arrow.Cmpt_VPoints_ArrowImpl(*args, **kwargs)¶
基类:
Cmpt_VPoints_LineImpl,Generic- put_start_and_end_on(start: Vect, end: Vect) Self¶
通过旋转和缩放,使得物件的起点和终点被置于
start和end
- class janim.items.geometry.arrow.Arrow(start: Vect | Points = array([-1., 0., 0.]), end: Vect | Points = array([1., 0., 0.]), *, buff: float = 0.25, max_length_to_tip_length_ratio: float | None = 0.3, tip_kwargs: dict = {}, **kwargs)¶
基类:
Line带箭头的线段,箭头大小自动
buff: 箭头首尾的空余量,默认为0.25max_length_to_tip_length_ratio: 箭头长度和直线长度最大比例
- points¶
- init_tips(tip_kwargs: dict) None¶
- copy(*, root_only=False) Self¶
复制物件
- place_tip() Self¶
- create_text(text: str, place: float = 0.5, *, use_typst_text: bool = False, under: bool = False, buff: float = 0.25, d_place: float = 1e-06, **kwargs)¶
创建文字并与箭头对齐
其中
under参数的含义是:under=False:文字 ----------------->
under=True:-----------------> 文字