Android 动画和动画师安卓
我正在尝试创建一个可以设置动画的片段-翻转/旋转。 我在这里找到了起点:Android 动画和动画师安卓,android,animation,objectanimator,Android,Animation,Objectanimator,我正在尝试创建一个可以设置动画的片段-翻转/旋转。 我在这里找到了起点: 但现在我想要另一个动画-从上到下,但我不明白那些objectAnimator是如何工作的。 从我看到其他动画的工作方式来看,我尝试创建自上而下的动画,如下所示: up_in.xml <set xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Before rotating, immediately set the al
但现在我想要另一个动画-从上到下,但我不明白那些
objectAnimator
是如何工作的。从我看到其他动画的工作方式来看,我尝试创建自上而下的动画,如下所示: up_in.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Before rotating, immediately set the alpha to 0. -->
<objectAnimator
android:valueFrom="1.0"
android:valueTo="0.0"
android:propertyName="alpha"
android:duration="0" />
<!-- Rotate. -->
<objectAnimator
android:valueFrom="-180"
android:valueTo="0"
android:propertyName="rotationX"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="@integer/card_flip_time_full" />
<!-- Half-way through the rotation (see startOffset), set the alpha to 1. -->
<objectAnimator
android:valueFrom="0.0"
android:valueTo="1.0"
android:propertyName="alpha"
android:startOffset="@integer/card_flip_time_half"
android:duration="1" />
</set>
up_out.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Rotate. -->
<objectAnimator
android:valueFrom="0"
android:valueTo="180"
android:propertyName="rotationX"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="@integer/card_flip_time_full" />
<!-- Half-way through the rotation (see startOffset), set the alpha to 0. -->
<objectAnimator
android:valueFrom="1.0"
android:valueTo="0.0"
android:propertyName="alpha"
android:startOffset="@integer/card_flip_time_half"
android:duration="1" />
</set>
我从这个动画中得到的是正确的动作,但是在中间它突然消失了一会儿。
我想了解为什么这不起作用,以及objectAnimator通常是如何工作的