I use the ObjectAnimator API (android.animation.ObjectAnimator) to animate a button once it's clicked (v is the Button):
ObjectAnimator animator = ObjectAnimator.ofFloat(v, "rotationY", 360f);
animator.setDuration(5000);
animator.start();
When I test this on the emulator, it works for the first click (button rotates). But when I click the button again (the fragment is not destroyed etc. after the first click), I don't see any animation on the emulator (the emulator isn't the fastest, but with 5 seconds I should see something).
Do I need to destroy/close something after the first animation or what am I missing? Does anyone have a hint or can reproduce this?
Thanks in advance, Martin
The second time you will try to animate from 360.0f to 360.0f. Change your call to ofFloat() to:
ObjectAnimator.ofFloat(v, "rotationY", 0.0f, 360.0f)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With