android 动画重复间隔,Animation动作完成后停顿一段时间再次重复
animation 周期动作,且中途停顿:publicvoidalwaysWave(){AnimationSetas=newAnimationSet(true);ScaleAnimationsa=newScaleAnimation(1f,ANIMATION_SCALE_MULTIPLE,1f,ANIMATION_SCALE_MULTIPLE,ScaleAnimatio...
animation 周期动作,且中途停顿:
public void alwaysWave() {
AnimationSet as = new AnimationSet(true);
ScaleAnimation sa = new ScaleAnimation(1f, ANIMATION_SCALE_MULTIPLE, 1f, ANIMATION_SCALE_MULTIPLE, ScaleAnimation.RELATIVE_TO_SELF,
0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
sa.setDuration(ANIMATION_EACH_OFFSET * 3);
// sa.setRepeatCount(Animation.INFINITE);// 设置循环
sa.setRepeatCount(1);// 设置循环
sa.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
Logger.i("动画开始");
}
@Override
public void onAnimationEnd(Animation animation) {
Logger.i("动画结束");
postDelayed(new Runnable() {
@Override
public void run() {
alwaysWave();
}
}, 800);
}
@Override
public void onAnimationRepeat(Animation animation) {
Logger.i("动画重复");
}
});
AlphaAnimation aniAlp = new AlphaAnimation(0.8f, 0.1f);
// aniAlp.setRepeatCount(Animation.INFINITE);// 设置循环
aniAlp.setRepeatCount(1);// 设置循环
as.setDuration(ANIMATION_EACH_OFFSET * 3);
as.addAnimation(sa);
as.addAnimation(aniAlp);
bldot.startAnimation(as);
}
更多推荐
所有评论(0)