ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Switching Opacity inside the same comp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marcelo Cabral
Switching Opacity inside the same comp
on Sep 26, 2017 at 7:16:01 pm

HI
I have a composition with several images. A slider control located in an external composition allow showing one of those images by switching the opacity of the image layers. What I need is add the opacity switching control inside of the composition of the images not outside.
I need to add an Adjustment layer inside the image composition to make them independents.

Thank you in advance.

This is the current expression code which I need to modify

C = comp("Scene 01");
ctrl = C.layer("CONTROL").effect("SHOW")("Slider");
L = C.layer(thisComp.name);
val = Math.round(ctrl.valueAtTime(time+L.startTime));
if (val == index) 100 else 0


Return to posts index

Dan Ebberts
Re: Switching Opacity inside the same comp
on Sep 26, 2017 at 7:43:26 pm

Something like this should do it:

s = thisComp.layer("CONTROL").effect("SHOW")("Slider").value;
if (Math.round(s) == index) 100 else 0

Dan



Return to posts index

Marcelo Cabral
Re: Switching Opacity inside the same comp
on Sep 26, 2017 at 7:50:09 pm

It works perfectly!!
Thank you, Dan.


Return to posts index


Marcelo Cabral
Re: Switching Opacity inside the same comp
on Sep 27, 2017 at 1:57:48 pm

Hi Dan, me again.
The expression to switch the opacity of the layers works perfectly inside the same composition. The thing is I need to set up 3 different sets of images and I have tried to do it in lots of ways using the same expression but it doesn't work.
This one works well for the first set of images but as soon I add more images as a different set with a different slider, even in a different adjustment layer, only one set works. I need to add at least three image sets inside the same composition. Thank you in advance for your help Dan.



Cheers.

s = thisComp.layer("EMOJI 01").effect("EMOJI_02")("Slider").value;
if (Math.round(s) == index) 100 else 0


Return to posts index

Dan Ebberts
Re: Switching Opacity inside the same comp
on Sep 27, 2017 at 3:41:44 pm

It should work if you set the slider to 18 for the start of the second group. If you want the indexing to start over with each group, you need to do something like this:

s = thisComp.layer("EMOJI 01").effect("EMOJI_02")("Slider").value;
firstLayer = thisComp.layer("Layer 72");
if (Math.round(s) == (index-firstLayer.index+1) 100 else 0


Dan



Return to posts index

Marcelo Cabral
Re: Switching Opacity inside the same comp
on Sep 27, 2017 at 6:43:14 pm

Hi Dan
It works perfectly!! I have now three groups and I have adjusted each slider from 0 to 50 and they work fine.
Amazing support man. As we usually said in Argentina "El que sabe, sabe." (who knows, really knows.!)
Thank you!!

Marcelo


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]