FileDocCategorySizeDatePackage
BakedBezierInterpolator.javaAPI DocAndroid 5.1 API3099Thu Mar 12 22:22:56 GMT 2015android.support.v4.widget

BakedBezierInterpolator

public final class BakedBezierInterpolator extends Object implements android.view.animation.Interpolator
A pre-baked bezier-curved interpolator for indeterminate progress animations.

Fields Summary
private static final BakedBezierInterpolator
INSTANCE
private static final float[]
VALUES
Lookup table values. Generated using a Bezier curve from (0,0) to (1,1) with control points: P0 (0,0) P1 (0.4, 0) P2 (0.2, 1.0) P3 (1.0, 1.0) Values sampled with x at regular intervals between 0 and 1.
private static final float
STEP_SIZE
Constructors Summary
private BakedBezierInterpolator()
Use getInstance instead of instantiating.

        super();
    
Methods Summary
public static final android.support.v4.widget.BakedBezierInterpolatorgetInstance()


         
        return INSTANCE;
    
public floatgetInterpolation(float input)


    
        
        if (input >= 1.0f) {
            return 1.0f;
        }

        if (input <= 0f) {
            return 0f;
        }

        int position = Math.min(
                (int)(input * (VALUES.length - 1)),
                VALUES.length - 2);

        float quantized = position * STEP_SIZE;
        float difference = input - quantized;
        float weight = difference / STEP_SIZE;

        return VALUES[position] + weight * (VALUES[position + 1] - VALUES[position]);