Pages

Wednesday 11 February 2015

Android animation must know points

This is specially for objection Animator.

- if you have such requirement that in animation one view visibility change to visible and same time other view's gone (For example view flipper) then set default (before animation start) visibility after animation start.

-sometimes I phase following problem . In animator xml if there is rotation and alpha. In xml if I wrote code for rotation and then alpha then alpha is not affecting even if  I have set no offset in alpha.

For ex :

Alpha Not working

 <!-- Rotate. -->
    <objectAnimator
        android:duration="@integer/card_flip_time_half"
        android:interpolator="@android:interpolator/linear"
        android:propertyName="rotationY"
        android:valueFrom="0"
        android:valueTo="90"
        android:startOffset="@integer/resize_time_delay" />

<objectAnimator
        android:duration="0"
        android:propertyName="alpha"
        android:valueFrom="0.0"
        android:valueTo="1.0"
         />


Alpha working


<objectAnimator
        android:duration="0"
        android:propertyName="alpha"
        android:valueFrom="0.0"
        android:valueTo="1.0"
         />

 <!-- Rotate. -->
    <objectAnimator
        android:duration="@integer/card_flip_time_half"
        android:interpolator="@android:interpolator/linear"
        android:propertyName="rotationY"
        android:valueFrom="0"
        android:valueTo="90"
        android:startOffset="@integer/resize_time_delay" />