(fadeRGB)

Color.prototype.fadeRGB = function(r, g, b, milSecs, func){
        var goalTrans = {};
        goalTrans.ra = goalTrans.ga = goalTrans.ba = goalTrans.ab = 0;
        goalTrans.aa = 100;
        goalTrans.rb = r;
        goalTrans.gb = g;
        goalTrans.bb = b;
        this.fadeTransform(goalTrans, milSecs, func);
}

Purpose:
Just an alternate way to call the fadeTransform method. This method doesn't require an in-depth knowledge of the color transform object, instead all you need to know are the Red, Green and Blue values of your final color. Compared to our previous functions this is a breeze.

Explanation:

Color.prototype.fadeRGB = function(r, g, b, milSecs, func){

Accepts 5 possible arguments.

R = the final color's red color value.
G = the final color's green color value.
B = the final color's blue color value.
MilSecs = the number of milliseconds it will take for the color fade to reach completion.
Func = A function to call when the color fade is complete.
Only the R, G and B arguments are required.

var goalTrans = {};

Create a new blank object to hold variables related the color transformations we wish to apply.

goalTrans.ra = goalTrans.ga = goalTrans.ba = goalTrans.ab = 0;

When applying a transformation which sets the Color object's target to a solid color, all these variables should be set to 0. This essentially turns the Color object's target Black and leaves it's original transparency.

goalTrans.aa = 100;

Makes sure the transparency of all pixels in the Color object's target hold their original values.

goalTrans.rb = r;
goalTrans.gb = g;
goalTrans.bb = b;

After turning the Color object's target black these lines of code increase the r, g and b values until our Color object's target clip is the desired color.

this.fadeTransform(goalTrans, milSecs, func);

Calls the FadeTransform prototype we made earlier and creates a smooth color fade from our startTrans obj to our goalTrans obj over the specified period of time then calls func when complete.

(fadeHex)

Color.prototype.fadeHex = function(goalHex, milSecs, func){
        var goalRGB = Math.hexToRGB(goalHex);
        this.fadeRGB(goalRGB.r, goalRGB.g, goalRGB.b, milSecs, func);
}

Purpose:
Another way to call the fadeTransform method. All you need to know is the hexadecimal representation of your final color.

Explanation:

Color.prototype.fadeHex = function(goalHex, milSecs, func){

Accepts 3 arguments.

GoalHex is a hexadecimal number specifying the goal color. If it were our ORANGE color it would be in this format 0xFF8000.
Milsecs is the standard argument specifying the duration of the color fade in milliseconds.
Func is called when the color fade is complete.
Only goalHex is required.

var goalRGB = Math.hexToRGB(goalHex);

You remember the handy hexToRGB function we discussed earlier right? Well we're using it to extract the r, g and b values from the hexadecimal number and storing them in an object called goalRGB.

this.fadeRGB(goalRGB.r, goalRGB.g, goalRGB.b, milSecs, func);

Uses the rgb values stored in the GoalRGB object to call the fadeRGB function we defined earlier.

(fadeClearTrans)

Color.prototype.fadeClearTrans = function(milSecs, func){
        var goalTrans = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
        this.fadeTransform(goalTrans, milSecs, func);
}

Purpose:
Removes any applied color transformations and resets the target of the color object to its default settings.

Explanation:

Color.prototype.fadeClearTrans = function(milSecs, func){

This function accepts 2 arguments yet neither are required.

MilSecs specifies the length of time required to transition to the default settings.

Func is a reference to a function which will be called when the color transition is complete.

var goalTrans = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};

This line creates a color transformation object with all its values set to their defaults.

this.fadeTransform(goalTrans, milSecs, func)

This line calls our handy dandy fadeTransform function with the newly created goalTrans object as an argument. It passes the milSecs and func variables along as well.