Andy Ford's tutorial for Even Layer Spacing in Adobe After Effects

After Effects Tutorial – Even Layer Spacing

If you want layers evenly spaced in a composition, there’s a handy expression for that.

First, create a position expression and make a variable. The variable is going to equal the index of the layer, and then be divided by the number of layers in the composition plus one. This gives a value between 0 and 1, because the index must at least be 1. Then, all of this is multiplied by the width of the composition. This gives a result that is between 0 and the width of the composition. This equation scales with additional layers, thus keeping even spacing between them.

var spacing = thisLayer.index/(thisComp.numLayers+1)*thisComp.width;

Since this is position, the value must be returned as an array. So, if you want to use the variable for the X position, then include the variable name there and use the unchanged Y position.


This should all be done in a separate composition because the equation reads the index value. This is because if you add an additional layer in the composition on top of these layers, it will alter the positioning of the layers.

Some contents or functionalities here are not available due to your cookie preferences!

This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

Shape Layer Wave in After Effects
Here’s a quick way to make a wave shape by essentially just …
Whip-Swish Pan in After Effects
Use After Effects to create your own transitions between clips. One interesting …

Enjoying this tutorial? Sign up for the Creative COW Newsletter!

Sign up for the Creative COW newsletter and get weekly updates on industry news, forum highlights, jobs, inspirational tutorials, tips, burning questions, and more! Receive bulletins from the largest, longest-running community dedicated to supporting professionals working in film, video, and audio.

Enter your email address, and your first and last name below!

Sign up:

* indicates required


We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy