JakeWharton / NineOldAndroids

[DEPRECATED] Android library for using the Honeycomb animation API on all versions of the platform back to 1.0!
http://nineoldandroids.com
Apache License 2.0
4.49k stars 1.53k forks source link

setDuration doesnt work on AnimatorSet #78

Open asafkin opened 9 years ago

asafkin commented 9 years ago

I have created an animation which splits an image horizontaly and translate both parts in opposite 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();

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.

Richard-Cao commented 9 years ago

you can try this:

final AnimatorSet mSetAnim = new AnimatorSet(); final Animator topAnim = ObjectAnimator.ofFloat(topImage, "translationY", (bmp.getHeight() / 2) * -1).setDuration(duration); final Animator bottomAnim = ObjectAnimator.ofFloat(bottomImage, "translationY", bmp.getHeight() / 2).setDuration(duration); mSetAnim.playTogether(topAnim, bottomAnim); mSetAnim.start();

pighead4u commented 8 years ago

in my phone, it doesn't work