Byte0: MotionLayout & snaping

I recently started to use MotionLayout in a more extensive way in one of the apps I’m working on.

One of the issues I faced was that once I released my finger from the view the snapping animation was too slow and I needed it to be way faster.

It’s not very intuitive, but in order to control the speed at which the layout snaps, you have to use the maxAcceleration attribute on the onTouch tag of your transition code block:

From the docs, what the maxAcceleration does is it defines how quickly the animation will accelerate or decelerate. By default, the value is 1.2




Leave a Comment

Blog

Recent posts