当前位置: 主页 > 开源代码 >

高仿凤凰新闻的加载效果

分享

介绍:

模仿凤凰新闻的加载。两个圆球旋转缩放。使用Animator属性动画。本例子主要来自
https://github.com/flyme2012/Loading,效果实现主要由new AnimatorSet()
然后通过几个动画ObjectAnimator
AnimatorSet set = new AnimatorSet();
        ObjectAnimator animator = ObjectAnimator.ofFloat(big, "alpha", 0.2f, 1f , 0.2f);
        ObjectAnimator animator2 = ObjectAnimator.ofFloat(small, "alpha", 1f, 0.2f, 1f);
        ObjectAnimator animator3 = ObjectAnimator.ofFloat(view, "rotation", 0, 359);
        ObjectAnimator animator4 = ObjectAnimator.ofFloat(big, "scaleX", 0.2f, 1.4f,0.2f);
        ObjectAnimator animator5 = ObjectAnimator.ofFloat(small, "scaleX", 1.4f, 0.2f,1.4f);
        ObjectAnimator animator6 = ObjectAnimator.ofFloat(big, "scaleY", 0.2f, 1.4f,0.2f);
        ObjectAnimator animator7 = ObjectAnimator.ofFloat(small, "scaleY", 1.4f, 0.2f,1.4f);
        animator.setRepeatCount(Integer.MAX_VALUE);
        animator2.setRepeatCount(Integer.MAX_VALUE);
        animator3.setRepeatCount(Integer.MAX_VALUE);
        animator4.setRepeatCount(Integer.MAX_VALUE);
        animator5.setRepeatCount(Integer.MAX_VALUE);
        animator6.setRepeatCount(Integer.MAX_VALUE);
        animator7.setRepeatCount(Integer.MAX_VALUE);
        animator3.setDuration(10000);
        animator.setDuration(2000);
        animator2.setDuration(2000);
        animator4.setDuration(2000);
        animator5.setDuration(2000);
        animator6.setDuration(2000);
        animator7.setDuration(2000);
        set.setInterpolator(new LinearInterpolator());//不停顿  
        set.play(animator).with(animator2).with(animator3).with(animator4).with(animator5).with(animator6).with(animator7);
        set.start();

实现的android 动画效果。

运行效果: