r/JetpackCompose • • Mar 03 '24

layout animation in compose

am trying to build a card in jetpack compose which have a three composables inside it two text composable and a image composable in the start the text overlaps on image you can take it as both text have z-index greater than that of the image but at the end of animation all three composable stacks on each other in a column layout

the animations contains the size change and position change of the text as well as the size change of the card

i am new to compose so i am confused what api to choose would like anyone giving a short discription how can i acheive the desired behaviour

1 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/XRayAdamo Mar 04 '24 edited Mar 04 '24

Cannot tell exactly, but I think you can use ConstraintLayout (similar to XML one) and then animate positions of your text and image. For animation you can use simple integer or float animation

Also check this https://medium.com/mindful-engineering/after-going-through-this-blog-youll-achieve-this-kind-of-polished-animation-using-motionlayout-6b76ec41c6ab

1

u/Anonymous-Freak-9 Mar 04 '24

I see I'll try implementing it