Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control opacity with two layers

  • Control opacity with two layers

    Posted by Saso Goricar on January 13, 2020 at 4:25 pm

    Hey guys, I have a question. I’m creating a template in AE and is it possible to control the opacity of one layer with two different controls. I created one “menu control” and one “checkbox control” to control opacity.

    Is this possible? I wrote an expression myself and is not working. If this is possible, what did I missed in expression?

    var menu = comp("MOGRT").layer("MOGRT Controls").effect("Position")("Menu");
    var opa = comp("MOGRT").layer("MOGRT Controls").effect("StrokeAnimation")("Checkbox");

    if (menu == 1 || opa == 1)
    {100}
    else if (menu == 1 || opa == 0)
    {0}
    else
    {0}

    Thanks for the help.

    Saso

    Saso Goricar replied 6 years, 3 months ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    January 13, 2020 at 5:23 pm

    I haven’t tested this, but give it a try:

    var menu = comp(“MOGRT”).layer(“MOGRT Controls”).effect(“Position”)(“Menu”).value;
    var opa = comp(“MOGRT”).layer(“MOGRT Controls”).effect(“StrokeAnimation”)(“Checkbox”).value;

    (menu == 1 || opa) ? 100 : 0

    Dan

  • Saso Goricar

    January 13, 2020 at 7:01 pm

    Unfortunately, this is not working for me. Any other ideas maybe?
    Thanks, Saso

  • Dan Ebberts

    January 13, 2020 at 7:09 pm

    Assuming the expression is not throwing an error, what is the exact behavior you’re looking for?

    Dan

  • Saso Goricar

    January 15, 2020 at 3:17 pm

    Hello,

    I managed to solve it. I will control stroke opacity of the shape layer (checkbox control) and opacity of the whole layer with menu control

    ae-text-1.png

    Thanks for all the suggestions.

    Saso

  • Saso Goricar

    January 15, 2020 at 3:18 pm

    Wrong picture in the previous post:

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