Skip to content

Instantly share code, notes, and snippets.

@shkcodes
Created April 4, 2020 10:53
Show Gist options
  • Save shkcodes/a40fc69b63d22b92d5dcb901cff0d1a8 to your computer and use it in GitHub Desktop.
Save shkcodes/a40fc69b63d22b92d5dcb901cff0d1a8 to your computer and use it in GitHub Desktop.
Scene file
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetEnd="@id/state_top"
motion:constraintSetStart="@id/state_mid"
motion:duration="300">
<OnSwipe
motion:dragDirection="dragUp"
motion:maxAcceleration="100"
motion:touchAnchorId="@id/rectangle" />
</Transition>
<Transition
motion:constraintSetEnd="@id/state_bottom"
motion:constraintSetStart="@id/state_mid"
motion:duration="300">
<OnSwipe
motion:dragDirection="dragDown"
motion:maxAcceleration="100"
motion:touchAnchorId="@id/rectangle" />
</Transition>
<ConstraintSet android:id="@+id/state_mid">
<Constraint android:id="@id/rectangle">
<Layout
android:layout_width="0dp"
android:layout_height="200dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</Constraint>
</ConstraintSet>
<ConstraintSet
android:id="@+id/state_top"
motion:deriveConstraintsFrom="@id/state_mid">
<Constraint android:id="@id/rectangle">
<Layout
android:layout_width="0dp"
android:layout_height="200dp"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</Constraint>
</ConstraintSet>
<ConstraintSet
android:id="@+id/state_bottom"
motion:deriveConstraintsFrom="@id/state_mid">
<Constraint android:id="@id/rectangle">
<Layout
android:layout_width="0dp"
android:layout_height="200dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent" />
</Constraint>
</ConstraintSet>
</MotionScene>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment