开发者

Android RotateAnimation - rotate arrow back and forth

开发者 https://www.devze.com 2023-03-22 18:48 出处:网络
In my application, I am rotating a clock hand to the开发者_开发问答 desired amount of minutes. This works good with RotateAnimation. Now what I want to do is to return the hand back to the starting po

In my application, I am rotating a clock hand to the开发者_开发问答 desired amount of minutes. This works good with RotateAnimation. Now what I want to do is to return the hand back to the starting position (0 minutes).

For example: I first rotate the hand like this:

final RotateAnimation anim = new RotateAnimation(0f, ammountDegress, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 1f);
anim.setFillAfter(true);
anim.setFillEnabled(true)

Then I would like to move the hand back to it's starting position, so that means I should be calling a RotateAnimation after the first animation ends.

The problem is that the pivots have changed, how I can I set the pivot position to the exact position as previous? So that the rotating point is again at the same position of the clock hand.

Edit To make it more clearer - I would like to have something like a fixed point pivot that doesn't change with the rotation, so I am always rotating the hand around the same point.

I hope you can understand what I mean.

0

精彩评论

暂无评论...
验证码 换一张
取 消