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

Shivam Sethi

03/09/2021, 4:38 AM
Let's say a composable is about to enter/added to the tree how can I animate it's enter transition ? Is there something similar to .transition modifier like swiftUI ?
d

Doris Liu

03/09/2021, 5:17 AM
AnimatedVisibility: https://developer.android.com/jetpack/compose/animation The video on top of the page would help if you are not familiar with the content on that page. 🙂
s

Shakil Karim

03/09/2021, 6:37 AM
@Doris Liu Is there any example of z index animation + Slide in/Slide out when transition from one screen to another like IOS have?
d

Doris Liu

03/09/2021, 6:42 AM
@Shakil Karim screen level enter/exit animations are ongoing work. 😄 Though I'm very curious about the z index animation that you are referring to. Could you share a demo of that?
s

Shakil Karim

03/09/2021, 6:50 AM
@Doris Liu Sorry, I meant parallax effect like in this video
d

Doris Liu

03/09/2021, 6:56 AM
I see. The exiting screen slides out slower than the entering one. That should be doable if we support independent enter/exit transition for each screen. 🙂 Thanks for sharing! 🙏
👍 1
s

Shivam Sethi

03/09/2021, 7:21 AM
Thanks for these references😄
👍 1
Okay, I tried animated visibility, it is not working. All I want it just animate enter transition on a composable?
d

Doris Liu

03/11/2021, 4:42 AM
Can you share a code snippet?
You'll probably need to do something like
AnimatedVisibility(visible = true, initiallyVisible = false)
to just show an enter transition. 🙂
s

Shivam Sethi

03/11/2021, 4:58 AM
hmm, I am doing exactly this but this results in not showing anything to the screen
d

Doris Liu

03/11/2021, 4:59 AM
Does the composable show up without being wrapped in
AnimatedVisibility
?
s

Shivam Sethi

03/11/2021, 5:04 AM
yes, but when I wrap it, then nothing shows up
here is the code screenshot for that composable that I want to animate transition
d

Doris Liu

03/11/2021, 5:08 AM
That looks correct. Is this
AnimatedVisiblity
happen to be nested in another
AnimatedVisibility
? Are you using emulator or studio preview?
s

Shivam Sethi

03/11/2021, 5:20 AM
I am using physical android device, and no it is not nested in another
AnimatedVisibility
Its top level composable
HomeScree
just initializes a
viewModel
and pass the desired data down to this composable ?
d

Doris Liu

03/11/2021, 5:21 AM
What version of compose are you using, beta01, beta02?
s

Shivam Sethi

03/11/2021, 5:25 AM
just updated to beta02
d

Doris Liu

03/11/2021, 5:35 AM
If you could isolate the issue in a minimal repro case, I'm happy to take a look. 🙂
💯 1
s

Shivam Sethi

03/11/2021, 5:48 AM
I probably will not be able to do that currently, but will try later on. thank you very much for answering by the way.
👍 1
would you recommend something like this for time being, as replacement for
AnimatedVisibility
for enter transition ?
d

Doris Liu

03/11/2021, 7:21 AM
If that works for you, it's a valid option. 🙂
s

Shivam Sethi

03/11/2021, 6:12 PM
Thanks, yes it works just thought If it would be valid to do like this.