I have motionLayout
animation with the transition
:
<Transition
app:constraintSetEnd="@+id/end"
app:constraintSetStart="@+id/start">
<OnSwipe
app:dragDirection="dragUp"
app:dragScale="0.1"
app:touchAnchorId="@id/my_scrollview" />
</Transition>
but the animation works too fast for me. I want to slow it down. I tried setting dragScale=0.1, maxAcceleration=1, maxVelocity=1
but it does'n affect the animation speed.
How can I slow it down?
UPDATE: Issue was fixed in newer version of constraintlayout
and seems to be working on "2.0.4"
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:staggered="0.1"
motion:duration="1000">
<OnSwipe
motion:touchAnchorId="@id/view"
motion:dragDirection="dragDown"
motion:maxVelocity="20"
motion:maxAcceleration="20"/>
</Transition>
Short answer: modify duration, touchAnchorId, maxVelocity, maxAcceleration. turning up the velocity and acceleration and down the duration
Long answer
In general there are 2 phases to the animation of an on swipe When you finger is touching the "drag phase" when it is not "fling phase"
So for the above example if you drag to the middle and mouse up it will try to get you to the end within one second first accelerating at 20 (DDp/s2) to max v of 20 (Dp/ds) coast till the time is right such that it decelerates at 20 coming to a stop at the end.
Thinking of it as a car maxVelocity is the top speed. maxAcceleration is the 0-60 time. and duration is how much time you have to get there.
dragScale is a multiplier of the drag to progress calculated in the Drag Phase
I am simplifying many of other details but this is already getting complex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With