Friday 15 August 2014

Android: limit rotate animation fps -



Android: limit rotate animation fps -

i have icon, , want rotate time. far good, want limit frame 12fps produce expected effects. how can that?

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);

you can command duration not number of frames generated. if that's needed, can create these 12 frames using software gimp or photoshop, , rotating image hand 12 separate frames. utilize animation drawable (docs here), create separate drawable xml animation , refer separate frames xml. ensure set android:duration frames correctly have each of them shown per 12th part of second.

android android-animation

No comments:

Post a Comment