circle
Functioncircle(
states: list[State],
radius: float = 100,
rotation: float = 0,
center: Point2D = Point2D(x=0, y=0),
clockwise: bool = True,
angles: list[float] | None = None,
alignment: ElementAlignment = <ElementAlignment.PRESERVE: 'preserve'>,
element_rotation_offset: float = 0,
element_rotation_offset_fn: Optional[Callable[[float], float]] = None,
radius_fn: Optional[Callable[[int, float], float]] = None
) -> list[State]
Arrange states in a circular formation.
Positions elements evenly around a circle, or at specific angles if provided.
Parameters
-
states - List of states to arrange.
-
radius - Radius of the circle.
-
rotation - Rotation offset in degrees (0° = top).
-
center - Center point of the circle.
-
clockwise - If True, arrange clockwise; if False, counterclockwise.
-
angles - Optional list of specific angles in degrees for each element. If provided, overrides automatic distribution and clockwise parameter.
-
alignment - How to align each element relative to the circle. PRESERVE keeps original rotation, LAYOUT aligns radially, UPRIGHT starts from vertical position.
-
element_rotation_offset - Additional rotation in degrees added to the alignment base.
-
element_rotation_offset_fn - Function that takes position angle (degrees) and returns rotation offset. If provided, overrides element_rotation_offset.
-
radius_fn - Function that takes (index, default_radius) and returns custom radius.