Page 1 of 1

align layers along a path

Posted: November 2nd, 2009, 8:05 am
by vranan
I am trying to align an n-amount of layers (ie 10) to distribute themselves along a path I have drawn in Illustrator. Now I know you can copy a path for Illustrator into a mask and then copy the mask into the layer's position property, but is there a way to automatically distribute my layers equally along any given path. Any help is appreciated.


Re: align layers along a path

Posted: November 2nd, 2009, 2:42 pm
by kobyg
You could copy your path to the position of a NULL layer, making it move according to your path,
and then use the valueAtTime expression to sample that position to each of your 10 layers, using the layer's index in order to sample at a different time.
You could use a slider to change the spacing between your layers.

The expression should be something like:

Code: Select all

dt = effect("Slider Control")("Slider");
thisComp.layer("Null 1").transform.position.valueAtTime(index*dt)

Re: align layers along a path

Posted: November 3rd, 2009, 6:58 am
by vranan
Hi Koby,

thanks for your help, it's working a treat. I was wondering if there is a way to auto orient my layers along the path (ie a spiral). I've auto orientated the Null to move along the path, but my layers wont follow (neither when I set all my layers to auto orient) :(

Thank you,

Re: align layers along a path

Posted: November 3rd, 2009, 8:59 am
by kobyg
Hi Nino,

The Auto-orient will not work...
However you can use another expression for the Orientation :)
This expression will make the layer look at the tangent direction of the original path, using the lookAt expression.
It should look something like:

Code: Select all

nullPos = thisComp.layer("Null 1").position;
dt = thisComp.layer("Null 1").effect("Slider Control")("Slider");
T = thisComp.frameDuration;
p0 = nullPos.valueAtTime(index*dt);
p1 = nullPos.valueAtTime(index*dt+T);
or you could use a simpler expression, that will make each layer look at the next layer (which is a bit different, and less accurate, but will seem quite similar):

Code: Select all

p0 = position;
p1 = thisComp.layer(index+1).position;
Note that if you use the second expression, you would need a bit different expression for the LAST layer, because of the (index+1) phrase, or else you would get an error...
so you could make the last layer look at the previous layer (index-1) instead of the next layer (index+1).


Re: align layers along a path

Posted: November 16th, 2009, 10:28 am
by vranan
Hi Koby,

sorry was busy finishing project that i never said thank you for all your help!

Re: align layers along a path

Posted: January 7th, 2011, 6:05 am
by sameervalva
Hi kobyg

Can We Make all layers depend on the a slider control added to the null so we can change the value of the distance from one layer instead of changing it from each layer

Thanks alot

Re: align layers along a path

Posted: January 8th, 2016, 2:01 pm
by alchemist988
Hello everyone

I hope that someone will see this post or I should post new one...?

I have one problem to solve. I am currently working on 2D animation in which I have to solve problem of bulldozer truck movement, and also movements of joints of the arm. I know how to animate rotating wheels by using this expression which i apply on rotation property of the wheel.


So now I have to find solution how to animate truck rotation of some vehicle in my situation it's bulldozer but it can be tank or some other... Here is the picture, and also I need the best way to animate arm movement, so it imitate sand digging in most "natural" way.

Buldozer 2.jpg
Buldozer 2.jpg (324.25 KiB) Viewed 9312 times
(This is sample picture of my 2D work that I need to animate. there is about 37 yellow triangles that represent bulldozer trucks. I need solution how to make them move (rotate) along the path and if possible how to write expression to avoid key-framing. I have created this picture in Illustrator and every single triangle is on separate layer)

Also if someone has ideas for how to animate sand movement during digging it would be great.

Thanks in advance.