Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Conditional Statement with 2 if’s

  • Conditional Statement with 2 if’s

    Posted by Vanessa Appleby on November 15, 2015 at 8:33 pm

    I need to add an expression for opacity on a layer. It needs to go to 100% if a value is positive (triggered by a parenthesis in the source text), and go to 0% if a checkbox is turned off. The two statements work fine on their own,but I’m having trouble combining them. Whichever if statement is last in the expression seems to overwrite the first part if statement. What’s going wrong here?

    txt = thisLayer.text.sourceText;
    if (txt.length > 0 && txt[0] == "(") 100 else 0
    if (thisComp.layer("VALUES").effect("On/Off_Value11")("Checkbox")==0) 0 else 100

    Xavier Gomez replied 10 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Xavier Gomez

    November 15, 2015 at 9:29 pm

    I’m not completely sure that this is what you want but, well, it might be it!

    txt = thisLayer.text.sourceText;
    if (txt.length > 0 && txt[0] == "(" && thisComp.layer("VALUES").effect("On/Off_Value11")("Checkbox")==1) 100 else 0;

    Xavier.

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