Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Logical Operator "Or" and Drop Down Menus

  • Logical Operator "Or" and Drop Down Menus

  • Christian Simpson

    December 8, 2022 at 5:34 pm

    Hey Friends,
    I am trying to adjust the opacity of a layer using a if/then expression and drop down menus. I would like it if multiple drop down menu options were selected it would adjust the opacity of a layer.
    So basically if I select either option 3 or 4 in my drop down menu it will return 100% opacity, if neither of those are selected it returns 0%. I’ve tried to write this as many ways I know how and nothing seems to work. Any thoughts?

    if(comp("blind_resume_template").layer("blind_resume_control").effect("Sport")("Menu") == 3) || (comp("blind_resume_template").layer("blind_resume_control").effect("Sport")("Menu") == 4)
    {100} else 0;
  • Dan Ebberts

    December 8, 2022 at 5:45 pm

    This should work:

    m = comp("blind_resume_template").layer("blind_resume_control").effect("Sport")("Menu");
    (m == 3 || m == 4) ? 100 : 0
  • Christian Simpson

    December 15, 2022 at 2:32 pm

    That worked perfectly, thank you Dan. I wish I could understand why however lol!
    What does the question mark and colon between 100 and 0 mean?
    Ternary Operator? If so, isn’t a ternary operator simply a more efficient but ultimately similar way to say the above? Shouldn’t the above still work?
    Thanks again for all the help you provide the community.

  • Dan Ebberts

    December 15, 2022 at 4:46 pm

    Yes, ternary operator. Yours should work if you balance a couple of mismatched parens I think.

Viewing 1 - 4 of 4 posts

Log in to reply.

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