NineOldAndroids icon indicating copy to clipboard operation
NineOldAndroids copied to clipboard

setDuration doesnt work on AnimatorSet

Open asafkin opened this issue 11 years ago • 2 comments

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.

asafkin avatar Dec 12 '14 14:12 asafkin

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();

Richard-Cao avatar Jan 10 '15 07:01 Richard-Cao

in my phone, it doesn't work

pighead4u avatar Apr 25 '16 12:04 pighead4u