Skip to main content
Participating Frequently
Mar 8, 2020 1:17 AM UTC
Answered

After Effects - Checkbox Control expression to fill effect.

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!

Roland Kahlenberg
Roland KahlenbergCorrect answer
Legend
Mar 8, 2020 1:58 AM UTC

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

8 replies

Roland Kahlenberg
Roland KahlenbergCorrect answer
Legend
Mar 8, 2020 1:58 AM UTC

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.

 

Translate
Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
Participating Frequently
Mar 8, 2020 3:24 AM UTC

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?

Translate
Community Expert
Mar 8, 2020 5:40 AM UTC

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.

Translate