Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression depending on 2 checkboxes or more

  • Expression depending on 2 checkboxes or more

    Posted by Frank Bemthuis on October 16, 2017 at 2:54 pm

    Good day everyone,

    In AE, I synced 4 different versions of 1 short video (a white/alpha transition for the Track Matte Key effect), so when I import it into the Graphic Essential Panel, it would be possible in Premiere Pro to toggle on a hard-keyed version, a speed-up version and a combination.

    The plan is to do it by the following scheme:
    Hard-key: OFF
    Speed 2x: OFF
    = video 1 (soft-key, speed 1x) 100% opacity.
    = video 2 (soft-key, speed 2x) 0% opacity.
    = video 3 (hard-key, speed 1x) 0% opacity.
    = video 4 (hard-key, speed 2x) 0% opacity.

    Hard-key: OFF
    Speed 2x: ON
    = video 1 (soft-key, speed 1x) 0% opacity.
    = video 2 (soft-key, speed 2x) 100% opacity.
    = video 3 (hard-key, speed 1x) 0% opacity.
    = video 4 (hard-key, speed 2x) 0% opacity.

    Hard-key: ON
    Speed 2x: OFF
    = video 1 (soft-key, speed 1x) 0% opacity.
    = video 2 (soft-key, speed 2x) 0% opacity.
    = video 3 (hard-key, speed 1x) 100% opacity.
    = video 4 (hard-key, speed 2x) 0% opacity.

    Hard-key: ON
    Speed 2x: ON
    = video 1 (soft-key, speed 1x) 0% opacity.
    = video 2 (soft-key, speed 2x) 0% opacity.
    = video 3 (hard-key, speed 1x) 0% opacity.
    = video 4 (hard-key, speed 2x) 100% opacity.

    The only thing is, I’m looking for a way to make the opacity of each layer depending on 2 checkboxes (in instead of 1).
    Trying to let it depend on just 1 checkbox with expressions already succeeded (see code below)

    if (thisComp.layer("Expr_CTRL").effect("Hard-key")("Checkbox") == 0) 100 else 0

    Brendon Murphy replied 8 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Brendon Murphy

    October 16, 2017 at 6:36 pm

    I don’t know anything about the part where you’re interfacing with Premiere, but to make this work in AE you just need to set up the additional condition for your if/else expression, as shown below. You’ll notice I created variables for the checkboxes to make things easier:

    //on video 1 opacity
    hardKeyBox = thisComp.layer("Expr_CTRL").effect("Hard-key")("Checkbox");
    speedBox = thisComp.layer("Expr_CTRL").effect("Speed 2x")("Checkbox");
    if (hardKeyBox== 0&&speedBox==0) 100 else 0

    //on video 2 opacity
    hardKeyBox = thisComp.layer("Expr_CTRL").effect("Hard-key")("Checkbox");
    speedBox = thisComp.layer("Expr_CTRL").effect("Speed 2x")("Checkbox");
    if (hardKeyBox== 0&&speedBox==1) 100 else 0

    //on video 3 opacity
    hardKeyBox = thisComp.layer("Expr_CTRL").effect("Hard-key")("Checkbox");
    speedBox = thisComp.layer("Expr_CTRL").effect("Speed 2x")("Checkbox");
    if (hardKeyBox== 1&&speedBox==0) 100 else 0

    //on video 4 opacity
    hardKeyBox = thisComp.layer("Expr_CTRL").effect("Hard-key")("Checkbox");
    speedBox = thisComp.layer("Expr_CTRL").effect("Speed 2x")("Checkbox");
    if (hardKeyBox== 1&&speedBox==1) 100 else 0

    Brendon Murphy
    ________________
    Visual Effects
    http://www.brendonmurphy.net

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