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).
Manual transformations defined in this object are combined with (i.e., applied on top of) the transition's current visual state. During the deferred phase, the transition's state is held at its initial value.
Visual properties in TransformScope (like TransformScope.alpha and TransformScope.scale) are applied multiplicatively to the transition's values, while TransformScope.offset is applied additively. For example, if the transition's initial alpha is 0.5 and the manual alpha is set to 0.5, the resulting visual alpha will be 0.25. Properties that are not manually set in the update block default to the transition's value.
Properties in TransformScope are set directly and reflect the manual value for the current frame. They do not automatically animate between values; instead, they should be updated continuously (e.g., in response to gesture progress) to create a smooth manual animation.
The update 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 handed off to the automatic transition animation when the deferred phase ends.
Summary
Public constructors |
|
|---|---|
MutableTransform( |
Cmn
|
Public functions |
||
|---|---|---|
Unit |
update(block: TransformScope.(fullSize: IntSize) -> Unit)Define the manual transformation to apply during the deferred phase. |
Cmn
|
Public constructors
MutableTransform
MutableTransform(
veilMatchParentSize: Boolean = false,
offsetVelocityProvider: (() -> Offset)? = null,
block: (TransformScope.(fullSize: IntSize) -> Unit)? = null
)
| Parameters | |
|---|---|
veilMatchParentSize: Boolean = false |
Whether the veil should match the size of the parent. |
offsetVelocityProvider: (() -> Offset)? = null |
The velocity of the offset change in pixels/sec. The |
block: (TransformScope.(fullSize: IntSize) -> Unit)? = null |
A lambda that applies transformations to the provided |
Public functions
update
fun update(block: TransformScope.(fullSize: IntSize) -> Unit): Unit
Define the manual transformation to apply during the deferred phase.
| Parameters | |
|---|---|
block: TransformScope.(fullSize: IntSize) -> Unit |
A lambda that applies transformations to the provided |