Reputation: 1426
So I followed the guide towards creating animation in XML. My problem was I had difficulty on flipping it back again upright. Apparently after a scale, the scale resets and what was upside down is now declared upright which I find weird. My solution is below this question.
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:shareInterpolator="true">
<scale
android:duration="1000"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="0.75" />
<set>
<scale
android:duration="1000"
android:fromXScale="1.0"
android:fromYScale="0.75"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
android:toXScale="1.0"
android:toYScale="0" />
<set>
<scale
android:duration="1000"
android:fromXScale="1.0"
android:fromYScale="0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="2000"
android:toXScale="1.0"
android:toYScale="-1.0" />
</set>
</set>
</set>
Upvotes: 0
Views: 1345
Reputation: 1426
Wrong:
fromScaleY="-1.0"
toScaleY="1.0"
Right:
fromScaleY="1.0"
toScaleY="-1.0"
My Solution:
<scale
android:duration="300"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="1"
android:repeatMode="reverse"
android:toXScale="1.0"
android:toYScale="-1.0" />
Upvotes: 2