SlideButton.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:AndroidButtonLib 作者:
private void startLightAnimation() {

        if (mLightAnimation == null) {

            mLightAnimation = ObjectAnimator.ofFloat(10, getMeasuredWidth());
            mLightAnimation.setRepeatCount(ValueAnimator.INFINITE);
            mLightAnimation.setDuration(3000);
            mLightAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    float lightMove = (float) animation.getAnimatedValue();
                    if (Math.abs(lightMove) < getMeasuredWidth()) {
                        mShader = new RadialGradient(lightMove, getMeasuredHeight() / 2, 90f
                                , new int[]{Color.WHITE, mBackgroudColor}, null, Shader.TileMode.CLAMP);
                        postInvalidate();
                    }

                }
            });
        }

        if (mLightAnimation != null && !mLightAnimation.isRunning()) {
            mLightAnimation.start();
        }

    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号