to move to a specific point ? I have an image at the top of my screen and an another image at the bottom. I want to translate the top image to the bottom. Iām starting with animation and Iām looking if there is an easy way to do that. I found the
translateY
method but how to get the dp between the top image and the bottom image ?
o
Olivier Patry
03/28/2021, 3:11 PM
There is a modifier, onGloballyPositionned or something like that. You could remember the positions of both views and animate from there
m
mmaillot
03/28/2021, 3:52 PM
Thanks, I have the position of the bottom image š Is it possible to translate an image to a position X/Y ?
t
Tash
03/28/2021, 5:48 PM
Hmm maybe something like
Copy code
val animatedDeltaX = Animatable(0f) // animate to target deltaX
val animatedDeltaY = Animatable(0f) // animate to target deltaY
Image(
modifier = Modifier.graphicsLayer {
translateX = animatedDeltaX.value
translateY = animatedDeltaY.value
}
)