ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression for checkboxes to change text

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Thomas Crimmins
Expression for checkboxes to change text
on Oct 14, 2017 at 9:36:53 am

Hi guys,

Long time lurker, first time poster. I'm pretty inexperienced with expressions too. I'd like to know if someone can help me with achieving the following using expressions.

I would like to be able to control the source text of a text layer by clicking 1 of 7 different checkboxes. So for simplicity's sake (for me mainly) I mean if the first checkbox is checked of which corresponds to the word 'dog' then the source text will display 'dog'. If I check on the second checkbox which corresponds to the word 'cat' then the source text will display 'cat' etc etc.

Also it would be good if by checking each checkbox not only would it change the source text but also it's position in the composition too.

I'm not sure how difficult all this is and I hope it makes sense. Any help will be much appreciated.

Many thanks.


Return to posts index

Dan Ebberts
Re: Expression for checkboxes to change text
on Oct 14, 2017 at 5:07:28 pm

You could play around with this for source text:


words = ["","one","two","three","four","five"];
cb1 = effect("Checkbox Control")("Checkbox").value;
cb2 = effect("Checkbox Control 2")("Checkbox").value;
cb3= effect("Checkbox Control 3")("Checkbox").value;
cb4 = effect("Checkbox Control 4")("Checkbox").value;
cb5= effect("Checkbox Control 5")("Checkbox").value;
idx = 0;
if (cb1) idx = 1
else if (cb2) idx = 2
else if (cb3) idx = 3
else if (cb4) idx = 4
else if (cb5) idx = 5;
words[idx]


and this for position:


cb2 = effect("Checkbox Control 2")("Checkbox").value;
cb3= effect("Checkbox Control 3")("Checkbox").value;
cb4 = effect("Checkbox Control 4")("Checkbox").value;
cb5= effect("Checkbox Control 5")("Checkbox").value;
y = 0;
if (cb2) y = 100
else if (cb3) y = 200
else if (cb4) y = 300
else if (cb5) y = 400;
value + [0,y]



Dan



Return to posts index

Thomas Crimmins
Re: Expression for checkboxes to change text
on Oct 14, 2017 at 9:21:15 pm

Thanks so much, Dan. Exactly what I was after!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]