Add sample code for specifying per-keyframe interpolator in xml

Depend on ag/667176
Bug: 19913234

Change-Id: Iaf4160646a972dcc9fd1d885f1ffc0cd68a3b6ac
This commit is contained in:
Doris Liu
2015-04-02 16:25:05 -07:00
parent edcf97efa7
commit 2ef936dbae
3 changed files with 53 additions and 4 deletions

View File

@@ -81,6 +81,7 @@ public class AnimationLoading extends Activity {
addBall(650, 50);
addBall(800, 50);
addBall(950, 50);
addBall(800, 50, Color.YELLOW);
}
private void createAnimation() {
@@ -126,9 +127,19 @@ public class AnimationLoading extends Activity {
}
});
// This animation has an accelerate interpolator applied on each
// keyframe interval. In comparison, the animation defined in
// R.anim.object_animator_pvh_kf uses the default linear interpolator
// throughout the animation. As these two animations use the
// exact same path, the effect of the per-keyframe interpolator
// has been made obvious.
ObjectAnimator animPvhKfInterpolated = (ObjectAnimator) AnimatorInflater.
loadAnimator(appContext, R.anim.object_animator_pvh_kf_interpolated);
animPvhKfInterpolated.setTarget(balls.get(7));
animation = new AnimatorSet();
((AnimatorSet) animation).playTogether(anim, fader, seq, colorizer, animPvh,
animPvhKf, faderKf);
animPvhKf, faderKf, animPvhKfInterpolated);
}
}