Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Conditional expression needed (if/else) with command “or”

  • Conditional expression needed (if/else) with command “or”

    Posted by Aled Rhys jones on May 23, 2008 at 5:00 pm

    I have this expression which is giving me an error:

    if(thisComp.layer(“Null”).effect(“Layer Control”)(“Layer”) == “5”OR “6” OR “7”) “A” else “B”

    What I’m after is a condition set where if an operator selects any of these three layers 5, 6 or 7) through the effect(“Layer Control”) then the expression should give reply “A” and if it’s any other selection (1 to 4 or 8 and above) then the expression should give the reply “B”

    Any help would be greatly appreciated,

    Thanks

    Mo Dejong replied 17 years, 12 months ago 2 Members · 1 Reply
  • 1 Reply
  • Mo Dejong

    May 23, 2008 at 5:50 pm

    > I have this expression which is giving me an error:
    >
    > if(thisComp.layer(“Null”).effect(“Layer Control”)(“Layer”) == “5”OR “6” OR “7”) “A” else “B”

    You need to use (var == value1 || var == value2) in
    expressions. For example:

    var layer = thisComp.layer(“Null”).effect(“Layer Control”)(“Layer”);
    if (layer == 5 || layer == 6 || layer == 7) {
    A
    } else {
    B
    }

    cheers
    Mo DeJong

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