FORUMS: list search recent posts

Use Comp Name to drive position expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
criis daw
Use Comp Name to drive position expression
on Oct 25, 2012 at 12:28:22 pm

Hi Everyone..

I have tried following some previous threads but cant get it to work so i give up.. I'll ask

I am trying to get the comp name , specifically the last number to determine to position of a layer in the comp.

ie

Screen01_frame01_flap_01

etc I would like to be able to link the y postion to the number of the flap.

Anyone ??


Return to posts index

Dan Ebberts
Re: Use Comp Name to drive position expression
on Oct 25, 2012 at 3:25:30 pm

Something like this should work:

nameSplit = thisComp.name.split("_");
compNum = parseInt(nameSplit[nameSplit.length-1],10);
value - [0,compNum*100]

Dan



Return to posts index

criis daw
Re: Use Comp Name to drive position expression
on Oct 26, 2012 at 9:58:14 am

thanks for that..

will try it now..

back in a minute when i mess it up ..

cheers



Return to posts index


criis daw
Re: Use Comp Name to drive position expression
on Oct 29, 2012 at 4:06:15 pm

Hi

dont supose you could help me a little more could you .

I copy the expression into the postion property and I understand how the y postion is calculated.


for example comp number 17 in a comp 52 pixels high ends up with a Y value of -2530.

why is that ..?

If I understood how this number is attained I could make it so I get the number I want which is, (comp number-1)*52 . the height od the comp

thanks



Return to posts index

criis daw
Re: Use Comp Name to drive position expression
on Oct 29, 2012 at 4:19:37 pm

ahhh

its ok .

I figured out why it was not what I expected. the expression is applied to the value of the layer .. which I had already set...I works fine if I reset it to zero.

Still If you have 5 minutes to explain a little i would be very thankful.

cheers

Chris



Return to posts index

Dan Ebberts
Re: Use Comp Name to drive position expression
on Oct 29, 2012 at 10:48:21 pm

The part that converts the comp name to a number? It's all core JavaScript. The split() function to split the comp name into an array of strings, using "_" as the delimiter. The comp number will be in the last element of the array, which you access with nameSplit[nameSplit.length-1]. Then you use parseInt() to convert the string version of the number to a decimal number.

Dan



Return to posts index


criis daw
Re: Use Comp Name to drive position expression
on Oct 30, 2012 at 5:26:54 pm

thanks..

i understand i a little better.

thanks for your help with this



Return to posts index

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