2014-11-06 77 views
1

我有一个图标,并且我希望它始终处于旋转状态。到目前为止非常好,只是我想限制帧为12fps,以便它会产生我预期的效果。我怎样才能做到这一点?Android:极限旋转动画fps

ImageView loadingCircle= (ImageView) getActivity().findViewById(R.id.loading_circle_image);  
    RotateAnimation rotateAnimation = new RotateAnimation(0.0f, 1.0f * 360.0f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 
    rotateAnimation.setDuration(1000); 
    rotateAnimation.setInterpolator(new LinearInterpolator()); 
    rotateAnimation.setRepeatCount(Animation.INFINITE); 
    rotateAnimation.setRepeatMode(Animation.INFINITE); 
    loadingCircle.startAnimation(rotateAnimation); 
+0

你不能这样做,对不起 – pskink 2014-11-06 10:23:53

+0

如果你的动画有点快,那么尝试增加持续时间。你不能玩fps。 – 2014-11-06 11:03:50

回答

1

您可以控制持续时间,但不能控制生成的帧数。如果需要的话,那么你可以使用GIMP或Photoshop等软件自己制作这12帧,然后手动旋转图像得到12个独立的帧。然后使用Animation Drawable(docs here),为您的动画创建单独的可绘制XML并从XML中引用您的单独框架。确保您正确设置了android:duration,以便每个按第12秒的部分显示。