• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Change in Color Control Value Makes Checkbox Control True

New Here ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

The idea is if the Color Control is changed to anything BUT the white value, the Checkbox Control will activate (which turns on the fill effect on a separate layer). I'm having a hard time trying to figure out how to write the IF statement.

 

In my head, the logic is written out like this:
if(color control is greater than > color value number){ 

    checkbox 1/true;

}else value number unchanged{

    checkbox 0/false;

}

Honestly can't figure out how that would actually look like in AE - so any help would be appreciated.

OR - if there's a simpler way to turn on a separate fill layer by similar means, I'm open to that too.

 

Thanks!

Screen Shot 2020-06-23 at 11.17.10 PM.png

TOPICS
Expressions , How to

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

You don't require the Checkbox Expression Control. Just drop this Expression into the second layer's Fill Effect's "Effect Opacity" property.

 

a=thisComp.layer("Shape Layer 1").effect("Fill")(3);

if(a[0]==1 && a[1]==1 && a[2]==1 && a[3]==1) {0} else {100}

Roland_Kahlenberg_0-1592978066873.png

 

Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

LATEST

I think that I follow you. From the screenshot, it looks like you have added and renamed the Effect/Expression Controls/Color Control and renamed it Background Color in Layer 1. You have also added an Expression Controls/Checkbox to layer 2. When you change the color in the color control you want the checkbox to change states so that another layer can turn on Fill.

 

Color values are in a 4 digit array describing the decimal value of the Red, Green, Blue, and Alpha channels. The values are always a decimal value starting at zero. 1 is the maximum color value if the Project is set to 8 or 16-bit color. If the project is set to 32-bit color you can have color values above 1 but for practical purposes, 1 is the maximum value. White would be [1, 1, 1, 1]. 

 

You will have to set up a sample test for Red, Green, and Blue. Most color properties in effects do not use the alpha channel. Here's how I would write the expression:

 

 

sampleColor = thisComp.layer("Your Control Layer").effect("Color Control")("Color");
sRed = sampleColor[0];
sGreen = sampleColor[1];
sBlue = sampleColor[2];
if (sRed == 1 && sGreen == 1 && sBlue == 1)
	1
else
	0

 

 

Any color other than white [1, 1, 1, 1] sampled from any pixel with sampleImage or any color control will turn on the checkbox.

 

A slight modification to the expression will turn on the checkbox if the color sample has any kind of tint applied. In other words, if the color sample is not a perfect shade of gray the checkbox will be turned on if the sample is in the layer above the layer with the checkbox, regardless of the layer name.

sampleColor = thisComp.layer(index - 1).effect("Color Control")("Color");
sRed = sampleColor[0];
sGreen = sampleColor[1];
sBlue = sampleColor[2];
if (sRed == sGreen && sGreen == sBlue)
	0
else
	1

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines