Skip to content

Instantly share code, notes, and snippets.

@jossiwolf
Created April 27, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jossiwolf/b7d4d15dfcac70429646f035d93112dc to your computer and use it in GitHub Desktop.
Save jossiwolf/b7d4d15dfcac70429646f035d93112dc to your computer and use it in GitHub Desktop.
<MotionScene xmlns:motion="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<Transition
motion:constraintSetStart="@id/base_state"
motion:constraintSetEnd="@id/small_button_end"
motion:duration="1000">
<OnSwipe
motion:touchRegionId="@+id/secondButton"
motion:dragDirection="dragRight" />
</Transition>
<Transition
motion:constraintSetStart="@id/base_state"
motion:constraintSetEnd="@id/big_button_end"
motion:duration="1000">
<OnSwipe
motion:touchRegionId="@+id/button"
motion:dragDirection="dragRight" />
</Transition>
<Transition
motion:constraintSetStart="@id/big_button_end"
motion:constraintSetEnd="@id/small_button_end_big_button_end"
motion:duration="1000">
<OnSwipe
motion:touchRegionId="@+id/secondButton"
motion:dragDirection="dragRight" />
</Transition>
<ConstraintSet android:id="@+id/small_button_end_big_button_end" motion:deriveConstraintsFrom="@id/small_button_end" >
<Constraint
android:id="@+id/button"
android:background="@color/colorAccent"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginEnd="8dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/base_state">
<Constraint
android:id="@+id/button"
android:background="@color/colorAccent"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginEnd="8dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@+id/secondButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@color/colorPrimaryDark"
android:layout_marginStart="8dp"
motion:layout_constraintVertical_bias="0.2"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:text="Button2" />
</ConstraintSet>
<ConstraintSet
android:id="@+id/big_button_start"
motion:deriveConstraintsFrom="@id/base_state" />
<ConstraintSet
android:id="@+id/big_button_end"
motion:deriveConstraintsFrom="@id/base_state">
<Constraint
android:id="@+id/button"
android:background="@color/colorAccent"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginEnd="8dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
<ConstraintSet
android:id="@+id/small_button_start"
motion:deriveConstraintsFrom="@id/base_state" />
<ConstraintSet
android:id="@+id/small_button_end"
motion:deriveConstraintsFrom="@id/base_state">
<Constraint
android:id="@+id/secondButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@color/colorPrimaryDark"
android:layout_marginStart="8dp"
motion:layout_constraintVertical_bias="0.2"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
android:text="Button2" />
</ConstraintSet>
</MotionScene>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment