Activity › Forums › Adobe After Effects Expressions › Three checkboxes
-
Three checkboxes
Posted by Usa Qmuri on March 8, 2015 at 3:03 amHi
I’m newbie here and i need some helpi have a three checkboxes and i need expression which can automatically disable two of them, when one of them is turned on.
Detailed: if i turn on the first checkbox then the other two should be automatically disabled and etc…
https://s4.postimg.org/oql31g0p9/Capture.jpg
Is it possible?
Thanks
Chris Scalzo replied 11 years, 4 months ago 4 Members · 3 Replies -
3 Replies
-
Dan Ebberts
March 8, 2015 at 7:20 amI don’t believe it can be done in a reliable way. Each of the three expressions feeds into the other two and I don’t think you can set it up so that it will work correctly in all situations.
Dan
-
Kevin Camp
March 9, 2015 at 8:12 pmi’ve had some success by adding an addition slider control and using that to hold a value that would be used to help control the checkboxes…
try adding a slider to the same layer as your checkboxes, and manually set the value to 4 (or a value higher than the number of checkbox controls — for some reason this seems to make it work). then add an expression like this to the slider value (set checkbox names as needed for your setup):
if ( effect("Checkbox Control")("Checkbox") == true ) 0;
else if ( effect("Checkbox Control 2")("Checkbox") == true ) 1;
else if ( effect("Checkbox Control 3")("Checkbox") == true ) 2;
else 0;then use an expression like this on the first checkbox:
if ( effect("Slider Control")("Slider") == 0 ) true else false;
and the second:if ( effect("Slider Control")("Slider") == 1 ) true else false;
and the third:if ( effect("Slider Control")("Slider") == 3 ) true else false;i put the slider at the bottom of the effects stack, but i’m not sure that matters.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
Chris Scalzo
March 16, 2015 at 7:17 pmDepending on what you are switching, you can create a precomp with solids labeled for choices and read the results of a layer control. Then you’d only get one of your three choices.
As an example, I made a precomp named “Pre-comp 1” and three layers named “OPT-1″,”OPT-2” and “OPT-3”.
With the following expression I can return the value 1, 2 or 3 to change whatever else.
if (comp(“Pre-comp 1”).layer(“OPT-1”).effect(“Layer Control”)(“Layer”) == comp(“Pre-comp 1”).layer(“OPT-1”)){1};
if (comp(“Pre-comp 1”).layer(“OPT-1”).effect(“Layer Control”)(“Layer”) == comp(“Pre-comp 1”).layer(“OPT-2”)){2};
if (comp(“Pre-comp 1”).layer(“OPT-1”).effect(“Layer Control”)(“Layer”) == comp(“Pre-comp 1”).layer(“OPT-3”)){3};
Reply to this Discussion! Login or Sign Up