Search code examples
androidanimationdurationlinear-interpolationrotateanimation

Rotate Animation speed


I want my animation to only spin for one rotation. Everytime I adjust the duration it just spins at the same speed for longer/slower. Where am I going wrong?

private static final float ROTATE_FROM = 0.0f;
private static final float ROTATE_TO = -10.0f * 360.0f;
protected RotateAnimation r = new RotateAnimation(ROTATE_FROM, ROTATE_TO,
                                        Animation.RELATIVE_TO_SELF, 0.5f,
                                        Animation.RELATIVE_TO_SELF, 0.5f);
r.setDuration(5000);     
r.setRepeatCount(0);
r.setInterpolator(this, android.R.anim.linear_interpolator);
r.setAnimationListener(AndroidVideoPlayer.this);        
favicon.startAnimation(r);

Solution

  • It was the -10.0f that was the problem!