来这是释放动画的方法
//释放动画
private ValueAnimator valueAnimator;
/**
* 添加释放操作
*/
public void release(){
if(valueAnimator == null){
final ValueAnimator animator = ValueAnimator.ofFloat(mProgress,0f);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(400);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
Object val = valueAnimator.getAnimatedValue();
if(val instanceof Float){
setProgress((Float) val);
}
}
});
valueAnimator = animator;
}else {
valueAnimator.cancel();
valueAnimator.setFloatValues(mProgress,0f);
}
valueAnimator.start();
}