This fades out the content of the transition, from full opacity to the specified target alpha (i.
FadeTransition
@Composable
fun FadeTransition() {
var visible by remember { mutableStateOf(true) }
AnimatedVisibility(
visible = visible,
enter =
fadeIn(
// Overwrites the initial value of alpha to 0.4f for fade in, 0 by default
initialAlpha = 0.4f
),
exit =
fadeOut(
// Overwrites the default animation with tween
animationSpec = tween(durationMillis = 250)
),
) {
// Content that needs to appear/disappear goes here:
Text("Content to appear/disappear", Modifier.fillMaxWidth().requiredHeight(200.dp))
}
}