arc_swap_positions
Functionarc_swap_positions(
state_1: State,
state_2: State,
t_start: float,
t_end: float,
clockwise: bool = True,
arc_radius: Optional[float] = None,
easing: Optional[Dict[str, Callable[[float], float]]] = None
) -> Tuple[List[KeyState], List[KeyState]]
Swaps the positions of two elements along arc paths.
Both elements travel along parallel arcs in the same direction to avoid collision. The arc radius must be at least half the distance between points.
Parameters
-
state_1 - The base State of the first element.
-
state_2 - The base State of the second element.
-
t_start - Start time of the swap.
-
t_end - End time of the swap.
-
clockwise - Arc direction (default True).
-
arc_radius - Arc radius. If None, defaults to distance between points.
-
easing - Optional easing dict for position transitions.
Returns
Tuple of (keystates_for_elem1, keystates_for_elem2)
Examples
ks1, ks2 = arc_swap_positions(circle1, square2, t_start=0.3, t_end=0.8)
elem1 = VElement().segment(ks1)
elem2 = VElement().segment(ks2)