AnujAroshA
AnujAroshA

Reputation: 4811

How to reduce the speed of RotateAnimation in Android

How can I reduce the rotation speed of RotateAnimation instance. I'm using following code snippet to do animation.

rotateAnimation = new RotateAnimation(currentRotation, currentRotation + (360 * 5), Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
currentRotation = (currentRotation + (360 * 5));
rotateAnimation.setDuration(10000);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setRepeatCount(Animation.INFINITE);
rotateAnimation.setRepeatMode(Animation.INFINITE);
rotateAnimation.setFillEnabled(true);
rotateAnimation.setFillAfter(true);
rotateAnimation.setAnimationListener(animationInListener);
recordRingImageView.startAnimation(rotateAnimation);

Upvotes: 3

Views: 3865

Answers (2)

Increase its duration since speed = distance/time

rotateAnimation.setDuration(30000);

Upvotes: 8

Daniel L.
Daniel L.

Reputation: 5140

Just increase the duration of the animation. The duration is the time to execute the animation, so if you increase the duration, the animation will take more time to complete, or in other words - the speed of the animation will decrease.

Upvotes: 1

Related Questions