Hi, is it possible to use entry/exit animations us...
# compose-wear
f
Hi, is it possible to use entry/exit animations using Compose for Wear OS? I tried to use the
AnimatedVisibility
from
androidx.compose.animation.AnimatedVisibility
but it is not working in my wearable app
j
Yes all of the Compose animation APIs work fine with Compose for Wear OS. There is use of these animations internally in the library. If you provide some more context and ideally a cut down sample with your issue we can take a look
f
Hi @John Nichol Thanks for your quick response. I have two components in a composable. I have two components in a composable. One
Loading
component and a `Content`component. I am using MVVM In the composable I read the value of a state that has a property
isLoading
as follows:
Copy code
var isLoading= viewModel.state.isLoading
So, if the variable
isLoading =true,
I want to show the
Loading
component and I want to animate its entrance. If the
isLoading= false
I want to replace the
Loading
component with the
Content
component in an animated and smooth way. Also, another use case where I want to use Animations is when navigating from one component to another. Similarly as is done in
accompanist-navigation-animation
j
These are normal use cases that work pretty well. What specific problems are you having? If you want an example of animating screens in/out then take a look at the Compose for Wear OS Dialog code https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:wear/com[…]compose/material/dialog/Dialog.android.kt?q=dialog.android.kt