当前位置:Gxlcms > html代码 > Animation动作完成后停顿一段时间再次重复_html/css_WEB-ITnose

Animation动作完成后停顿一段时间再次重复_html/css_WEB-ITnose

时间:2021-07-01 10:21:17 帮助过:354人阅读

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);    }

人气教程排行