Android spins clockwise and then spins clockwise back on its axis

How to rotate an image clockwise 10 degrees,

then the image animation stop (at 10 degrees) rotates backward (clockwise) to 0 degrees when repeating?

I just know how to rotate to 10 degrees, but I don't know how to go back to 0 degrees.

Many thanks.

imageview 0 degrees -> 10 degrees -> 0 degrees (repeat)

   RotateAnimation anim = new RotateAnimation(x, y, 10f, 10f);
    anim.setInterpolator(new LinearInterpolator());
    anim.setRepeatCount(Animation.INFINITE);
    anim.setDuration(700);
    imageView.startAnimation(anim);

      

+3


source to share


1 answer


You must set the animation repeat mode.



anim.setRepeatMode(Animation.REVERSE);

      

+4


source







All Articles