ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression depending on 2 checkboxes or more

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Frank Bemthuis
Expression depending on 2 checkboxes or more
on Oct 16, 2017 at 2:54:00 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


Return to posts index

Brendon Murphy
Re: Expression depending on 2 checkboxes or more
on Oct 16, 2017 at 6:36:06 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]