Compose Unstyled 2.0 is out! Check the official announcement blog ->
Class

MutableTransform

An object that allows manual manipulation of the visual transformations (alpha, scale, offset, etc.) of content during the deferred phase (initiated by DeferredTransitionState.defer) of a DeferredTransition (e.g., for predictive back gestures).

Source set: Common
@ExperimentalDeferredTransitionApi
public class MutableTransform(
    internal var veilMatchParentSize: Boolean = false,
    internal var offsetVelocityProvider: (() -> Offset)? = null,
    internal var block: (TransformScope.(fullSize: IntSize) -> Unit)? = null,
)

An object that allows manual manipulation of the visual transformations (alpha, scale, offset, etc.) of content during the deferred phase (initiated by DeferredTransitionState.defer) of a DeferredTransition (e.g., for predictive back gestures).

Manual transformations defined in this object are applied on top of the transition's initial state.

This object provides an invoke operator that accepts a TransformScope lambda. This lambda is evaluated repeatedly to ensure that state reads (e.g., from gesture progress) are deferred to the layout phase, preventing unnecessary composition churn while keeping Draw-phase operations performant.

Values set in this object are seamlessly handed off to the automatic transition animation when the deferred phase ends.

Parameters

veilMatchParentSize Whether the veil should match the size of the parent.
offsetVelocityProvider The velocity of the offset change in pixels/sec. The offsetVelocityProvider lambda is evaluated exactly once when the deferred phase ends to ensure a seamless handoff to the automatic transition.
block A lambda that applies transformations to the provided TransformScope. This block executes dynamically to reflect state changes.

Functions

invoke

public operator fun invoke(block: TransformScope.(fullSize: IntSize) -> Unit)

Define the manual transformation to apply during the deferred phase.

Parameters

block A lambda that applies transformations to the provided TransformScope. This block executes dynamically to reflect state changes.

Last updated: