How can i animate a composable being added in comp...
# compose
v
How can i animate a composable being added in composition? I have a composable inside a LazyColumn Item, I want that composable to animate in when the LazyColumn item is visible on screen
Tried this, but it does not animate
Copy code
AnimatedVisibility(
    visible = 7>0,
    enter = expandHorizontally(animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy)),
    exit = shrinkHorizontally(animationSpec = tween()),
) {
    RepostsLabel(count = 7) {}
}
Also tried with a mutable state
s
For something to animate in it has to first exist in composition but be in the
visible = false
state. Otherwise the first frame it tries to render itself, if it's to be shown immediately it just renders in the visible state immediately.
You can start the state of visibility to be false and immediately turn it to true and you should see the animation play
v
Ohh i see Thanks