vitem

class janim.items.vitem.VItem(*points: Vect, fill_alpha=0, **kwargs)

Bases: Points

Bezier curve spliced item, for details refer to the documentation of Cmpt_VPoints

points
radius
stroke
fill
glow
color
renderer_cls

alias of VItemRenderer

init_connect() None
apply_style(stroke_radius: float | Iterable[float] | None = None, stroke_color: JAnimColor | ColorArray | None = None, stroke_alpha: Alpha | AlphaArray | None = None, stroke_background: bool | None = None, fill_color: JAnimColor | ColorArray | None = None, fill_alpha: Alpha | AlphaArray | None = None, color: JAnimColor | ColorArray | None = None, alpha: Alpha | AlphaArray | None = None, glow_color: JAnimColor | None = None, glow_alpha: Alpha | None = None, glow_size: float | None = None, shade_in_3d: bool | None = None, **kwargs) Self

Sets the style of the item itself, does not affect child items

See also: set()

set_stroke_background(flag: bool = True, *, root_only: bool = False) Self

Adjusts the drawing order of stroke and fill

flag=True makes the stroke covered by fill, flag=False makes the fill covered by stroke

shade_in_3d(flag: bool = True, *, root_only: bool = False) Self

Toggle 3D shading

When enabled, the color intensity is adjusted based on the position relative to the light source (timeline’s self.light_source)

add_tip(at_alpha: float = 1.0, reverse: bool = False, angle: float | None = None, colorize: bool = True, fill_color: JAnimColor | None = None, stroke_color: JAnimColor | None = None, color: JAnimColor | None = None, d_alpha: float = 1e-06, **tip_kwargs)

Create an arrow at at_alpha

  • By default, the arrow points in the same direction as the path; if reverse=True is passed, it points in the opposite direction

  • If colorize=True is passed (default), the arrow’s color will match the path’s color

  • For other parameters, refer to ArrowTip

classmethod align_for_interpolate(item1: VItem, item2: VItem) AlignedData[Self]

Performs data alignment for interpolation

class janim.items.vitem.DashedVItem(vitem: VItem, num_dashes: int = 15, *, dashed_ratio: float = 0.5, dash_offset: float = 0, equal_lengths: Literal['equal', 'approx', 'none'] = 'approx', stroke_color: JAnimColor | ColorArray | None = None, stroke_alpha: Alpha | AlphaArray | None = None, stroke_radius: float | Iterable[float] | None = None, **kwargs)

Bases: VItem, Group[VItem]

Create a dashed version of the passed vitem, specified by the number of dash segments

Parameters:
  • num_dashes – Number of dash segments

  • dashed_ratio – Ratio of dash segments; the remaining ratio is the gap segments

  • dash_offset – Ratio to offset the starting point of dash segments along the path, e.g., 1 means offset by one dash segment length

  • equal_lengths – Whether dash segment lengths are equal, values are 'equal', 'approx', or 'none' - 'equal': Dash segment lengths are almost equal - 'approx': Default, dash segment lengths are approximately equal - 'none': Dash segments will be evenly distributed according to the curve parameter t, generally lengths are not equal

static get_dashed_list(points: ndarray, num_dashes: int = 15, dashed_ratio: float = 0.5, dash_offset: float = 0, equal_lengths: Literal['equal', 'approx', 'none'] = 'approx') list[VItem]

Splits the path represented by points, returns a list containing each dash segment

static get_dashed_list_by_starts_and_ends(points: ndarray, dash_starts: list[float], dash_ends: list[float], equal_lengths: Literal['equal', 'approx', 'none'] = 'approx') list[VItem]
class janim.items.vitem.DashedVItemByRatio(vitem: VItem, dash_ratio: float = 0.03333333333333333, *, dashed_ratio: float = 0.5, equal_lengths: Literal['equal', 'approx', 'none'] = 'approx', stroke_color: JAnimColor | ColorArray | None = None, stroke_alpha: Alpha | AlphaArray | None = None, stroke_radius: float | Iterable[float] | None = None, **kwargs)

Bases: VItem, Group[VItem]

Create a dashed version of the passed vitem, specified by the length ratio of dash segments

Parameters:
  • dash_ratio – Ratio of each dash segment to the total path length, e.g., 1/30 means each dash occupies 1/30 of the path

  • dashed_ratio – Ratio of dash segments; the remaining ratio is the gap segments

  • equal_lengths – Whether dash segment lengths are equal, values are 'equal', 'approx', or 'none' - 'equal': Dash segment lengths are almost equal - 'approx': Default, dash segment lengths are approximately equal - 'none': Dash segments will be evenly distributed according to the curve parameter t, generally lengths are not equal

static get_dashed_list(points: ndarray, dash_ratio: float = 0.03333333333333333, dashed_ratio: float = 0.5, equal_lengths: Literal['equal', 'approx', 'none'] = 'approx') list[VItem]