I want to change first layout_marginStart while layout_marginStart should not change until frame 60. However following keyframes are ignored and both margins animates at same time.
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
app:constraintSetEnd="@+id/end"
app:constraintSetStart="@+id/start"
>
<OnSwipe
app:dragDirection="dragUp"
app:touchAnchorId="@id/scrollable"
app:touchAnchorSide="top" />
<KeyFrameSet>
<KeyAttribute
app:curveFit="linear"
app:framePosition="10"
app:motionTarget="@+id/text">
<CustomAttribute
app:attributeName="layoutMarginStart"
app:customDimension="68dip" />
</KeyAttribute>
<KeyAttribute
app:curveFit="linear"
app:framePosition="60"
app:motionTarget="@+id/text">
<CustomAttribute
app:attributeName="layoutMarginEnd"
app:customDimension="0dip" />
</KeyAttribute>
</KeyFrameSet>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/text"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginStart="16dip"
android:layout_marginTop="24dip"
android:layout_marginEnd="16dip"
android:layout_marginBottom="12dip"
android:background="#BEBEBE"
app:layout_constraintEnd_toEndOf="@+id/parent"
app:layout_constraintStart_toStartOf="@+id/parent"
app:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/text"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginStart="60dip"
android:layout_marginTop="24dip"
android:layout_marginEnd="60dip"
android:layout_marginBottom="12dip"
android:background="#BEBEBE"
app:layout_constraintEnd_toEndOf="@+id/parent"
app:layout_constraintStart_toStartOf="@+id/parent"
app:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
</Transition>
</MotionScene>
from How to control margin with keyframe?
No comments:
Post a Comment