Code example for ValueAnimator

Methods: setCurrentPlayTime

0
            // are no longer in the foreground and no frames are being rendered ever) 
            if (frameNum == 0 && currentTime < mStartTime + MAX_DELAY) {
                // The first frame on animations doesn't always trigger an invalidate... 
                // force an invalidate here to make sure the animation continues to advance 
                mTarget.getRootView().invalidate();
                animation.setCurrentPlayTime(0);
 
            // For the second frame, if the first frame took more than 16ms, 
            // adjust the start time and pretend it took only 16ms anyway. This 
            // prevents a large jump in the animation due to an expensive first frame 
            } else if (frameNum == 1 && currentTime < mStartTime + MAX_DELAY &&
                       !mAdjustedSecondFrameTime &&
                       currentTime > mStartTime + IDEAL_FRAME_DURATION) {
                animation.setCurrentPlayTime(IDEAL_FRAME_DURATION);
                mAdjustedSecondFrameTime = true;
            } else { 
                if (frameNum > 1) {
                    mTarget.post(new Runnable() {
                            public void run() { 
                                animation.removeUpdateListener(FirstFrameAnimatorHelper.this);
                            }