ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Spacing between layers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brian Holzknecht
Spacing between layers
on Nov 6, 2019 at 2:01:18 am

So I have a pretty basic setup, I just have a bunch of layers lined up and have a slider control to control spacing, but what I also want, is an additional slider control to control spacing of every 3rd layer, and I'm not sure how to go about that. Here is the current expression I have on all the layers position.

Thanks,

Brian

xPos = thisComp.layer("expression").effect("location")("Point")[0];
yPos = thisComp.layer("expression").effect("location")("Point")[1];

spacing = thisComp.layer("expression").effect("spacing")("Slider");

[(xPos)+((index-1)*spacing), yPos]


Return to posts index

Jakob Wagner
Re: Spacing between layers
on Nov 6, 2019 at 11:39:11 am

Hi Brian

Try this:

layerIndex = (index-1);

xPos = thisComp.layer("expression").effect("location")("Point")[0];
yPos = thisComp.layer("expression").effect("location")("Point")[1];

spacing = thisComp.layer("expression").effect("spacing")("Slider");
groupSpacing = thisComp.layer("expression").effect("group spacing")("Slider");
groupSize = thisComp.layer("expression").effect("group size")("Slider");

layerSpacing = Math.floor(layerIndex/groupSize)*groupSpacing + layerIndex*spacing;

[xPos+layerSpacing, yPos];


I have added a couple more sliders. If you want you can simply set groupSize to 3, but I thought it was fun to have it as a slider.

All the best
Jakob Wagner


Return to posts index

Brian Holzknecht
Re: Spacing between layers
on Nov 6, 2019 at 5:13:59 pm

Thanks Jakob,

That worked perfectly and much simpler than I thought it would be. Much appreciated.

Brian


Return to posts index


Jakob Wagner
Re: Spacing between layers
on Nov 6, 2019 at 5:35:04 pm

You're welcome. :)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]