7 Replies Latest reply on Jul 23, 2017 7:35 PM by Xia.Zhao

    I got some problem about AE JavaScript;

    Xia.Zhao

      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

        • 1. Re: I got some problem about AE JavaScript;
          Rick Gerard Adobe Community Professional & MVP

          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:

          Screen Shot 2017-05-08 at 9.23.46 PM.png

          Then sample a color and you'll get the values to type in the array:

          Screen Shot 2017-05-08 at 9.23.35 PM.png

          • 2. Re: I got some problem about AE JavaScript;
            Xia.Zhao Level 1

            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 = **********,,,

            • 3. Re: I got some problem about AE JavaScript;
              Rick Gerard Adobe Community Professional & MVP

              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.

              • 4. Re: I got some problem about AE JavaScript;
                Kevin-Monahan Adobe Employee

                Hi Xia.Zhao,

                Did Rick's info help you solve this issue? Please let us know. Provide more details for further assistance.

                 

                Thanks,
                Kevin

                • 5. Re: I got some problem about AE JavaScript;
                  Xia.Zhao Level 1

                  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

                  • 6. Re: I got some problem about AE JavaScript;
                    Kevin-Monahan Adobe Employee

                    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

                    • 7. Re: I got some problem about AE JavaScript;
                      Xia.Zhao Level 1

                      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;