MutableTransform

class MutableTransform(veilMatchParentSize: Boolean = false, offsetVelocityProvider: () -> Point2D.Float? = null, block: TransformScope.(fullSize: Dimension) -> Unit? = null)

How the content of an animated container is transformed during a deferred phase, which a DeferredTransitionState begins with defer and ends with animateTo.

The transition does not advance during that phase, so the container shows what update writes. The block runs again whenever what it reads changes, so drive it directly from the state a gesture writes instead of animating it:

val transform = remember { MutableTransform() }
transform.update { alpha = 1f - progress }

Each value is combined with the transition's value: opacity and scale are multiplied, the offset is added, and the pivot and scrim replace it. A property the block never writes is left to the transition.

When the phase ends in a transition, the enter or exit starts from the last values written here instead of jumping back. A property the running enter or exit declares nothing for keeps its last value until the whole transition has finished. When the phase is abandoned, and the pending state is dropped instead of animated to, the transition animates those values back, and nothing of the phase remains once it finishes.

See also

Constructors

Link copied to clipboard
constructor(veilMatchParentSize: Boolean = false, offsetVelocityProvider: () -> Point2D.Float? = null, block: TransformScope.(fullSize: Dimension) -> Unit? = null)

Functions

Link copied to clipboard
fun update(block: TransformScope.(fullSize: Dimension) -> Unit)

Declares how the content is transformed for as long as the deferred phase lasts.