Segment

data class Segment<S>(val initialState: S, val targetState: S)

Represents a directional transition segment from initialState to targetState.

Used inside transitionSpec lambdas to select different animation specs based on the direction of a state transition. For example, an expand animation can use a bouncy spring while a collapse uses a quick tween.

transitionSpec = {
when {
false.isTransitioningTo(true) -> spring(stiffness = Stiffness.Low)
true.isTransitioningTo(false) -> tween(200.ms)
else -> spring()
}
}

Constructors

Link copied to clipboard
constructor(initialState: S, targetState: S)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
infix fun S.isTransitioningTo(target: S): Boolean

Returns true if the segment represents a transition from this value to target.