Mapper

Abstract base class for M→N mapping strategies.

Mappers determine how items are matched during M→N transitions. Different strategies produce different visual effects: - SimpleMapper: No matching, all old items fade out, all new fade in - GreedyMapper: Match each item to its nearest neighbor - ClusteringMapper: Group nearby items together for balanced matching The mapper receives two lists of items and a position extractor function, and returns a list of Match objects describing how each item should transition.

Constructor

Mapper(args, kwargs)

Methods

map

map(
    start_items: List[T],
    end_items: List[T],
    get_position: Callable[[T], Point2D]
) -> List[Match[T]]

Map items for M→N morphing.

Parameters

start_items
Items at the beginning of the transition
end_items
Items at the end of the transition
get_position
Function to extract position from an item

Returns

List of Match objects describing the transition.