Code example for ValueAnimator

Methods: cancel, getAnimatedValue

0
 
            animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override 
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    animating = true;
                    Float animProgress = (Float) valueAnimator.getAnimatedValue();
//                    if (animProgress > 1) 
//                    { 
//                        Log.d("Graham", "animProgress " + animProgress); 
//                        touchCircle = (int) ((start) + (distance * ((animProgress-1) / 2))); 
//                        Log.d("Graham", "amount " + ((animProgress-1) / 2)); 
//                    } 
                    touchCircle = (int) ((start) + (distance * animProgress));
                    if (touchCircle > targetCircle)
                    { 
                        valueAnimator.cancel();
                        end(); 
                    } 
                    if (!hold)
                    { 
                        valueAnimator.cancel();
                        touchCircle = (int)(50*multiplier);
                    } 
                    invalidate();
                } 
            });