Display both sides of a coin flipped using standard Android animation

I'm very close to making the β€œflip coin” animation work, but due to limitations (errors?) In the current animation system, I cannot find a way to show BOTH sides of the coin flipping in the air.

For example, I have the following .XML animation:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"     
     android:shareInterpolator="false">    
        <scale
            android:repeatCount="17"
            android:repeatMode="reverse" 
              android:interpolator="@android:anim/accelerate_decelerate_interpolator"
            android:fromXScale="1.0" android:toXScale="1.0"
            android:fromYScale="1.0" android:toYScale="0.0"
            android:pivotX="50%"     android:pivotY="50%"
            android:fillEnabled="true"
            android:fillAfter="true"
            android:duration="60"
        />      
        <scale
            android:repeatCount="1"
            android:repeatMode="reverse" 
              android:interpolator="@android:anim/accelerate_decelerate_interpolator"
            android:fromXScale="1.0" android:toXScale="2.0"
            android:fromYScale="1.0" android:toYScale="2.0"
            android:pivotX="50%"     android:pivotY="50%"
            android:fillEnabled="true"
            android:fillAfter="true"
            android:duration="800"
        />      
        <translate
            android:repeatCount="1"
            android:repeatMode="reverse" 
            android:interpolator="@android:anim/accelerate_decelerate_interpolator"
            android:fromXDelta="0%"
            android:toXDelta="0%"
            android:fromYDelta="0%"
            android:toYDelta="-150%"
            android:fillEnabled="true"
            android:fillAfter="true"
            android:duration="800" 
        />
</set>

This "fakes" the flipping animation by scaling the coin along the Y axis and flipping it around the loop. Combined with this, there is scale to increase the overall animation, as well as translate it up and down. But it will only show one side of the coin.

, , , - , REPEATCOUNT , AnimationSet. ( ), , .

- , , ?

( ), , , Frame Tween, "" "".

( , - , , , ?)

!

+5

All Articles