美文网首页
View弹出

View弹出

作者: 玖玖君 | 来源:发表于2019-07-31 22:02 被阅读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;
    }

相关文章

网友评论

      本文标题:View弹出

      本文链接:https://www.haomeiwen.com/subject/ixbxdctx.html