Tutorial 120: One Comp to Rule Them All

Joe Clay | Apr 20, 2018

This week, we take a look at Master Properties using the Essential Graphics Panel. While you can use them to make things like lower thirds comps with replaceable text, we're going to use them in a different way—using single comps of elements to generate more complex imagery.

We'll do that in a few different ways in this tutorial. This tutorial only scratches the surface of what is possible with this new After Effects feature.

For further information, please consult the following:


Here are the expressions used throughout the tutorial. First we'll start with the expressions used in the two element precomps. These expressions control the visibility of layers in the precomp with a controller that has a slider on it. The slider is exposed to the main comp as a master property. Note: these might scroll in your browser.

Index Selection

if (thisComp.layer("Controller").effect("Layer Index")("Slider") == index) { 100 } else { 0 };

This version of the selection expression checks the index number of the layer. If it matches the slider value, the layer is visible.

Layer Name Selection

if(this.name == thisComp.layer("Controller").effect("Index")("Slider")) { 100 } else { 0 };

This version of the expression above checks the name of the layer instead of the index, so there can be more than one layer visible in the main comp.

Improved Layer Name Selection

if(this.name.substr(0,2) == thisComp.layer("Controller").effect("Index")("Slider")) { value } else { 0 };

This version of the expression allows for more detailed names in layers that are to be show, so you can name something like 07 - box and it will show up if the slider is set to 7.

The remaining expressions are used to control the precomp elements within the main comps, especially with selecting what elements to show.

Radial Grid Selection

pos = transform.position;
num = thisComp.layer("Controller").effect("Slider Control")("Slider");
x = Math.pow(pos[0]-(thisComp.width/2),2);
y = Math.pow(pos[1]-(thisComp.height/2),2);
d = Math.sqrt(x+y);

This expression is applied to the master property slider, generally named Layer Index in the tutorial. The element chosen is based on the layer's proximity to the center of the composition.

Sample Image Selection


This expression is also applied to the Layer Index slider. The element chosen is based on the red values found on the Map layer. For the most predictable results, keep the image greyscale.

Digital Grain Selection

s = effect("Speed")("Slider");
max = thisComp.layer("Controller").effect("Items")("Slider");
seed = thisComp.layer("Controller").effect("Random Seed")("Slider");
seedRandom(Math.floor(time*s)+seed, true);

This expression, also applied to the Layer Index slider, determines which element is chosen randomly in the precomp.

Digital Grain Opacity

if(index < thisComp.layer("Controller").effect("Selection")("Slider") + 1) {
    v = effect("Visibility")("Slider");
    if (random(0,1) < v) { value } else { 0 };
} else {

This expression controls the visibility of the chosen elements.

Digital Grain Position

s = effect("Speed")("Slider");
seed = thisComp.layer("Controller").effect("Random Seed")("Slider");
seedRandom(Math.floor(time*s)+seed, true);
if(thisComp.layer("Controller").effect("Quantize")("Checkbox") == 1) {
    mul([Math.round(random(0,63))+.5, Math.round(random(0,35))+.5],30);
} else {

This expression controls the position of the chosen elements.

And that's it. It's a lot to figure out, but when you do it's going to open up a new world—especially if you're like me and you version small elements. Now you can just comp them all together in the same comp, and use sliders to pick out what you need.

Grab the Project Files

The best way to get our project files is to become a patron on Patreon. For $5 a month, you get access to all of the tutorial project files we've made available as well as other monthly projects, rigs, R&D, elements, early product previews, and BTS content not available anywhere else! You can also purchase just this project file on our Gumroad Store if you would rather do that.

Get access to all of our project files on Patreon or Get this single project file on Gumroad

Workbench tools are used by designers at hundreds of amazing companies