https://kotlinlang.org logo
#compose
Title
# compose
e

Erlan Amanatov

09/24/2021, 6:00 AM
How can I animate the height of a composable to 0.dp on some event, something like
shrinkVertically()
ExitTransition in
AnimatedVisibility
?
d

Daniele Segato

09/24/2021, 8:55 AM
This is how it is implemented in AnimatedVisibility https://github.com/androidx/androidx/blob/5d2c0b74d83a90c8086c2b079524c1bdc94ebf99[…]onMain/kotlin/androidx/compose/animation/EnterExitTransition.kt But I think you don't need all of that and you can either use
Modifier.animateContentSize()
than just change the size of your component or
animateFloatAsState()
and map the 0-1 float to scale / offset
2 Views