Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Setting Transforms For Other Layers

  • Setting Transforms For Other Layers

    Posted by Royce Jacobs on December 19, 2010 at 1:59 am

    I am working on a comp that is going to be automated (with scripts) to open a text file and make new text layers for each line in the file. I then have text layers whose text sources are defined by the new layers’ index numbers (1 through 3).

    I’ve gotten that far, but now I need to hide the first 3 layers, either by changing the opacity to zero or to somehow make them invisible to rendering. This will all run on a website with aerender though, so I need this to be done in the script, as there will be no user interface to AE.

    So how can I set the opacity to zero of layers 1-3 based on index through a script?

    Royce Jacobs replied 15 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 19, 2010 at 6:47 pm

    You’re talking about a script, not an expression, correct?

    With a script you could do something like this (assuming myComp is a variable referencing the comp):

    for (i = 1; i <= 3; i++){
    myComp.layer(i).property(“Opacity”).setValue(0);
    }

    Or this:

    for (i = 1; i <= 3; i++){
    myComp.layer(i).guideLayer = true;
    }

    Or this:

    for (i = 1; i <= 3; i++){
    myComp.layer(i).enabled = false;
    }

    If you are talking about an opacity expression, it would just be:

    index <= 3 ? 0 : value

    Dan

  • Royce Jacobs

    December 20, 2010 at 2:30 am

    Perfect, thanks so much! I am running it in a script; I think I’ll use the setValue(0).

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