What’s the best way to trigger an animation when s...
# compose
c
What’s the best way to trigger an animation when something is composed for the first time? Did I miss an animation api The specific use case here is a graph where the bars animate up
a
In such cases i usually do
Copy code
var visible by rememberSaveable { mutableStateOf(false) }

LaunchedEffect(0){
    visible = true
}

AnimatedVisibily(visible = visible){

}
thank you color 1
c
Yeah this is what I’ve got at the moment feels a bit heavy handed
i
That assumes you're using something like
AnimatedContent
or APIs built on top of it like
NavHost
to show your screen though
a
It's better to use
Copy code
val visibleState = remember {
    MutableTransitionState(false).apply { targetState = true }
}
AnimatedVisibility(visibleState = visibleState) { ... }
👍 1
a
Doesn't this method recall animation on configuration change?
a
You can write a saver then.