FileDocCategorySizeDatePackage
ArgbEvaluator.javaAPI DocAndroid 5.1 API3004Thu Mar 12 22:22:08 GMT 2015android.animation

ArgbEvaluator

public class ArgbEvaluator extends Object implements TypeEvaluator
This evaluator can be used to perform type interpolation between integer values that represent ARGB colors.

Fields Summary
private static final ArgbEvaluator
sInstance
Constructors Summary
Methods Summary
public java.lang.Objectevaluate(float fraction, java.lang.Object startValue, java.lang.Object endValue)
This function returns the calculated in-between value for a color given integers that represent the start and end values in the four bytes of the 32-bit int. Each channel is separately linearly interpolated and the resulting calculated values are recombined into the return value.

param
fraction The fraction from the starting to the ending values
param
startValue A 32-bit int value representing colors in the separate bytes of the parameter
param
endValue A 32-bit int value representing colors in the separate bytes of the parameter
return
A value that is calculated to be the linearly interpolated result, derived by separating the start and end values into separate color channels and interpolating each one separately, recombining the resulting values in the same way.

        int startInt = (Integer) startValue;
        int startA = (startInt >> 24) & 0xff;
        int startR = (startInt >> 16) & 0xff;
        int startG = (startInt >> 8) & 0xff;
        int startB = startInt & 0xff;

        int endInt = (Integer) endValue;
        int endA = (endInt >> 24) & 0xff;
        int endR = (endInt >> 16) & 0xff;
        int endG = (endInt >> 8) & 0xff;
        int endB = endInt & 0xff;

        return (int)((startA + (int)(fraction * (endA - startA))) << 24) |
                (int)((startR + (int)(fraction * (endR - startR))) << 16) |
                (int)((startG + (int)(fraction * (endG - startG))) << 8) |
                (int)((startB + (int)(fraction * (endB - startB))));
    
public static android.animation.ArgbEvaluatorgetInstance()
Returns an instance of ArgbEvaluator that may be used in {@link ValueAnimator#setEvaluator(TypeEvaluator)}. The same instance may be used in multiple Animators because it holds no state.

return
An instance of ArgbEvalutor.
hide


                                         
        
        return sInstance;