← Back to Compose Animation
Crossfade
Component
in
Compose Animation
. Since 0.1.0-dev15Overview
Code Examples
Crossfade allows to switch between two layouts with a crossfade animation.
Overloads
Crossfade
@OptIn(ExperimentalAnimationApi::class)
@Composable
fun <T> Crossfade(
targetState: T,
modifier: Modifier = Modifier,
animationSpec: FiniteAnimationSpec<Float> = tween(),
label: String = "Crossfade",
content: @Composable (T) -> Unit
)
Parameters
Name | Description |
---|---|
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. |
modifier | Modifier to be applied to the animation container. |
animationSpec | the AnimationSpec to configure the animation. |
label | An optional label to differentiate from other animations in Android Studio |