How to remove the slow end of the animation with ObjectAnimator?

android, android-animation, android-view, animation, objectanimator

Solution

The default interpolator is `AccelerateDecelerateInterpolator`, so you will need to set it manually to the `LinearInterpolator`.

animation.setInterpolator(new LinearInterpolator());

Problem

I have this ObjectAnimator: ``` cloudAnim2 = ObjectAnimator.ofFloat(cloud2ImageView, "x",500, 1000); cloudAnim2.setDuration(3000); cloudAnim2.setRepeatCount(ValueAnimator.INFINITE); cloudAnim2.setRepeatMode(ValueAnimator.RESTART); cloudAnim2.start(); cloudAnim2.addListener(new AnimatorListener() { @Override public void onAnimationCancel(Animator animation) {} @Override public void onAnimationEnd(Animator animation) {} @Override public void onAnimationRepeat(Animator animation) {} @Override public void onAnimationStart(Animator animation) {} }); ``` As you can see, the cloud will start of position 500 and will animate to position 1000, and then it will repeat the animation. The problem is that the animation is becoming slower as it is near his finish. I mean, the speed of the movement is not allways the same. I want that the speed becomes allways the same. How can this be done? thanks

Original source