6

I'm using AnimatorSet playSequentially method like this:

AnimatorSet set = new AnimatorSet();
ObjectAnimator in = ObjectAnimator.ofFloat(splash, "alpha", 0f, 1f);
in.setDuration(2500);
in.setInterpolator(new AccelerateInterpolator());
ObjectAnimator out = ObjectAnimator.ofFloat(splash, "alpha", 1f, 0f);
out.setDuration(2500);
out.setInterpolator(new AccelerateInterpolator());

set.playSequentially(in,out);

I whould like to add a delay between animation 1 and 2, like this:

set.playSequentially(in,1000,out);

It is possible to add delays between animations using playSequentially method?

Thank you.

NullPointerException
  • 36,107
  • 79
  • 222
  • 382

3 Answers3

7

Add this line of code:

    out.setStartDelay(1000);
kris larson
  • 30,387
  • 5
  • 62
  • 74
1

You could set a start delay on the 2nd Animator (i.e. out.setStartDelay(1000)) before adding it to the set.

Doris Liu
  • 807
  • 5
  • 9
0

Rather than setting a start delay on the individual animations, use the AnimatorSet.after(long delay) function.

AnimatorSet s = new AnimatorSet();
s.play(anim1).after(1000).after(anim2);

AnimatorSet.Builder