Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Layer visibility expression no longer working

  • Layer visibility expression no longer working

    Posted by David Cabestany on May 7, 2021 at 5:17 pm

    I have used this expression hundreds of times:

    x=thisComp.layer(“name of the layer”).active;

    if

    (x==1)

    {0}

    else

    {0}

    It’s supposed to lower the opacity of the layer it’s being applied to if another layer is active and raise it to 100 if the other layer is turned off. Basically, a layer switcher bypassing a checkbox control.

    Today it stopped working, no error or anything it just does nothing.

    Any ideas?

    Dan Ebberts replied 3 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    May 7, 2021 at 5:36 pm

    It should work if you change the first {0} to {100}.

  • David Cabestany

    May 13, 2021 at 9:41 pm

    Hi Dan, somehow I missed your reply. I thought nobody had answered.

    Yes, sorry, I posted the expression with a typo. Sorry about that.

    This is the expression that used to work and doesn’t anymore:

    —-

    p=thisComp.layer(“name of the layer”).active;

    if

    (p==1)

    {0}

    else

    {100};

    ——-

    If I invert the values it doesn’t work either, but it does not return an error.

    Thanks.

  • Dan Ebberts

    May 14, 2021 at 3:28 am

    It works for me as long as I replace your curly quotes with straight quotes.

  • Dan Ebberts

    May 14, 2021 at 3:35 am

    I think I’d do it this way:

    thisComp.layer("name of the layer").active ? 0 : 100

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