MotionLayout multi state transition is not smooth

1.1k Views Asked by At

I have three states A, B, C.

With OnSwipe I go from A to B and then with another OnSwipe from B to C.

The directions of the swipes are the same. So, continuous dragging from state A should eventually go to state C.

enter image description here

The problem I face is transition is not smooth. There is a stop at the end of the first transition. Sometimes it works smoothly when I drag fast(?). But generally, there is a freeze in the middle of two transitions.

Is there any way to get rid of this freeze?

For reference, I am just testing samples given by Google team. Two transitions are given as below

    <Transition
        motion:constraintSetStart="@id/base_state"
        motion:constraintSetEnd="@id/half_people"
        motion:duration="3000">
        <OnSwipe
            motion:dragDirection="dragRight"
            motion:touchAnchorId="@id/people_pad"
            motion:touchAnchorSide="right" />
    </Transition>

    <Transition
        motion:constraintSetStart="@id/half_people"
        motion:constraintSetEnd="@id/people"
        motion:duration="3000">
        <OnSwipe
            motion:dragDirection="dragRight"
            motion:touchAnchorId="@id/people_pad"
            motion:touchAnchorSide="right" />
    </Transition>
1

There are 1 best solutions below

0
On BEST ANSWER

Short answer no but you might try adjusting the motion:dragThreshold in onswipe.

Long answer at B it evaluates that there is another transition that can loads that transition.

  1. The switching transitions is computationally expensive.
  • The constraintSets need to be evaluated by constraint layout.
  • Monotonic splines for all objects that move need to be built.
  1. There is a delay to ensure the drag is in the same direction.

Long term we hope to build a TransitionSet that chains the transitions. So there is no logical break. Medium term we are considering adding "click stops" to Transitions. So you build out of one transition and it travels to that stop.