MaterialMotion

fun <S> MaterialMotion(targetState: S, transitionSpec: AnimatedContentTransitionScope<S>.() -> ContentTransform, modifier: Modifier = Modifier, pop: Boolean = false, contentAlignment: Alignment = Alignment.TopStart, label: String = "MaterialMotion", contentKey: (targetState: S) -> Any? = { it }, content: @Composable AnimatedVisibilityScope.(targetState: S) -> Unit)(source)

MaterialMotion allows to switch between two layouts with a material motion animation.

Parameters

targetState

is a key representing your target layout state. Every time you change a key the animation will be triggered. The content called with the old key will be faded out while the content called with the new key will be faded in.

transitionSpec

the ContentTransform to configure the enter/exit animation.

modifier

Modifier to be applied to the animation container.

pop

whether motion contents are rendered in reverse order.

label

An optional label to differentiate from other animations in Android Studio.


fun <S> Transition<S>.MaterialMotion(transitionSpec: AnimatedContentTransitionScope<S>.() -> ContentTransform, modifier: Modifier = Modifier, pop: Boolean = false, contentAlignment: Alignment = Alignment.TopStart, contentKey: (targetState: S) -> Any? = { it }, content: @Composable AnimatedVisibilityScope.(targetState: S) -> Unit)(source)

MaterialMotion allows to switch between two layouts with a material motion animation.

Parameters

transitionSpec

the ContentTransform to configure the enter/exit animation.

modifier

Modifier to be applied to the animation container.

pop

whether motion contents are rendered in reverse order.