Is there any way to make a spring animation spec d...
# compose
a
Is there any way to make a spring animation spec do not overshoot, or to make an
AnchoredDraggableState
do not overshoot?
1
j
You could just ignore the overshooting deltas. We respect animation spec overshoot in AnchoredDraggable, but as a consumer of the offset you could
fun AnchoredDraggableState.requireBoundedOffset(): Float = requireOffset().coerceIn(anchors.minAnchor(), anchors.maxAnchor())
👍 1
a
Oh right, that works. Thank you!
j
I'd propose caching minAnchor/maxAnchor so you don't need to perform the lookup every time
👍 1