Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用运动布局的Android翻转和洗牌动画_Android_Android Animation_Android Motionlayout - Fatal编程技术网

使用运动布局的Android翻转和洗牌动画

使用运动布局的Android翻转和洗牌动画,android,android-animation,android-motionlayout,Android,Android Animation,Android Motionlayout,我想创建一个类似的动画。我能够像预期的那样实现卡片翻转动画及其平滑,但是我无法让这个洗牌动画工作,就像在翻转卡片之后,它们在一个点被收集,然后再次分发。尽管做了几次尝试,我还是无法获得平滑的动画。我的动画路径变成这样 这是我的运动场景文件 <?xml version="1.0" encoding="utf-8"?> <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns

我想创建一个类似的动画。我能够像预期的那样实现卡片翻转动画及其平滑,但是我无法让这个洗牌动画工作,就像在翻转卡片之后,它们在一个点被收集,然后再次分发。尽管做了几次尝试,我还是无法获得平滑的动画。我的动画路径变成这样

这是我的运动场景文件

<?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/end"
        motion:constraintSetStart="@+id/start"
        motion:duration="5000"
        >
        <OnSwipe
            motion:dragDirection="dragRight"
            motion:touchAnchorId="@+id/button"
            motion:touchAnchorSide="right" />

        <KeyFrameSet>

            <KeyPosition
                motion:framePosition="50"
                motion:keyPositionType="parentRelative"
                motion:motionTarget="@+id/button"
                motion:percentY="1" />

            <KeyPosition
                motion:framePosition="70"
                motion:keyPositionType="parentRelative"
                motion:motionTarget="@+id/button"
                motion:pathMotionArc="flip"
                motion:curveFit="spline"
                motion:percentX="-0.1"
                motion:percentY="0.8" />

            <KeyPosition
                motion:framePosition="80"
                motion:keyPositionType="parentRelative"
                motion:motionTarget="@+id/button"
                motion:percentX="0.7"
                motion:percentY="0.7" />


        </KeyFrameSet>
    </Transition>

    <ConstraintSet android:id="@+id/start">
        <Constraint
            android:id="@+id/button"
            android:layout_width="64dp"
            android:layout_height="64dp"
            android:layout_marginStart="8dp"
            motion:layout_constraintBottom_toBottomOf="parent"
            motion:layout_constraintStart_toStartOf="parent"
            motion:layout_constraintTop_toTopOf="parent">
            <CustomAttribute
                motion:attributeName="backgroundColor"
                motion:customColorValue="#D81B60" />
        </Constraint>
    </ConstraintSet>

    <ConstraintSet android:id="@+id/end">
        <Constraint
            android:id="@+id/button"
            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">
            <CustomAttribute
                motion:attributeName="backgroundColor"
                motion:customColorValue="#9999FF" />
        </Constraint>
    </ConstraintSet>

</MotionScene>