spiral_between_radii
Functionspiral_between_radii(
states: list[State],
center: Point2D,
start_radius: float = 50,
end_radius: float = 200,
rotation: float = 0,
clockwise: bool = False,
alignment: ElementAlignment = <ElementAlignment.PRESERVE: 'preserve'>,
element_rotation_offset: float = 0,
element_rotation_offset_fn: Optional[Callable[[float], float]] = None
) -> list[State]
Arrange states in a spiral from start radius to end radius.
Alternative specification to spiral() for users who think in terms of target end radius rather than radius step. The spiral will grow/shrink to reach the specified end radius.
Parameters
-
states - List of states to arrange
-
cx - X coordinate of spiral center
-
cy - Y coordinate of spiral center
-
start_radius - Radius for first element
-
end_radius - Radius for last element
-
rotation - Base rotation offset in degrees
-
clockwise - If True, spiral clockwise; if False, counterclockwise
-
alignment - How to align each element
-
element_rotation_offset - Additional rotation offset
-
element_rotation_offset_fn - Function(angle) -> rotation offset
Returns
New list of states with spiral positions
Examples
# Spiral outward from 50 to 200
spiral_between_radii(states, start_radius=50, end_radius=200)
# Spiral inward (negative step)
spiral_between_radii(states, start_radius=200, end_radius=50)
# Equivalent to spiral():
# spiral_between_radii(states, start_radius=50, end_radius=200) with 5 states
# == spiral(states, start_radius=50, radius_step=37.5) with 5 states