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

Roudy Korkis Kanaan

01/16/2022, 6:54 AM
What would be a good way to determine the final position of an element that is mid transition? I'm working on shared elements for my lib and currently this is the only thing that's missing. If you have 2 screens being animated, the shared transition element needs to animate between the initial pos from first screen (which is fine) but the final pos of the element of the 2nd screen which keeps changing (using
onGloballyPositioned
and I can denounce by a bit till it stops changing but that will delay the transition animation of the shared element itself which is not the expected behaviour. So basically is there a way to know if the position of a composable is not final and what would be its final position or would I have to know the transition and based on the animation properties calculate the final position of the element? Or am I going the wrong direction anyway haha
z

Zach Klippenstein (he/him) [MOD]

01/16/2022, 6:58 AM
I think you're talking about what we've been calling “speculative layout”, and I don't think there's a good way to do that right now. But stay tuned 😉
r

Roudy Korkis Kanaan

01/16/2022, 6:59 AM
Thanks for the quick response Zack! I guess I will delay this piece of work till that is worked on. 😊
3 Views