pub fn spring<T>(
id: impl Into<TransitionId>,
target: T,
policy: Spring,
window: &mut Window,
cx: &mut App,
) -> T::Outputwhere
T: SpringTarget,Expand description
Returns the current value for a spring travelling toward target.
State is keyed by id exactly as transition keys its own. The first
value is adopted immediately; later target changes preserve both the current
position and the current velocity, so an interrupted spring is redirected
rather than restarted.
Call this while rendering an element, where GPUI keyed element state is available. A channel id must identify one value within that element.