ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Changing template colors with checkboxes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrew Nagy
Changing template colors with checkboxes
on Jan 12, 2018 at 4:04:50 pm

I am creating a motion graphics template for the company I work for. I would like to make it relatively easy for a less experienced user to quickly change the color of certain shape layers across several different comps in the template. Because I am adhering to our brand standards, this will be limited to a choice of four specific colors.

I set up a null in a settings comp with four checkbox effects—one for each color—and wrote an expression for each so that they function like radio buttons. This way, only one color option is selected at a time. That works fine. This is what the expressions for that look like.

Then, I created a shape in the same comp so the user has an easy visual reference of which color is selected and also so I could test the functionality. The expression I used for the Color property is below.

The problem I am having is that the swatch next to the Color property will change to the color of the selected checkbox but the shape layer only appears as the blue289 color no matter which checkbox is selected. Screenshot of it in action. And, if I change ANYTHING about the shape layer (for example, turning on motion blur, changing its position, etc.) whatever checkbox is selected deselects and the blue289 checkbox is selected.

Any ideas what I am doing wrong and how I can make this work? I have some fallback solutions (including "change the colors your own damn self") for how to allow the user to change the color but I really want to try and get this to work before going that route. I think this solution is elegant...if it would work.

c1 = comp("Color Settings").layer("Color Settings").effect("blue289")("Checkbox");
c2 = comp("Color Settings").layer("Color Settings").effect("blue633")("Checkbox");
c3 = comp("Color Settings").layer("Color Settings").effect("plum242")("Checkbox");
c4 = comp("Color Settings").layer("Color Settings").effect("green7718")("Checkbox");
blue289 = [0, 0.17, 0.36, 1];
blue633 = [0, 0.55, 0.69, 1];
plum242 = [0.51, 0, 0.33, 1];
green7718 = [0, 0.45, 0.43, 1];
black = [0, 0, 0, 1];

if (c1 == 1) blue289;
else if (c2 == 1) blue633;
else if (c3 == 1) plum242;
else if (c4 == 1) green7718;
else black;


Return to posts index

Dan Ebberts
Re: Changing template colors with checkboxes
on Jan 12, 2018 at 5:13:36 pm

I think all radio button simulations using checkbox expressions are doomed to failure. Essentially, what you have is an expression result dependent on the result of another expression which is dependent on the result of the first expression, creating an unstable loop. My advice (though less elegant) would be to use a slider.

Dan



Return to posts index

Andrew Nagy
Re: Changing template colors with checkboxes
on Jan 12, 2018 at 6:01:08 pm

I was afraid of that. Thanks for the input!


Return to posts index

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