diff options
-rw-r--r-- | core/java/android/animation/AnimatorInflater.java | 5 | ||||
-rw-r--r-- | core/java/android/animation/ObjectAnimator.java | 6 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/animation/AnimatorInflater.java b/core/java/android/animation/AnimatorInflater.java index 021194c..81a01ee 100644 --- a/core/java/android/animation/AnimatorInflater.java +++ b/core/java/android/animation/AnimatorInflater.java @@ -947,6 +947,11 @@ public class AnimatorInflater { Keyframe.ofInt(fraction); } + final int resID = a.getResourceId(R.styleable.Keyframe_interpolator, 0); + if (resID > 0) { + final Interpolator interpolator = AnimationUtils.loadInterpolator(res, theme, resID); + keyframe.setInterpolator(interpolator); + } a.recycle(); return keyframe; diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java index 3f71d51..f933373 100644 --- a/core/java/android/animation/ObjectAnimator.java +++ b/core/java/android/animation/ObjectAnimator.java @@ -50,9 +50,11 @@ import java.lang.ref.WeakReference; * value. Alternatively, you can leave the fractions off and the keyframes will be equally * distributed within the total duration. Also, a keyframe with no value will derive its value * from the target object when the animator starts, just like animators with only one - * value specified.</p> + * value specified. In addition, an optional interpolator can be specified. The interpolator will + * be applied on the interval between the keyframe that the interpolator is set on and the previous + * keyframe. When no interpolator is supplied, the default linear interpolator will be used. </p> * - * {@sample development/samples/ApiDemos/res/anim/object_animator_pvh_kf.xml KeyframeResources} + * {@sample development/samples/ApiDemos/res/anim/object_animator_pvh_kf_interpolated.xml KeyframeResources} * * <div class="special reference"> * <h3>Developer Guides</h3> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index dcb4b9e..43dd013 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -5961,6 +5961,9 @@ <attr name="valueType" /> <attr name="value" /> <attr name="fraction" format="float" /> + <!-- Defines a per-interval interpolator for this keyframe. This interpolator will be used + to interpolate between this keyframe and the previous keyframe.--> + <attr name="interpolator" /> </declare-styleable> <!-- ========================== --> |