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
+7 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?

2982 posts aspire to create - create to inspire
  • Had an item that became a weekly top seller
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
Creattive
says

Hi, try something like this:

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

replace the commands in ” of course ;)

73 posts
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Had an item featured on Envato Market
  • Has sold $40,000+ on Envato Market
+5 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
+7 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?

2481 posts Small, but tough
  • Has referred 1000+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+12 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?

5311 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Had an item that was trending
  • Helps us moderate the forums
  • Became a Top 20 Author of the Month
+13 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. :)

5311 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Had an item that was trending
  • Helps us moderate the forums
  • Became a Top 20 Author of the Month
+13 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
+7 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).

by
by
by
by
by
by