I have some spots, which are buttons, animating vertically from top to the bottom of the screen.
I have implemented the below:
spot.animate().x(x2).y(y2).scaleX(SCALE_X).scaleY(SCALE_Y).setDuration(animationTime).setListener
(
new AnimatorListenerAdapter()
{
@Override
public void onAnimationStart(Animator animation)
{
animators.add(animation);
}
public void onAnimationEnd(Animator animation)
{
animators.remove(animation);
if (!gamePaused )
{
....
}
}
}
);
Question:
I discover that the buttons animating with accelerating speed at the start and decelerating speed upon end of animation.
How could the code be modified with a LinearInterpolator
such that the animation is having uniform speed throughout its journey?
Thanks!!
Did you try to use setInterpolator(TimeInterpolator interpolator) method from ViewPropertyAnimator class? So your code would look like: