VertexState

Base state for vertex-based morphable shapes with multi-contour support

All vertex shapes share: - num_vertices: Resolution (number of vertices for outer contour) - closed: Whether the shape is closed (affects fill rendering) - fill_color: Fill color (works for both open and closed shapes, Manim-style) - stroke_color: Outline color - stroke_width: Outline width - _aligned_contours: Internal field for preprocessed alignment (don't set manually) For open shapes (lines), fill_color creates a "ghost" closing edge for fill area without drawing the closing line. This allows smooth fill fade-in during morphing. For shapes with vertex_loops : - vertex loops are rendered using SVG masks (not evenodd fill-rule) - Hole strokes need 2x width since mask cuts through middle Subclasses override _generate_contours() to define their geometry. The get_contours() method automatically uses aligned contours if available.

Constructor

VertexState(
    pos: Point2D | None = None,
    scale: float | None = None,
    opacity: float | None = None,
    rotation: float | None = None,
    skew_x: float | None = None,
    skew_y: float | None = None,
    z_index: float = 0.0,
    clip_state: State | None = None,
    mask_state: State | None = None,
    clip_states: list[State] | None = None,
    mask_states: list[State] | None = None,
    filter: Filter | None = None,
    NON_INTERPOLATABLE_FIELDS: frozenset[str] = frozenset({'NON_INTERPOLATABLE_FIELDS'}),
    fill_color: Color | None = Color.NONE,
    fill_opacity: float = 1,
    fill_gradient: Gradient | None = None,
    fill_pattern: Pattern | None = None,
    stroke_color: Color | None = Color.NONE,
    stroke_opacity: float = 1,
    stroke_width: float = 1,
    stroke_gradient: Gradient | None = None,
    stroke_pattern: Pattern | None = None,
    non_scaling_stroke: bool = False,
    closed: bool = True,
    _num_vertices: int | None = None,
    _aligned_contours: VertexContours | None = None
) -> None

Methods

get_contours

get_contours()

Get contours for this shape

get_renderer_class

get_renderer_class()

Get the renderer class for this state.

Returns

The renderer class for this state, or None if not registered

get_vertex_renderer_class

get_vertex_renderer_class()

Get the renderer for morphing transitions (0 < t < 1)

Returns

VertexRenderer class for morphing

get_vertices

get_vertices()

Get outer contour vertices (backwards compatibility)

is_angle

is_angle(field: Field) -> bool

need_morph

need_morph(state)

with_x

with_x(x: float) -> State

with_y

with_y(y: float) -> State

Properties

x
y