Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control layer opacity with “Master Null” whilst respecting existing keyframes?

  • Control layer opacity with “Master Null” whilst respecting existing keyframes?

    Posted by Wick Van den belt on September 9, 2016 at 10:04 am

    Hi all!

    I was trying to achieve something, however I haven’t found a good solution for it.
    I have a Pre-comp (Let’s call it “Overlay”), now I would like to control it’s opacity with a checkbox with the master null (e.g. Layer on/off).. -However the layers in the precomp already have opacity keyframes (going from 0 – 50).

    So in the master comp I would like to be able to use the switch to control the on/off for this layer (basically by changing it’s opacity between 0 – 50) but in that scenario the keyframes are no longer respected.

    I have created a null called “UNIVERSAL CONTROLLER” with a checkbox called “” and I use the following expression on the Overlay-layer :

    cb = comp(“Universal Controller Video”).layer(“UNIVERSAL CONTROLLER”).effect(“Overlay”)(“Checkbox”);
    if (cb.value) 100 else 0;

    Is there something I could do with the expression to respect the existing keyframes, or is there a workaround that might do the trick?

    I hope I’ve explained the idea well enough to understand 🙂

    Thanks a lot!

    cb = comp("Universal Controller Video").layer("UNIVERSAL CONTROLLER").effect("Overlay")("Checkbox");
    if (cb.value) 100 else 0;

    WickieMedia.net

    Wick Van den belt replied 9 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 9, 2016 at 11:02 am

    Try changing the last line to this:

    if (cb.value) value else 0;

    Dan

  • Wick Van den belt

    September 9, 2016 at 3:22 pm

    That was it!
    Thanks so much, you’re really THE expression guru 🙂

    WickieMedia.net

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