• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Some questions about ObejctAniamtor.ofFloat()

How i modify the code to realize my goal?

  • not clearly understand ObjectAnimator.ofFloat()

    Votes: 0 0.0%
  • How to stop the RotationAnimation at the last position(setFilterAfter is uneffect)?

    Votes: 0 0.0%

  • Total voters
    0

AndroidDi

Lurker
Dec 4, 2015
1
0
I want to make a custom clock(with hand) page.
The goal is that:when I long press the red button,the hand should rotate with the crossing dot;when I off the button ,the hand stop at the last position,so i use the listener to tell the handler ,update datas.
but now, the hand rotated with dot which is the middle dot of hand,That's not my result.
I use code like next:

ObjectAnimator animator = ObjectAnimator.ofFloat(hand, "rotation", 0F, 360F);
animator.setRepeatCount(ValueAnimator.INFINITE);
animator.setInterpolator(new LinearInterpolator());
animator.setDuration(6000);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@override
public void onAnimationUpdate(ValueAnimator animation) {
float angel = (float) animation.getAnimatedValue("rotation");
Message message = Message.obtain();
Bundle bundle = new Bundle();
bundle.putFloat("value", angel);
message.setData(bundle);
handler.sendMessage(message);
}
});

My Question is :" How i modify the code to realize my goal"?
This is my first question in here,please help me ,Thanks very much !
 

Attachments

  • upload_2015-12-4_17-38-46.png
    upload_2015-12-4_17-38-46.png
    41.6 KB · Views: 83
  • Screenshot_2015-12-03-16-05-02.png
    Screenshot_2015-12-03-16-05-02.png
    41.6 KB · Views: 79

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones