ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Turn RGB swatch into RGB values?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
William MarlerTurn RGB swatch into RGB values?
by on Aug 31, 2013 at 4:39:48 pm

So I am doing a UI concept in which 3D planes move back and forth based on a colour value, sort of like a 3D colour graph.

I want to link the position of the planes to the R, G, and B values of a layer's fill colour, however RGB colour fills (such as in Effect>Generate>Fill) are only ever displayed as a swatch, not an RGB value. I have tried many effects, and all that provide a layer with a fill or change the colour in some way just have a swatch to determine colour, as opposed to separate values like you get in the colour picker, or in something like the HSL effect.

Is it possible to "split" the swatch into the different values like you can split dimensions in the position parameter? If not, is there some way of changing the colour of a layer through RGB parameters as opposed to choosing a swatch with the colour picker.

Thanks in advance.


Return to posts index

Darby EdelenRe: Turn RGB swatch into RGB values?
by on Sep 1, 2013 at 9:12:32 pm

[William Marler] "Is it possible to "split" the swatch into the different values like you can split dimensions in the position parameter? If not, is there some way of changing the colour of a layer through RGB parameters as opposed to choosing a swatch with the colour picker."

You can do this with an expression. Color is stored as a 4 component array (or vector), so if you applied this to any Color Swatch you could produce different colors using RGB values:

50% Gray:
r = 0.5;
g = 0.5;
b = 0.5;
a = 1.0;
[r,g,b,a];


100% Red:
r = 1;
g = 0;
b = 0;
a = 1.0;
[r,g,b,a];



Instead of manually entering the values into the expression you could aaply an Effect > Expression Controls > 3D Point Control and point the expression to those values for the RGB components (alpha will generally be 1.0):

rgb = effect("3D Point Control")("3D Point");
a = 1.0;
rgb + [0,0,0,a];


Note that internally all RGB values are in float (0.0 = black, 1.0 = white). If you wanted to supply 8 bit code values then you'd need to divide them by 255 to get the correct float value:

rgb = effect("3D Point Control")("3D Point") / 255;
a = 1.0;
rgb + [0,0,0,a];


Darby Edelen


Return to posts index

William MarlerRe: Turn RGB swatch into RGB values?
by on Sep 6, 2013 at 6:06:21 pm

Thank You Darby! Much appreciated, it's always satisfying to link effects to sliders. :)


Return to posts index


William MarlerRe: Turn RGB swatch into RGB values?
by on Sep 6, 2013 at 6:32:10 pm

Just in case you are interested, I have achieved the effect slightly differently by adding three slider controls to the shape layer, to control R, G, and B respectively, and divided their values by 255, so now I can dial in the 255 RGB values to each individual slider. Thanks again!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]