Skip to main content
Participating Frequently
March 8, 2020
Answered

After Effects - Checkbox Control expression to fill effect.

  • March 8, 2020
  • 1 reply
  • 15364 views

Hello! How can I create an expression for checkbox Control to "Fill" effect in a PNG logo? I would like that when the checkbox is marked, the logo takes on the solid color filling, and when disabled keep the original colors of the logo. Can anyone help me with this issue? Thanks!

Correct answer Roland Kahlenberg

This is the Expression you need -

 

if(effect("Checkbox Control")(1)==1) {100} else {0}

--------------

The image below provides context on where to apply the Expression.

 

1 reply

Roland Kahlenberg
Roland KahlenbergCorrect answer
Legend
March 8, 2020

This is the Expression you need -

 

if(effect("Checkbox Control")(1)==1) {100} else {0}

--------------

The image below provides context on where to apply the Expression.

 

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
Participating Frequently
March 8, 2020

Thanks for the answer! I don't know if I did something wrong, but the checkbox only worked when the checkbox control was applied to the same layer as the fill, my intention is to use the checkbox applied to a layer of controllers, created from a null object. After Effects pointed out an error in the expression when used in this way (I applied the expression in the location indicated in the image you sent and with the pick whip I applied the Effect Opacity of the Fill to the checkbox control placed on the null object, I got an error).

 

What could I have done wrong?

Community Expert
March 8, 2020

You have to point the expression to the layer that contains the checkbox. Expression basics.

 

The easiest solution is to declare a variable for the checkbox control by typing something like this:

chkBx = thisComp.layer("Null 1 Controller").effect("Checkbox Control")("Checkbox");
if (chkBx == 1)
	100
else
	0

This assumes the layer that contains the Checkbox Control is named "Null 1 Controller" and you have not renamed any of the layers. I prefer this format because it is very easy to tell what you are doing.

 

You can easily define a layer and effect control by simply typing chkbx = and then dragging the pickwhip to the Checkbox Control's Checkbox.