I would like to be able to pan my canvas content w...
# compose
m
I would like to be able to pan my canvas content with some inertia effect. Does compose have any concept or tools to achieve that? Searching for “inertia” in the context of compose did not reveal anything useful. (E.g., JavaFX has this built into gesture handling by default. https://openjfx.io/javadoc/17/javafx.graphics/javafx/scene/input/GestureEvent.html)
a
Do you mean something like this? This is usually called "fling" in Android. You can use a
VelocityTracker
to calculate the velocity when a drag ends, and then use
animateDecay()
with the initial velocity.
m
Yes, that looks like it could be useful. Having the right keywords helps searching 😉