Multiple checkbox related to each other with expressions Enquiry

Hello Guys,

I’ve been trying quite hard to get this to work but I can’t seems to figure it out alone.
I have 3 checkbox controls, all in one layer (R, B, G) to control three colour or anything for example if I checked R then my colour layer will change to Red and if I checked B it will change to Blue and so on based on the three combine checkboxes . And the rule for that is “if R checked in the box then the others un-checked and vice versa”.
image

The idea is a three way checkbox selection which coordinates with each other in the following way:

  • checkbox 1 - if ( (B ==1) || (G == 1)) false; else true;
  • checkbox 2 - if ( (R ==1) || (G == 1)) false; else true;
  • checkbox 3 - if ( (R ==1) || (B == 1)) false; else true;

It’s seems like all work fine but when I checked the boxes nothing would change on the effected layer that I linked it with all checkboxes.
If you managed to understand what I’m trying to do, I’d love to hear your thoughts about this and what I am doing wrong.


Here more details
I use this expression for each checkbox
R checkbox:

R = effect("R")("Checkbox");
T = effect("B")("Checkbox");
C = effect("G")("Checkbox");

if ((T == 1) || (C == 1)) {false} else  true;

B checkbox:

R = effect("R")("Checkbox");
T = effect("B")("Checkbox");
C = effect("G")("Checkbox");

if ((R == 1) || (C == 1)) {false} else true;

G checkbox:

R = effect("R")("Checkbox");
T = effect("B")("Checkbox");
C = effect("G")("Checkbox");

if ((T == 1) || (R == 1)) {false} else true;

And on the effected layer I did this rule:

Red = thisComp.layer("Red").effect("Fill")("Color");
Blue = thisComp.layer("blue").effect("Fill")("Color");
Green = thisComp.layer("Green").effect("Fill")("Color");

R = thisComp.layer("Controler").effect("R")("Checkbox");
B = thisComp.layer("Controler").effect("B")("Checkbox");
G = thisComp.layer("Controler").effect("G")("Checkbox");

if (R==1)  Red; 
else if (B==1) Blue;
else if (G==1) Green;
else value;

The project file in this link Project checkbox test


Many thanks

To be honest I don’t understand exactly what you’re trying to do, but if you want to have 3 options to control colors, wouldn’t it be easier to have 3 separate adjustments layer for each color and connect the opacity of the layer?

So you make 3 adjustments layers with red / green / blue fill colors, and you turn them on/off with the expression controls, through opacity. So, for example you add the expression to the opacity of the RED adjustment layer to something like

if(thisComp.layer(“Controler”).effect(“R”)(“Checkbox”) == 1) 100 else 0;

Thank you for your replay. I actually attached the project.
Basically I need to do three colour options only one of them must be selected at a time so for example if I select Red colour then the other two options (Blue & Green) will be deselected automatically.

Is it your meaning SkillLine?

  1. Creat a Null and 3 checkboxs. Set 3 checkboxs = 1.
  2. Use these expressions.
1 Like

Thank you very much GTMotion!
I followed your expressions. It’s very good solution but the only problem left when I try to check and unchecked the checkboxes the colour solid layer not responded.

Here I upload the project if you have some time.

I only use CS6 version on my PC, then I can’t open your file. For Color Change you can use effect Tint:

  • Use 3 Tint effects on the Solid.
  • Link Map White of Tint to Black (Link map Black to White if the original color is White).
  • Change 3 Tints to 3 different Colors.
  • Use these expressions.
  • Now if you check on Red, the solid will change to Red. If you uncheck all Checkboxs, the solid will go back to original color.
  • If you want to show/hide a Layer use expressions on first image to Opacity of the Layer.
1 Like

I think it’s impossible to do, because AE don’t “understand” the time when you press on checkbox. All 3 expressions in checkboxes works instantly (upper expression works first, then goes the second, then the lowest one. But this rule not always true.)
So to work it correctly you need some kind of “mechanism”, that disables all checkboxes’ expressions and triggers them when you press on one of checkbox. I think it’s impossible, but may be you are smarter then me.

2 Likes

Thank you GTMotion!
Actually it’s work now but only with AE CC 2014 and strangely the same project not work with AE CC 2015 and 2017.

project here with CC 2014 and it’s work completely fine.

Sorry SkillLine. I don’t install CC versions on my PC because it isn’t good enough for CC versions, then I can’t go forward with you. I hope another guy helps you out on newer versions. :innocent:

1 Like

I open your project in CC 2014. It works, but not every time. And sometimes it works when I don’t click on checkbox, just hold the mouse over it.

1 Like

Many thanks GTMotion and DOGmotion,
Actually the problem in the software itself not in the expression and it’s not good idea to use this method for customers and . It’s really huge wast of time. Maybe I’ll go to the slider like GTmotion said.

1 Like

Or buy this script and use popup list instead of checkboxes.
image

2 Likes

many thanks DOGmotion
it’s good idea as well.