align layers along a path

Moderators: Disciple, zlovatt

Post Reply
vranan
Posts: 13
Joined: February 8th, 2005, 9:53 am
Contact:

Hi,
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.

Nino
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

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)
Koby.
vranan
Posts: 13
Joined: February 8th, 2005, 9:53 am
Contact:

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,
Nino
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

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);
lookAt(p0,p1)
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;
lookAt(p0,p1)
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).

Koby.
vranan
Posts: 13
Joined: February 8th, 2005, 9:53 am
Contact:

Hi Koby,

sorry was busy finishing project that i never said thank you for all your help!
sameervalva
Posts: 4
Joined: May 21st, 2010, 2:39 am

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
alchemist988
Posts: 1
Joined: January 8th, 2016, 1:12 am

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.

d=width;
pi=Math.PI;
circ=d*pi;
rot=360/circ;
movex=thisComp.layer("sasija").transform.position[0];
scaler=thisComp.layer("sasija").transform.scale[0]/100;
rot*movex

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.

Picture:
Buldozer 2.jpg
Buldozer 2.jpg (324.25 KiB) Viewed 31072 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.
Post Reply