dynamic on/off layer hide

Moderators: Disciple, zlovatt

Post Reply
rallyfanche
Posts: 2
Joined: January 21st, 2014, 9:27 am

January 21st, 2014, 9:44 am

Hello everyone. First and foremost, I did my best to do my homework, and im really stumped. Apparently, from the plethora of forum posts I've seen on this topic, I'm not the only one. So here goes:
I am trying to create a check box on/off control that will hide/unhide multiple layers. Now, I know that this can easily be done withe an if/else statement to the opacity channel. Which is great. The trouble is, not all of the layers are set to 100% opacity, and to add further complexity the layers need to maintain the flexibility to be changed (even animation).

So my question boils down to: is there a way I can store opacity values for each layer and link that to the checkbox control to turn on/off? Is there another way of doing this without variables (like just multiplying everything by -1(off) and then back to +1(on)? I literally dont know what expression to study, variables just seemed like the next logical step...
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

January 22nd, 2014, 1:31 am

If you add a null layer called "Opacity Controller" and an expression control "Checkbox Control" effect to it, you can use this expression on your other layers' Opacity properties in that comp.

Code: Select all

check = thisComp.layer("Opacity Controller").effect("Checkbox Control")("Checkbox").value;
if (check) 0;
else value;
"value" returns the pre-expression value for that property so you are only switching between that and zero.

If I were doing this as a script I would simply have the script add "0" expressions and remove them. You'd probably have to set it to work on selected layers only, in which case it may actually be more fiddly to do that each time compared to using the expression checkbox approach.

Paul
rallyfanche
Posts: 2
Joined: January 21st, 2014, 9:27 am

January 24th, 2014, 8:52 am

Paul...this...sounds....awesome. This really sounds like the answer! Will try it out today and see if I can get it to work! Thanks again! :)
Post Reply