[Jetpack Compose] AnimatedVisibility 활용해 Animation 처리하기

AnimatedVisiblity


AnimationVisiblity 는 컴포저블이 나타나거나 사라질 때의 애니메이션을 설정할 수 있다.

@Composable
fun ColumnScope.AnimatedVisibility(
    visible: Boolean,
    modifier: Modifier = Modifier,
    enter: EnterTransition = fadeIn() + expandVertically(),
    exit: ExitTransition = fadeOut() + shrinkVertically(),
    label: String = "AnimatedVisibility",
    content: @Composable AnimatedVisibilityScope.() -> Unit
) {
    val transition = updateTransition(visible, label)
    AnimatedEnterExitImpl(transition, { it }, modifier, enter, exit, content)
}

사용예시