Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions If, or, & and, Statements

  • If, or, & and, Statements

    Posted by Justin Maloney on June 3, 2015 at 6:23 pm

    Hey there, I’m using alot of if/else statements in my comp and I’m trying to optimize my expressions a little.
    Right now I have this on a layers opacity. Basically if one of three check boxes are turned on, the layer doesn’t appear. Here’s what I got right now.

    v =comp(“99 RENAME ME!”).layer(“Torso Styles”).effect(“V Neck Sweater”)(“Checkbox”);
    c =comp(“99 RENAME ME!”).layer(“Torso Styles”).effect(“Crew Neck Sweater”)(“Checkbox”);
    s = comp(“99 RENAME ME!”).layer(“Torso Styles”).effect(“Striped Shirt”)(“Checkbox”);
    o = value;
    if (v==1) o =0;
    else if (c==1) o = 0;
    else if (s==1) o = 0;

    else (o = 100);

    It works fine and all, but is there a way to say “And” or “Or” to condense my expression? I know “Or” uses the pipes “||” and and is “&&” but I can’t make AE happy. Any help?

    Justin Maloney replied 11 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 3, 2015 at 7:10 pm

    You could do it like this:

    L = comp(“99 RENAME ME!”).layer(“Torso Styles”);
    v =L.effect(“V Neck Sweater”)(“Checkbox”).value;
    c =L.effect(“Crew Neck Sweater”)(“Checkbox”).value;
    s =L.effect(“Striped Shirt”)(“Checkbox”).value;
    if (v || c || s) 0 else 100

    Dan

  • Justin Maloney

    June 3, 2015 at 7:19 pm

    Thanks! That’s alot better.

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