MotionScope


@ExperimentalMotionApi
@MotionDslScope
class MotionScope : LookaheadLayoutScope


Scope for the Motion Composable.

Use Modifier.motion to enable animations on layout changes for Composables defined within this scope.

Summary

Public constructors

MotionScope(lookaheadLayoutScope: LookaheadLayoutScope)

Public functions

Unit

Emit the content of every Composable within the list.

Modifier
Modifier.motion(
    animationSpec: AnimationSpec<Float>,
    ignoreAxisChanges: Boolean,
    motionDescription: MotionModifierScope.() -> Unit
)

Animate layout changes.

Inherited functions

From androidx.compose.ui.layout.LookaheadLayoutScope
open Modifier
Modifier.intermediateLayout(
    measure: MeasureScope.(measurable: Measurable, constraints: Constraints, lookaheadSize: IntSize) -> MeasureResult
)

Creates an intermediate layout based on target size of the child layout calculated in the lookahead.

open Modifier
Modifier.onPlaced(
    onPlaced: (lookaheadScopeCoordinates: LookaheadLayoutCoordinates, layoutCoordinates: LookaheadLayoutCoordinates) -> Unit
)

onPlaced gets invoked after the parent LayoutModifier has been placed and before child LayoutModifier is placed.

Public constructors

MotionScope

MotionScope(lookaheadLayoutScope: LookaheadLayoutScope)

Public functions

emit

@Composable
fun List<@Composable MotionScope.(index: Int) -> Unit>.emit(): Unit

Emit the content of every Composable within the list.

motion

fun Modifier.motion(
    animationSpec: AnimationSpec<Float> = spring(),
    ignoreAxisChanges: Boolean = false,
    motionDescription: MotionModifierScope.() -> Unit = {}
): Modifier

Animate layout changes.

The duration and easing of the animation is defined by animationSpec. Note that this AnimationSpec will be used to drive a progress value from 0 to 1.

Set ignoreAxisChanges to true to prevent triggering animations when the Composable is being scrolled either vertically or horizontally.