I have the following code which splits an image in half and animate each part in different direction:
final AnimatorSet mSetAnim = new AnimatorSet();
final Animator topAnim = ObjectAnimator.ofFloat(topImage, "translationY", (bmp.getHeight() / 2) * -1);
final Animator bottomAnim = ObjectAnimator.ofFloat(bottomImage, "translationY", bmp.getHeight() / 2);
mSetAnim.setDuration(duration);
mSetAnim.playTogether(topAnim, bottomAnim);
mSetAnim.start();
I'm using NineOldAndroids in order to support old android versions but for some reason no matter what value i put in 'duration' it doesnt seem to have any affect. The animation duration stays the same - half a second more or less.
When i use android's animation apis i can see that the duration is changing.
Any idea how to workarround this ?
Using mSetAnim.getDuration()
, Try printing in a toast to see what value exists at runtime.
Use mSetAnim.setDuration(duration)
; after playTogether()
as is done in nineoldandroids.com.