Sandy
Sandy

Reputation: 2692

How to invert the acceleration of a Accelerate Interpolator in Android

I'm using 2 animations on a TextView in my app.

The first one completes, then I change the text of the TextView, then I start the second one. I would like to use an Accelerate Interpolator effect on the whole sequence, however if I apply it individually it doesn't work, since the speed will restart on each animation.

I need to invert the animation of the second one, ie. make it start fast and end slow.

Is there any way to do this?

Thanks!

Upvotes: 2

Views: 4037

Answers (1)

ghostbust555
ghostbust555

Reputation: 2049

use a DecelerateInterpolator():

An interpolator where the rate of change starts out quickly and and then decelerates.

i.e.

    animation.setInterpolator(new DecelerateInterpolator());
    animation.setDuration(300L);
    v.startAnimation(animation);

Upvotes: 8

Related Questions