View弹出

2019-07-31  本文已影响0人  玖玖君
 //view的弹出动画,首先是将view移动至其该所在的位置,其次是大小以及 透明度的变化了
    private AnimatorSet doAnimOpenItem(View view, int index) {
        float distance = index * ITEM_DISTANCE;
        AnimatorSet animatorSet = new AnimatorSet ();                         //透明度
        animatorSet.play (                                                   //0
                ObjectAnimator.ofFloat (view, "alpha", 10, 10))
                .with (ObjectAnimator.ofFloat (view, "scaleX", 1, 1))//大小
                .with (ObjectAnimator.ofFloat (view, "scaleY", 1, 1))//大小
                .after (ObjectAnimator.ofFloat (view, "translationY", 520, -390, distance));//动画平移距离
        //设置的延时时间恰好是在前一个动画执行结束前 后一个动画就开始执行,给人一种连贯的感觉
        animatorSet.setStartDelay (index * 1);
        animatorSet.setDuration (2200);//动画执行大小
        return animatorSet;
    }
上一篇 下一篇

猜你喜欢

热点阅读