Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

setDuration doesnt work on AnimatorSet #78

Open
asafkin opened this issue Dec 12, 2014 · 2 comments
Open

setDuration doesnt work on AnimatorSet #78

asafkin opened this issue Dec 12, 2014 · 2 comments

Comments

@asafkin
Copy link

asafkin commented Dec 12, 2014

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
Copy link

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
Copy link

in my phone, it doesn't work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants