[Emma Nichols] “colour has RGBA values and I know that this is 0 1 2 3 dimensions
but how would I pickwhip other values to the individual rgba values or the average of them?”
A color is an array, or vector, in After Effects. So you can access each of its parts individually. For example:
color = effect("Fill")("Color");
average = (color[0] + color[1] + color[2] + color[3]) / 4;
Element 0 is Red, element 1 is Green, 2 is Blue and 3 is Alpha. If you didn’t want to include the alpha in the average you would use:
color = effect("Fill")("Color");
average = (color[0] + color[1] + color[2]) / 3;
The values that are returned from the array are going to be float values where black is equal to 0 and white is equal to 1. This means you will likely need to remap the values to fit your needs. If you want black to translate to an upper left coordinate in the composition and yellow to translate to lower right (red increases along x and green increases along y), then you could do something like this:
color = effect("Fill")("Color");
x = linear(color[0], 0, 1, 0, thisComp.width);
y = linear(color[1], 0, 1, 0, thisComp.height);
[x,y]
The ‘x’ variable checks the Red channel. If there is no red (0) then it returns 0, if there is full red (1) then it returns thisComp.width. The ‘y’ variable does the same but for the Green channel.
Darby Edelen