Code example for DecelerateInterpolator

Methods: getInterpolation

0
        if (millisLeft <= 0) {
            reset(); 
            return; 
        } 
        // from 0 to 1 as animation progresses 
        float interpolation =
                mInterpolator.getInterpolation((float) millisSoFar / mAnimationDuration);
        final int dx = (int) (totalDeltaX * (1 - interpolation));
        mRotaryOffsetX = mAnimatingDeltaXEnd + dx;
 
        // once we have gone far enough to animate the current buttons off screen, we start 
        // wrapping the offset back to the other side so that when the animation is finished, 
        // the buttons will come back into their original places. 
        if (mDimplesOfFling > 0) {
            if (!goingRight && mRotaryOffsetX < -3 * mDimpleSpacing) {
                // wrap around on fling left 
                mRotaryOffsetX += mDimplesOfFling * mDimpleSpacing;
            } else if (goingRight && mRotaryOffsetX > 3 * mDimpleSpacing) {
                // wrap around on fling right 
                mRotaryOffsetX -= mDimplesOfFling * mDimpleSpacing;
            }