(fadeTransform)

Color.prototype.fadeTransform = function(goalTrans, milSecs, func){
 if(this.v){
 if( this.transObjSame(goalTrans, this.v.goalTrans) ){
 trace("Already going there");
 return;// already heading to that trans obj so just wait
 }else{
 clearInterval(this.v.intrvl);
 }
 }
 var getTrans = this.getTransform();
 if(this.transObjSame(goalTrans, getTrans)){
 trace("already there");
 return;// already at that trans obj so don't bother
 } this.v = {};
 this.v.goalTrans = goalTrans;
 this.v.milSecs = milSecs;
 if(typeof func == "function")this.v.func = func;
 this.v.startTime = getTimer();
 this.v.startTrans = getTrans;
 this.v.change = {};
 for(var i in goalTrans){
 this.v.change[i] = goalTrans[i]-this.v.startTrans[i];
 }
 this.transShift();
 if(milSecs){
 this.v.intrvl = setinterval(this, "transShift", 1);
 }
}

Purpose:
FadeTransform STARTS Fading from one color transformation to another over a set period of time and specifies a function to call when finished. This function doesn't do the actual fading, it just sets everything up and stores some variables.

Explanation:

Color.prototype.fadeTransform = function(goalTrans, milSecs, func){

FadeTransform accepts 3 arguments:

goalTrans = a color transformation object containing any of the following properties {ra, rb, ga, gb, ba, bb, aa, ab}
milSecs = the total amount of time it takes for the color transformation to be fully applied in milliseconds (1000 ms = 1 second).
func = a reference to a function which will be called when the color transformation is complete.
Out of the three arguments, only goalTrans is required.

if(this.v){

Essentially asking if the color object is currently fading from one color to another. V is only created when fading colors and then deleted when fading is complete so if V exists that means you're fading colors.

if( this.transObjSame(goalTrans, this.v.goalTrans) ){
        trace("Already going there");
        return;// already heading to that trans obj so just wait

If all the properties in the new goal transformation object are the same as those contained within the transformation object we're currently fading to (remember we know we're currently fading to a trans obj because we checked to see that V exists) we can bail out (return) and let the current color fade finish as intended without interruption. No need to recalculate a new transformation object because we already have it and are headed that way right now.

}else{ clearInterval(this.v.intrvl);}

If any property in the new goal transformation object is different from the transformation object we're currently fading to, stop fading to the now obsolete color trans obj because we're going to start fading to a new color trans obj. Stop the presses we're heading to a new destination.

var getTrans = this.getTransform();

Stores a snapshot of all the color transformations "currently" applied to our color object. We need this so we can determine how much we need to change in order to reach our new goal color.

if(this.transObjSame(goalTrans, getTrans)){
        trace("already there");
        return;// already at that trans obj so don't bother
}

Although we may not be fading colors we may already be at the goal color trans obj (If we want to fade to red it makes sense to check that we're not already red). If we're already at the goal color trans then bail out (return) and save the processor for other things.

this.v = {};

"V" is an object used to store "V"ariables related to the color fading functions. Storing all the variables within an object within the color object keeps all necessary variables local to each individual color object and allows one-step deletion of multiple variables in the future.

this.v.goalTrans = goalTrans;

Stores a reference to the desired end transformation object.

this.v.milSecs = milSecs;

Stores the amount of time required to complete a color fade.

if(typeof func == "function")this.v.func = func;

Stores a reference to the function which will be executed when the color fade is complete. Checking to make sure func is a function prevents us from trying to call a function that doesn't exist.

this.v.startTime = getTimer();

Records when the color fade started.

this.v.startTrans = getTrans;

Stores a snapshot of the color transformation in effect when the color fade is started.

this.v.change = {};

An object used to store the differences between the goal trans obj and the current trans obj.

for(var i in goalTrans){
        this.v.change[i] = goalTrans[i]-this.v.startTrans[i];
}

Goes through all variables in the goal trans obj and calculates the difference between itself and the start trans obj and stores the result in the change object. If goalTrans.ra=60 and startTrans.ra=50 then change.ra=10.

this.transShift();

Calls the color object's method which will do the grunt work of fading the color based on the information we just saved within the color object's "V"ariable object.

if(milSecs){
        this.v.intrvl = setinterval(this, "transShift", 1);
}

If the milSecs variable exists SetInterval calls the color object's transShift method. The interval identifier is stored in the "V"ariables object so it can be stopped at a later time, like when a fade is complete.