InterpolationEngine

Handles interpolation of states and individual values.

Constructor

InterpolationEngine(easing_resolver)

Initialize the interpolation engine.

Parameters

easing_resolver
EasingResolver instance for determining easing functions

Methods

compute_changed_fields

compute_changed_fields(
    start_state: State,
    end_state: State,
    attribute_keystates_fields: set
) -> tuple[set, dict[str, tuple[Any, Any]]]

Pre-compute which fields differ between two states.

Returns

Tuple of (set of changed field names, dict of field_name -> (start_val, end_val))

create_eased_state

create_eased_state(
    start_state: State,
    end_state: State,
    t: float,
    segment_easing_overrides: dict[str, Callable[[float], float]] | None,
    attribute_keystates_fields: set,
    vertex_buffer: tuple[list, list[list]] | None = None,
    segment_interpolation_config: dict[str, Callable] | None = None,
    morphing_config: Any | None = None,
    changed_fields: tuple[set, dict[str, tuple[Any, Any]]] | None = None,
    linear_angle_interpolation: bool = False,
    state_interpolation: Optional[Callable] = None
) -> State

Create an interpolated state between two keystates.

Parameters

start_state
Starting state
end_state
Ending state
t
Interpolation parameter (0.0 to 1.0)
segment_easing_overrides
Per-segment easing overrides
attribute_keystates_fields
Attributes managed by field keystates
vertex_buffer
Optional reusable buffer for vertex interpolation
segment_interpolation_config
Optional per-field path config dict {field_name: path_func}
morphing_config
Optional morphing configuration (Morphing or MorphingConfig)
changed_fields
Optional pre-computed (changed_field_names, field_values) tuple
linear_angle_interpolation
If True, rotation uses linear interpolation (no angle wrapping)
state_interpolation
Optional callable (start, end, t) -> State that bypasses all field interpolation

interpolate_value

interpolate_value(
    start_state: State,
    end_state: State,
    field_name: str,
    start_value: Any,
    end_value: Any,
    eased_t: float | tuple[float, float],
    vertex_buffer: tuple[list, list[list]] | None = None,
    segment_interpolation_config: dict[str, Callable] | None = None,
    mapper: Any | None = None,
    vertex_aligner: Any | None = None,
    linear_angle_interpolation: bool = False
) -> Any

Interpolate a single value based on its type and context.