Can you have multiple interpolators on a single view when using ViewPropertyAnimator?

Posted by steven on Stack Overflow See other posts from Stack Overflow or by steven
Published on 2014-08-20T16:18:05Z Indexed on 2014/08/20 16:20 UTC
Read the original article Hit count: 151

Filed under:
|

For example, I would like to animate a view such that it moves down in the y direction while decelerating, and at the same time it undergoes an alpha change linearly.

The code would look something like this:

myView.animate().translationY(100).setDuration(1000).setInterpolator(new DecelerateInterpolator());
myView.animate().alpha(1).setDuration(1000).setInterpolator(new LinearInterpolator());

This does not work of course because the LinearInterpolator overwrites the DecelerateInterpolator. Is there a way to have one interpolator for the translation part of the animation and a different interpolator for the alpha part?

I am aware that this can be accomplished using ObjectAnimator or an AnimationSet, but my question is about whether it can be done using the much cleaner ViewPropertyAnimator.

© Stack Overflow or respective owner

Related posts about android

Related posts about animation