Download Project File

How to Automatically Get the Size of Many Layers

How to Automatically Get the Size of Many Layers in After Effects

In this tutorial, Sergei Prokhnevskiy will show you how to automatically get the size of many layers using expressions in After Effects. Click here to learn more about expressions.

Code:

keyword = “ukramedia”;
widthList = [];

for(i = 1; i <= thisComp.numLayers; i++) {
layerPath = thisComp.layer(i);
layerWidth = layerPath.sourceRectAtTime().width;
if(layerPath.name.match(keyword)) {widthList.push(layerWidth)} else {};
}

Math.max(…widthList) + 100

Download Project File

5 FREE TIME-SAVING TOOLS!

Over 100,000 downloads & counting!

These 5 tools will seriously speed up your workflow and save you hours of wasted time. More than that, they could be the difference between being able to complete a project on time or not!