arrow

class janim.items.geometry.arrow.CenterAnchor(*values)

Bases: StrEnum

Options 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: VItem

Arrow tip

  • body_length: Width of the arrow

  • back_width: Length of the arrow

  • center_anchor: Position of the origin, refer to CenterAnchor

  • rotation: 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 to CenterAnchor

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 start and end

class janim.items.geometry.arrow.Arrow(*args, **kwargs)

Bases: Line

Line segment with arrow, arrow size is automatic

  • buff: Buffer space at the arrow’s head and tail, default is 0.25

  • max_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 under parameter is:

under=False:

      Text
----------------->

under=True:

----------------->
      Text
class janim.items.geometry.arrow.Vector(*args, **kwargs)

Bases: Arrow

Arrow with start point at ORIGIN and end point at direction

  • buff is set to 0 by default

class janim.items.geometry.arrow.DoubleArrow(*args, **kwargs)

Bases: Arrow

Double arrow

For parameters, refer to Arrow

init_tips(tip_kwargs: dict) None
copy(*, root_only=False) Self

Copy item

place_tip() Self