[英]How to add a delay between animations in AnimatorSet playSequentially()?
I'm using AnimatorSet playSequentially method like this:我正在使用 AnimatorSet playSequentially 方法,如下所示:
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:我想在动画 1 和 2 之间添加一个延迟,如下所示:
set.playSequentially(in,1000,out);
It is possible to add delays between animations using playSequentially method?可以使用 playSequentially 方法在动画之间添加延迟吗?
Thank you.谢谢。
添加这行代码:
out.setStartDelay(1000);
您可以在第二个 Animator 上设置启动延迟(即out.setStartDelay(1000)
),然后再将其添加到集合中。
Rather than setting a start delay on the individual animations, use the AnimatorSet.after(long delay)
function.不是在单个动画上设置开始延迟,而是使用AnimatorSet.after(long delay)
函数。
AnimatorSet s = new AnimatorSet();
s.play(anim1).after(1000).after(anim2);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.