Logo Search packages:      
Sourcecode: libjgoodies-animation-java version File versions  Download package

com::jgoodies::animation::AnimationFunctions::ColorFunction::ColorFunction ( long  duration,
Color[]  colors,
float[]  keyTimes 
) [inline, private]

Creates an AnimationFunction that maps times to instances of Color. The mapping is interpolated from an array of Colors using an array of key times.

duration the duration of this animation function
colors the colors to interpolate.
keyTimes an array of key times used to distribute the result values over the time.

Definition at line 370 of file AnimationFunctions.java.

References alphaFunction, com::jgoodies::animation::AnimationFunctions::asFloat(), blueFunction, greenFunction, and redFunction.

            Float[] red   = new Float[colors.length];
            Float[] green = new Float[colors.length];
            Float[] blue  = new Float[colors.length];
            Float[] alpha = new Float[colors.length];

            for (int i = 0; i < colors.length; i++) {
                red[i]   = new Float(colors[i].getRed());
                green[i] = new Float(colors[i].getGreen());
                blue[i]  = new Float(colors[i].getBlue());
                alpha[i] = new Float(colors[i].getAlpha());

            redFunction = AnimationFunctions.asFloat(AnimationFunctions.linear(
                            duration, red, keyTimes));
            greenFunction = AnimationFunctions.asFloat(AnimationFunctions.linear(
                            duration, green, keyTimes));
            blueFunction = AnimationFunctions.asFloat(AnimationFunctions.linear(
                            duration, blue, keyTimes));
            alphaFunction = AnimationFunctions.asFloat(AnimationFunctions.linear(
                            duration, alpha, keyTimes));

Generated by  Doxygen 1.6.0   Back to index