如何在AnimatorSet中的动画之间添加延迟playSequentially()?
问题描述:
我使用AnimatorSet playSequentially方法是这样的:如何在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);
我喜欢对子级添加动画1和2之间的延迟,例如:
set.playSequentially(in,1000,out);
,能够添加的动画之间的延迟使用playSequentially方法?
谢谢。
答
加入这行代码:
out.setStartDelay(1000);
答
你可以将它添加到组前设置2号动画(即out.setStartDelay(1000)
)的启动延迟。