Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Multiple if/else expressions for one value

  • Multiple if/else expressions for one value

    Posted by Nicholas Deines on June 2, 2020 at 6:48 pm

    Is it possible to have multiple if/else expressions for one value?

    With the expression code below, the first “if” expression works fine, but the second doesn’t do what (I think) I’m asking it to—though I don’t get any errors.

    if (thisComp.layer("Percentage 2").content("Trim Paths 1").end==0) 0 else 100; if (thisComp.layer("EXTRACT PIECE").effect("3 Extract Z")("Slider")==1-59) 0 else 100;

    Nicholas Deines replied 5 years, 11 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    June 2, 2020 at 7:25 pm

    You would generally use else if to combine them. I’m not sure if this is the logic you had in mind, but this would be one way to combine them:


    if (thisComp.layer("Percentage 2").content("Trim Paths 1").end==0)
    0
    else if (thisComp.layer("EXTRACT PIECE").effect("3 Extract Z")("Slider")==1-59)
    0
    else
    100;

    Dan

  • Robert Müller

    June 3, 2020 at 9:50 am

    if (thisComp.layer("EXTRACT PIECE").effect("3 Extract Z")("Slider")==1-59) 0 else 100;
    Just for my understanding, do you want your condition be true if the slider has the value 1 minus 59? Or are you trying to check if the slider is between the value 1 and 59? Because at the moment you are doing the first.

  • Nicholas Deines

    June 3, 2020 at 4:05 pm

    Okay, I didn’t know about “else if”. Thanks!

  • Nicholas Deines

    June 3, 2020 at 4:39 pm

    I was trying to do between 1 and 59. I was trying to figure out how to do that.

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