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();
}
}
SlideButton.java 文件源码
java
阅读 38
收藏 0
点赞 0
评论 0
项目:AndroidButtonLib
作者:
评论列表
文章目录