I have a set of two animations, both animations run together using the overshoot interpolator
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/overshoot_interpolator" >
<translate
android:duration="6000"
android:fromXDelta="100%" android:toXDelta="0%" />
<scale
android:duration="6000"
android:fromXScale="1.0" android:toXScale="0.6"
android:pivotX="0"
android:fromYScale="1.0" android:toYScale="1.0"
android:repeatCount="1"
android:repeatMode="reverse" />
</set>
I want the translate
animation to overshoot, and the scale
animation to accelerate.
I tried to do this, but it does not work:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:interpolator="@android:anim/overshoot_interpolator"
android:duration="6000"
android:fromXDelta="100%" android:toXDelta="0%" />
<scale
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="6000"
android:fromXScale="1.0" android:toXScale="0.6"
android:pivotX="0"
android:fromYScale="1.0" android:toYScale="1.0"
android:repeatCount="1"
android:repeatMode="reverse" />
</set>
It seems as if only one interpolator can be active at a given time for all animations being performed on a single object.
This is only guess work. I remember that one of
AnimationSet
's constructors can take an argument, namely shareInterpolator.Judging by the name of the parameter, this probably should be set to false in you case. Right now, it should be using the default "value". This default value is most probably true because your animations are not having different interpolators although you specified a different one for each.
To confirm, the source code of AnimationSet has the following line to assign a value for shareInterpolator (from xml):
This clearly means that if this boolean is not specified, it will default to true.
Solution
To fix your problem, I suppose you should specify it using this "R.styleable.AnimationSet_shareInterpolator". This merely means adding
android:shareInterpolator="false"
to your<set>
elementsI put split the animations and put one on an
ImageView
and the other on aRelativeLayout
that was containing the image view.Translator
Scalor
xml
And the source code to instigate it:
I thought it looked pretty good. I'm not sure what effect you were hoping for.