Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Multiple opacity checkbox and opacity slider (stack multiple opacity expression)

  • Multiple opacity checkbox and opacity slider (stack multiple opacity expression)

  • Rezza Mohammad

    September 5, 2021 at 12:58 am

    Hello friends I am new here :), I am not familiar with If/Else Condition, and I tried many times to find the right Expression for my template, where my team can able to do some desired opacity settings.

     

    Here I created an example with 2 Opacity Checkbox and 1 Opacity Slider.

    The first Checkbox functions to switch Light and Dark modes, the second Checkbox functions to disable elements if they don’t want one of them (in real case I using many elements), and for the Slider where they can adjust the Opacity thickness if the second Checkbox (OnOff) is not checked, but the Slider will not work if the second Checkbox (OnOff) is checked in the sense Slider must be set to 0, and here is the main problem – it doesn’t work.

     

    It can if I make additional Opacity using Solid Composite or Transform that applied on Effects box special only for Slider Opacity, but it looks messy for me and I want to keep it simple stack in one Expression only.

     

    Here I use “value” between curly brackets to keep layers working fine if they contain keyframe, but can this also working fine in case if the Opacity is linked to another layer (Example linked to layer “Null – Opacity”) so that I can put Expression working properly.

     

    //Here is my content

    Mode = thisComp.layer(“Control”).effect(“Mode (Dark/Night)”)(“Checkbox”);

    OnOff = thisComp.layer(“Control”).effect(“OnOff”)(“Checkbox”);

    Opacity = thisComp.layer(“Control”).effect(“Opacity”)(“Slider”);

    if (Mode == true) {

    0

    } if (Mode == false) {

    value

    } if (OnOff == true) {

    0

    } if (Opacity == true) {

    value

    } else {

    }

    ;

    ===/////===

    Thank you!

  • Andrei Popa

    September 8, 2021 at 7:49 am

    I do not fully understand what the first checkbox does.

    If the second is checked, the opacity is zero. But if the first is checked/unchecked?

  • Rezza Mohammad

    September 10, 2021 at 1:10 am

    Sorry I missed the details.

    Opacity is zero when the second checkbox is checked – even if the first checkbox is checked or unchecked.

  • Dan Ebberts

    September 10, 2021 at 4:45 pm

    Something like this, maybe:

    Mode = thisComp.layer("Control").effect("Mode (Dark/Night)")("Checkbox").value;

    OnOff = thisComp.layer("Control").effect("OnOff")("Checkbox").value;

    Opacity = thisComp.layer("Control").effect("Opacity")("Slider");

    if (! OnOff){

    Mode ? Opacity : value;

    }else{

    0;

    }

  • Rezza Mohammad

    September 12, 2021 at 11:36 pm

    Hello Dan, I was tried your Expression, but something is missing at Mode like they not switching and only stay at the light layer, but On/Off and Opacity Slider it was working perfectly like what I want.

    However, I made a bit changes to my Expression below.

    //For Light Layer Mode = thisComp.layer("Mode").effect("Mode")("Checkbox").value;

    IsDark = thisLayer.name;

    IsLight =

    OnOff = thisComp.layer("Mode").effect("OnOff (Light_Element 1)")("Checkbox").value;

    Opacity = thisComp.layer("Mode").effect("Opacity")("Slider");

    IsActive = (Mode && IsDark ) || (! Mode && IsLight );

    if (IsActive && ! OnOff){

    Opacity;

    }else{

    0;

    }


    //For Dark Layer

    Mode = thisComp.layer("Mode").effect("Mode")("Checkbox").value;

    IsLight = thisLayer.name;

    IsDark =

    OnOff = thisComp.layer("Mode").effect("OnOff (Dark_Element 1)")("Checkbox").value;

    Opacity = thisComp.layer("Mode").effect("Opacity")("Slider");

    IsActive = (Mode && IsDark ) || (! Mode && IsLight );

    if (IsActive && ! OnOff){

    Opacity;

    }else{

    0;

    }

    Here is preview.
    https://www.mevue.com/v/4bbzs8t7829

    Again. Thanks a lot for your help guys, I really appreciate it!

    And thank you so much, Dan!

    You saved me, you are my favorite 🙂

Viewing 1 - 5 of 5 posts

Log in to reply.

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