animateValue

fun <T> animateValue(typeConverter: TypeConverter<T>, transitionSpec: Segment<S>.() -> FiniteAnimationSpec<T> = { spring() }, label: String = "", targetValueByState: (S) -> T): Value<T>

Animates a value of type T as part of this transition using a custom TypeConverter.

This is the generic form used by animateFloat, animateInt, animateColor, and animateDimen. Use it directly when animating a custom type with your own TypeConverter.

The returned Value is a stable slot handle: the underlying long-lived AnimatedValue is created during commit, not here, so this call performs no shared-state mutation and is safe under concurrent resolves.

Return

A Value containing the current animated value.

Parameters

typeConverter

Converts between T and Float for animation computation.

transitionSpec

Provides the animation spec. Defaults to spring.

label

Optional label for this animation, used for tracing attribution.

targetValueByState

Maps the target state to the target value.