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 layer expression control

  • Control opacity with layer expression control

    Posted by John Jackowiak on February 25, 2011 at 4:27 pm

    Hey guys. I am not too familiar with the layer expression control. I tried to do a little research, but most of what I found is in regard to using the control with a layers position.

    I have 20 layers need to have to work inversely of each other. Or in other words, If one layer is on, all the others have to be off. Originally I wanted to see if I could write an expression that when I click on any given layer on, the others physically turn off. But from what I understand, this can only be done through scripting? I know some, but not enough to know how to implement it.

    I know it can be done through a slider scale, and I currently have it working through check box expressions. Frankly though, there are a lot of check boxes and I foresee this being confusing later on when I go to use them.

    Any ideas if/how to implement a layer expression, or a better way to do this in general?
    Thanks!

    John Jackowiak replied 15 years, 2 months ago 2 Members · 5 Replies
  • 5 Replies
  • Kevin Camp

    February 25, 2011 at 5:22 pm

    you could set up an expression to look at the slider value and compare it to the layer’s index (1,2,3, etc) and if it matched, then it would make it visible, if not then it would make it invisible…

    if that would work for you, try this expression in the opacity property of the layers that you want to show/hide.

    target = thisComp.layer("Null 1").effect("Slider Control")("Slider"); // this should be your slider value
    if (index == Math.round(target)) 100 else 0

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • John Jackowiak

    February 25, 2011 at 5:35 pm

    Great idea! Thanks!

    John Jackowiak
    Brand New Motion
    johnj.bnm@gmail.com

    ***Recent Work***

    https://brand-newmotion.com/reels/motion_graphics.mov

  • John Jackowiak

    February 25, 2011 at 5:46 pm

    I would like to apply my layer expression in my main comp, but pre comp the slider and the layers that the slider is determining opacity for. But from what I understand, the layer expression won’t be indexing those pre comped layers correct? I’m confused if I can even get this accomplished this way because it seems you cannot add an expression to the layer expression to point it to the slider expression in the pre comp?

    John Jackowiak
    Brand New Motion
    johnj.bnm@gmail.com

    ***Recent Work***

    https://brand-newmotion.com/reels/motion_graphics.mov

  • Kevin Camp

    February 25, 2011 at 6:07 pm

    you want control over layers in a pre-comp from a slider in the main comp, right? if so, yes you can get that.

    in this expression, the main comp’s name is “Main Comp” and the layer that the slider is on (within the main comp) is called “Pre-comp” (note: i applied the slider to the pre-comp within the main comp, but you don’t have to do it that way, you just need to change the names of those to match what you are working with).

    the expression needs to be applied to each layer in the pre-comp that needs to be controlled in the main comp. also, if you changed the name of the slider, the expression needs to reflect that too. you can let ae, auto-write the slider path by making the two timelines visible (drag one tab bellow the other in the timeline), then select the path for target (when i say path, i’m talking about “comp(“Main Comp”.layer….etc”) and use the expression pickwhip to select your slider value.

    target = comp("Main Comp").layer("Pre-comp").effect("Slider Control")("Slider");
    if (index == Math.round(target)) 100 else 0

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • John Jackowiak

    February 25, 2011 at 6:11 pm

    Much simpler. I was over thinking the scenario thinking I had to use a layer control to bridge the two. Thanks!

    John Jackowiak
    Brand New Motion
    johnj.bnm@gmail.com

    ***Recent Work***

    https://brand-newmotion.com/reels/motion_graphics.mov

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