
Page 3 of 7
About Color Transformation Objects:
A Color Transformation Object is merely a way to store related pieces of color information. A Color Transform Object generally contains 8 pieces of information; an A and B value for red, an A and B for green, an A and B for blue and an A and B for alpha. They are referred to as ra, rb, ga, gb, ba, bb, aa and ab. The A Group of variables generally go from -100% to 100% but can go beyond those limits if desired. The A Group variables are multiplied by the pixels initial color value. The B Group of variables usually range from -255 to 255 but can also go beyond these limits. The B Group is added to the initial value which was multiplied by the A Group.
Imagine you are transforming the color of a single pixel image. Imagine this single pixel's initial color is our familiar friend ORANGE (r:255, g:128, b:0). Imagine we are going to use the following transformation object to change our single pixel image {ra:50, rb:-100, ga:25, gb:100, ba:100, bb:200, aa:100, ab:0}. This is how you can calculate the final color of your pixel:
|
So our ORANGE {r:255, g:128, b:0, a:255} will now be show up as what I'd call a light pink {r:227, g:132, b:200, a:255} after applying the Color Transform Object. Just remember A Group multiplies, B Group adds.
(transObjSame)
Color.prototype.transObjSame = function (obj1, obj2){
for(var i in obj1){
if(obj1[i] != obj2[i]){
return false;
}
}
return true;
}
Purpose:
The transObjSame function is used to make sure we don't try to fade from one color to the same color. It's like fading from red to the exact same shade of red, there's not much point to it.
Explanation:
TransObjSame compares two different objects to see if all the properties within the first object are reflected in the second object.


