What the recommended way of animating the placemen...
# compose
j
What the recommended way of animating the placement of child
Composables
inside of a custom
Layout {}
? I would like to animate the relative positions of child
Composable
in my custom Scaffold Composable based the offset of an
AnchoredDragState
. Essentially, I would like to slide my nav bar “out of the way” when a sibling
Composable
is dragged. I’ve got a POF working using a
Box
the
Modifier.offset { ... }
on my child
Composables
and hardcoded sizes. I would like to be able to wrap this logic up in a custom
Layout
and not have to rely on individual offset modifiers and hardcoded sizes. Previously, I tried building this by accessing the offset of a AnchoredDraggableState but dragging became erratic. If anyone has any experience with this, any advice would be appreciated.
s
not sure what exactly you are building, but you should be able to just read the offset inside layout {} block and use it when calling .place to interpolate between initial and final positions
j
I want to animate out my navbar when an "anchored" bottom drawer is expanded... In the morning I will rebuild my example using the
Layout
composable and see if I have better luck. I think my previous attempted I accessed the
AnchoredDragState.offset
outside of the
layout {}
block, during the measurement phase.