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

Lance Gao

03/18/2022, 2:07 AM
Hi there, how can I show a
Box{}
and start with a fade-in animation?
If not using visibility variable to control, just want the Box{} showing with fade-in animation at the beginning.
i

ildar.i [Android]

03/18/2022, 3:46 AM
You can use AnimatedVisibility
❤️ 2
l

Lance Gao

03/18/2022, 5:41 AM
Thanks, but the delay(500) is necessary? it will make the area blank for 500 ms...
Is there any way to show the Box with animation but without delay?
c

Chris Sinco [G]

03/18/2022, 9:05 AM
Remove the delay in the code above works since LaunchedEffect will run as soon as composition starts
1
You can also use updateTransition and set the initial state that will be animated to as soon as the code enters composition: https://developer.android.com/jetpack/compose/animation#updateTransition
2 Views