@Composable
fun Scale() {
var visible by remember { mutableStateOf(true) }
Column(horizontalAlignment = Alignment.Start) {
Button(onClick = { visible = !visible }) {
Text(text = if (visible) "Hide" else "Show")
}
Spacer(modifier = Modifier.height(20.dp))
AnimatedVisibility(visible = visible,
enter = scaleIn(animationSpec= tween(2000)),
exit = scaleOut(animationSpec = tween(2000))
) {
Box(
modifier = Modifier
.size(1000.dp)
.background(Color.Blue),
contentAlignment = Alignment.Center
) {
Text(text = "Hello", color = Color.White)
}
}
}
}
05-07