348 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+6 more
andrenavarre says

Hmmmm. How to explain this.

I want to use a checkbox effect to enable/disable expressions on multiple layers (you know the ”=” / “not equals” switch). Is this even possible?

2630 posts aspire to create - create to inspire
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helped several times protecting Envato Market against copyright violations
  • Has sold $125,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
+10 more
Creattive says

Hi, try something like this:

if (“pickwhip with checkbox” == true){ “your expression” } else {value;}

replace the commands in ” of course ;)

64 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+3 more
_Terry says

Sup,

What I do in this sort of situation is just multiply it like this: cheackbox * the value I want to negate so if its opacity when its true results in the original value and when its false is 0

348 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+6 more
andrenavarre says

Thanks for your comments guys. I knew this would be difficult for me to explain. Let me be more explicit.

I’m trying to rig a color controller with 2 options: Universal color and Individual color.

I want it so that there’s a master controller that sets a color universally to all linked layers. That’s the easy part. I added an expression color control to a null, then pickwhip all the layers’ color values to that null’s color controller. The null’s color now controls all the slave layer’s colors.

Here’s where I’m stuck: I want to also have an option to include individual color controls too (disable the master color control), without having to go to every linked slave layer and disable all the expressions manually.

So I want to have a checkbox that disables and enables the expressions linking the colors to the null color controller.

Maybe I’m approaching this wrong?

2412 posts Small, but tough
  • Has referred 500+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+9 more
EFEKT_Studio says

No, you’re not. I know what you mean. Place this on color fill on your layers.

if(thisComp.layer(“Null 1”).effect(“Checkbox Control”)(“Checkbox”)==false){

thisComp.layer(“Null 1”).effect(“Color Control”)(“Color”)}

else {effect(“Fill”)(“Color”)}

So, if(controllNull checkbox==false{ use color from null} else {use color from layer’s fill} Get it?

5255 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
+11 more
felt_tips Moderator says

Sup, What I do in this sort of situation is just multiply it like this: cheackbox * the value I want to negate so if its opacity when its true results in the original value and when its false is 0

You have to be a bit careful with that one. To explain, we tend to use a shorthand in After Effects expressions.

layer("X").effect("Checkbox Control")("Checkbox")

...and we expect this value to be 1 or 0, because that’s what values a checkbox can have (1/0 true/false). But in actual fact, the expression in its full form should read like this.

layer("X").effect("Checkbox Control")("Checkbox").value

the .value at the end explicitly takes you to the value of the Checkbox object. After Effects is quite clever and is usually able to work out that you mean the value of the checkbox… but not in all situations. I find that it pays to be explicit, actually with all expressions, but particularly with checkboxes.

If you don’t believe me, put the above two lines of code into the Source property of a text layer with a .toString() on the end. :)

5255 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
+11 more
felt_tips Moderator says

No, you’re not. I know what you mean. Place this on color fill on your layers.

if(thisComp.layer(“Null 1”).effect(“Checkbox Control”)(“Checkbox”)==false){

thisComp.layer(“Null 1”).effect(“Color Control”)(“Color”)}

else {effect(“Fill”)(“Color”)}

So, if(controllNull checkbox==false{ use color from null} else {use color from layer’s fill} Get it?

Bingo!

A bit more shorthand though…with property references split out in to variables (this is a good way to work for intelligibility). If the expression is on the Fill->Color property, you can refer to that simply by “value”...this gives the pre-expression value of the property. For expression controls, I always use (1) property index instead of the name of the property, because expression controls effects only ever have one property.

CtrlLyr = thisComp.layer("Null 1");
tSwitch = CtrlLyr.effect("Checkbox Control")(1).value;
tColor = CtrlLyr.effect("Color Control")(1).value;
tSwitch ? tColor : value;

The last line is a ternary. It’s basically the same as a simple “if then else”...

if(a){x=b}else{x=c}

is the same as…

x=a?b:c
348 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+6 more
andrenavarre says

You guys… ARE THE BEST ! Thanks so much for your help Creattive, _Terry, EFEKT _Studio and of course felt_tips for the finishing polish! I would have been really stuck without you!

Can you please send me your addresses so I can send you BEER and FLOWERS (for the girlfriends, or for the garden).

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by