2014-11-06 80 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秒的部分顯示。