- September 5, 2017 at 11:43 pm
I was wondering if there was a way to control the color values used with the Fill effect based on whether a checkbox was checked or not. For example if i had a solid with the fill effect applied and I had an adjustment layer with 32 different checkboxes. One checkbox could be named Red, the other Blue and so on. Is there a way depending on which checkbox I check that the color values I assign in the expression become active? In other words multiple instances of if/else?
- September 6, 2017 at 6:31 am
Sure, here’s a simple example with 5 colors:
L = thisComp.layer("Controls");
else if (L.effect("Green")("Checkbox").value)
else if (L.effect("Blue")("Checkbox").value)
else if (L.effect("Yellow")("Checkbox").value)
else if (L.effect("Orange")("Checkbox").value)
- September 6, 2017 at 5:59 pm
You’re wonderful Dan, thank you very much for your expertise. Worked like a charm
- August 8, 2020 at 6:50 pm
I realize this is an older post, but I’m attempting to do the same thing. A toggle between two colors. However I can’t figure out the color system this is using. I’ve spent a while looking around online and I can’t find an answer.
Is there a way to do this with a hex code or rgb values?
- August 8, 2020 at 7:24 pm
The color channels are normalized to be between zero and one. You could use 0-255 values like this (example for yellow):
- August 9, 2020 at 1:53 am
You can also convert hex to this format using this expression that Dan Ebberts and Scott McGee figured out:
txt = “FFFFFF”; //the hex code
hex = parseInt(txt,16);
r = hex >> 16;
g = (hex & 0x00ff00) >> 8;
b = hex & 0xff;
Thanks! This worked for me, i was missing dividing it by 255 when i was trying it.
Thanks, this is good to know! It worked.
Log in to reply.