Activity › Forums › Adobe After Effects Expressions › Layers opacity dependent on each other
-
Layers opacity dependent on each other
Posted by Albert Kowalski on February 14, 2018 at 2:33 pmHi!
I was wondering if there’s possibility to make mulitple layers dependent on each other. Here’s the thing. I have 10 layers and I only one of them should be visible at the time. So when I change one layer’s opacity to 100, the rest of the layers should turn 0. Is it possible to
Albert Kowalski replied 8 years, 2 months ago 3 Members · 12 Replies -
12 Replies
-
Andrei Popa
February 14, 2018 at 2:55 pmOne workaround would be to make a null and add a slider. And make the layer that the slider indicates visible, and the rest invisible. Something like this would fix the situation. In my case the layer is called “Controls” and the slider is called “Visible layer”.
visibleLayer = Math.floor(thisComp.layer("Controls").effect("Visible layer")("Slider"));
if (visibleLayer == index) 100 else 0
The condition for this would be that your layers start at layer 1 and don’t have any other layers between themAndrei
My Envato portfolio. -
Albert Kowalski
February 14, 2018 at 3:00 pmThanks! This is pretty good, but not very smooth in my case. My layers contain mouth shapes, and it would be a bit uncomfortable to always check which mouth has which layer number and then adjust the slider. Especially when I need to animate long phrases.
-
Steve Sierra
February 14, 2018 at 5:44 pmHi,
Expanding on Andrei’s technique, you could add a hidden text layer where you change the source text to your mouth shape letter (“a”, “o”, etc…)
Then, in your mouth shape opacity expressions, add a variable that is the shape’s letter.
Then, replace the slider variable in Andrei’s expression by the text layer’s source text… I can’t try it out now, but it should look like this :var letter = “a”;
var text = thisComp.layer(“TextLayer”).text.sourceText;
if (letter == text) 100 else 0This way is index free as well !
Hope it helps 😉 -
Albert Kowalski
February 15, 2018 at 11:43 amThanks Steve. Nice one, but I don’t really know how it can speed up my workflow. In your example I would need to keyframe the Source Text which is pretty time consuming. What I need is simple one click solution 🙂
-
Steve Sierra
February 15, 2018 at 12:31 pmHi again Albert,
What do you want to animate ?
With my solution, you don’t have to animate the opacity properties any more, you just have to keyframe the text layer as you said.Best regards
😉 -
Albert Kowalski
February 15, 2018 at 1:06 pmIt doesn’t really matter what I will animate. But it is easier to change the opacity twice (first making one layer visible and second make different layer hidden = two steps with two mouse click’n’drags), than go around and change the text layer which is much more clicks to do. So I’m looking for even faster way to animate = one click only. In my ‘opacity’ solution it would be like, if I put one opacity to 100%, the rest automatically goes to 0%.
-
Steve Sierra
February 15, 2018 at 2:21 pmHi again,
Sorry to insist, but I don’t see how changing one text layer is more complicated than changing several mouth shape opacity props ?
I’m not sure you understood that you only need one text layer for all the mouth shapes ?
Best regards
-
Albert Kowalski
February 15, 2018 at 3:09 pmHmm, maybe I didn’t understand your idea correctly. From what I see, to change the mouth shape I need to go to the TextLayer, double click in the preview window and type, for example, “A”. Then I need to go to the next position, go back to the text layer, delete the previous letter and type a new one. And repeat this action every time I need to change the shape. If this is right I need more time to do that, because it involves using a keyboard everytime I change the shape. When I change the opacity I only move my mouse to change the shape. In the beginning I make toggle hold keyframes in all the layers opacity. Than I just move forward and change the opacity to 100% of one layer (rest stays 0%), then I change different layer opacity to 100% and change the previous one to 0%. So 2 clicks’n’drags to change one shape. In your case I need more moves and also need to use keyboard. Am I right? And ideally I want only 1 click to change the shape.
-
Steve Sierra
February 15, 2018 at 4:11 pmHi,
I see what you mean now…
In that case, I would recommend using a visual rig.
By moving a layer to a specific zone, you trigger a specific opacity.
That way, you just move your layer to get the mouth shape !Do you need help on building that ?
Cheers 😉 -
Albert Kowalski
February 15, 2018 at 4:14 pmWow, sounds great, but honestly I have no idea how to build that 🙂
Reply to this Discussion! Login or Sign Up