Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Add the Animate Fill Color RGB to text layer

  • Add the Animate Fill Color RGB to text layer

    Posted by Jace Bradley on January 14, 2023 at 7:33 pm

    I am trying to create a script that add the Fill Color RGB to selected text layers.

    here is the code so far

    // Create a new window for the UI panel

    var myPanel = new Window(“palette”, “Add RGB Fill”, undefined);

    // Add a button to the panel

    var myButton = myPanel.add(“button”, undefined, “Add RGB Fill Color”);

    // Add an event listener to the button

    myButton.onClick = function() {

    // Get the active composition

    var activeComp = app.project.activeItem;

    if (!(activeComp instanceof CompItem)) {

    alert(“Please select a text layer in the active composition.”);

    return;

    }

    // Get the selected text layers

    var selectedLayers = activeComp.selectedLayers;

    if (selectedLayers.length == 0) {

    alert(“Please select at least one text layer.”);

    return;

    }

    for (var i = 0; i < selectedLayers.length; i++) {

    var textLayer = selectedLayers[i];

    if (!(textLayer instanceof TextLayer)) {

    alert(“Please select only text layers.”);

    return;

    }

    // get the text path

    var PickColor = textLayer.property(“Text”);

    //after getting this path, how can I add the animate Fill Color RGB?

    }

    // Show the UI panel

    myPanel.show();

    Any help?

    Jace Bradley replied 1 year, 4 months ago 3 Members · 5 Replies
  • 5 Replies
  • Manuel Moellmann

    January 14, 2023 at 7:42 pm
  • Dan Ebberts

    January 14, 2023 at 7:45 pm

    I think this works:

    // Create a new window for the UI panel
    var myPanel = new Window("palette", "Add RGB Fill", undefined);
    // Add a button to the panel
    var myButton = myPanel.add("button", undefined, "Add RGB Fill Color");
    // Add an event listener to the button
    myButton.onClick = function() {
    // Get the active composition
    var activeComp = app.project.activeItem;
    if (!(activeComp instanceof CompItem)) {
    alert("Please select a text layer in the active composition.");
    return;
    }
    // Get the selected text layers
    var selectedLayers = activeComp.selectedLayers;
    if (selectedLayers.length == 0) {
    alert("Please select at least one text layer.");
    return;
    }
    for (var i = 0; i < selectedLayers.length; i++) {
    var textLayer = selectedLayers[i];
    if (!(textLayer instanceof TextLayer)) {
    alert("Please select only text layers.");
    return;
    }
    var animator = textLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");
    var fill = animator.property("ADBE Text Animator Properties").addProperty("ADBE Text Fill Color");
    }
    }
    // Show the UI panel
    myPanel.show();
  • Jace Bradley

    January 14, 2023 at 8:48 pm

    Thank you. That works but is not adding the range selector so I am able to animate the start and end

    I tremendously appreciate your help.

  • Dan Ebberts

    January 14, 2023 at 9:28 pm

    Good point. Change that section to this:

    var animator = textLayer.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");

    var selector = animator.property("ADBE Text Selectors").addProperty("ADBE Text Selector");

    var fill = animator.property("ADBE Text Animator Properties").addProperty("ADBE Text Fill Color");

  • Jace Bradley

    January 15, 2023 at 4:32 pm

    That worked ! 🙂 Thank you very much.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy