arrow¶
- class janim.items.geometry.arrow.CenterAnchor(*values)¶
Bases:
StrEnumOptions for the position of the arrow origin
Graphical illustration:
.----- | ----- | ----- [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)¶
Bases:
VItemArrow tip
body_length: Width of the arrowback_width: Length of the arrowcenter_anchor: Position of the origin, refer toCenterAnchorrotation: Rotation angle around the direction axis, generally used in 3D
- get_center_anchor() ndarray¶
Get the origin position based on the set
center_anchor, refer toCenterAnchor
- property direction: ndarray¶
Get the direction of the arrow (unit vector)
- property body_length: float¶
Get the length of the arrow
- property back_width: float¶
Get the width of the arrow
- rotate_about_anchor(angle: float) Self¶
Rotate relative to the origin position
- move_anchor_to(pos: ndarray) Self¶
Move the origin to the specified position
- class janim.items.geometry.arrow.Cmpt_VPoints_ArrowImpl(*args, **kwargs)¶
Bases:
Cmpt_VPoints_LineImpl,Generic- put_start_and_end_on(start: Vect, end: Vect) Self¶
Through rotation and scaling, place the item’s start and end points at
startandend
- class janim.items.geometry.arrow.Arrow(*args, **kwargs)¶
Bases:
LineLine segment with arrow, arrow size is automatic
buff: Buffer space at the arrow’s head and tail, default is0.25max_length_to_tip_length_ratio: Maximum ratio of arrow length to line length
- renderer_cls¶
alias of
ArrowRenderer
- points¶
- init_tips(tip_kwargs: dict) None¶
- copy(*, root_only=False) Self¶
Copy item
- 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)¶
Create text and align it with the arrow
The meaning of the
underparameter is:under=False:Text ----------------->
under=True:-----------------> Text