Copy link to clipboard
Copied
Hi everyone, I'm new to AE js, and I wonder How do I get the color value/ or set value of fill color for the text layer.
I tried so many times but failed...
thanks
Copy link to clipboard
Copied
You should check out the expression language section of the help menu. Colors are determined with an array with four vapes. The value range is from 0 to 1 with as many decimal points as you like. The values describe the Red, Green, Blue and Alpha channel value for a color. For example adding this to an expression for fill color gives you 50% gray: [.5, .5, .5, 1]
You can find the color values for elements in your comp panel by observing the info panel. Set the display to decimal:
Then sample a color and you'll get the values to type in the array:
Copy link to clipboard
Copied
Thanks for your answer sincerely, I want to get that RGBA value into a JavaScript array automatically,,,so I need a JavaScript expression to get that RGBA value. like var aColorValue = **********,,,
Copy link to clipboard
Copied
You need to explain exactly what you are trying to do. You can drive color that can be animated with an expression. I don't understand what you want to accomplish or where you are going with javascript. After Effects and After Effects Scripting are related to javascript but are separate and distinct. After Effects is used to create video and that's all. Please explain in detail what you are trying to do.
Copy link to clipboard
Copied
Hi Xia.Zhao,
Did Rick's info help you solve this issue? Please let us know. Provide more details for further assistance.
Thanks,
Kevin
Copy link to clipboard
Copied
Hi Kevin,
thank you,,Rick's info helps me too..and I think I got the way to solve my problem,,
and I will explain more clearly and more exactly next time.
Sincerely
Xia.zhao
Copy link to clipboard
Copied
Hey Xia.zhao,
Good to hear from you! How do you plan to solve the issue? What's your idea? Let us know so we can assist, if possible.
Thanks!
Kevin
Copy link to clipboard
Copied
Hi Kevin,
maybe this is the answer I want that time;
var layer = app.project.activeItem.layer(1); //get an textLayer
var textLayerDocument = layer.property("Source Text").value; //get fill color value
textLayerDocument.fillColor = [0.5, 0.5, 0.5]; //stort fill color value to [0.5, 0.5, 0.5] for textDocument object
layer.property("Source Text").setValue(textLayerDocument); //set textDocument value for textLayer "Source Text" property;