Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE AFTER EFFECTS: HomeForumBasicsExpressionsTutorialsPodcastsMotion GraphicsTrainingCinema 4DFAQ

Position any number of layers between two others

Cow Forums : Adobe After Effects Expressions
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Position any number of layers between two others
by Jurij Magoga on May 18, 2009 at 8:55:07 am

Hi, this is my first attempt to write an expression, i would like to get suggestions on how to improve it..

I've found in AE help the expression to maintain one layer at a balanced distance between two other layers and i wanted it to work for any number of layers:


x2 = thisComp.layer("extr2").transform.position[0];
y2= thisComp.layer("extr2").transform.position[1];
pos2 = thisComp.layer("extr2").transform.position;
x1= thisComp.layer("extr1").transform.position[0];
y1= thisComp.layer("extr1").transform.position[1];
pos1= thisComp.layer("extr1").transform.position;

if (x1 >= x2&&y1 >= y2){ (((pos1-pos2)*(index-1))/(thisComp.numLayers-2)+pos2)
}else{
if (x1 < x2&&y1 >= y2){ [(((x2-x1)*(index-1))/(thisComp.numLayers-2)+x1),(y1-((y1-y2)*(index-1))/(thisComp.numLayers-2))]
}else{
if (x1 < x2&&y1 < y2){ [(((x2-x1)*(index-1))/(thisComp.numLayers-2)+x1),(((y2-y1)*(index-1))/(thisComp.numLayers-2)+y1)]
}else{
if (x1 > x2&&y1 < y2){ [(((x1-x2)*(index-1))/(thisComp.numLayers-2)+x2),(y2-((y2-y1)*(index-1))/(thisComp.numLayers-2))]
}
}
}
}





This expression is for the position of the layers between the two layers("extr2" and "extr1").
You can download the comp here:

http://rapidshare.com/files/234297399/equidistanza_2_layer.aep.zip

I will really appreciate any tip :)


Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:




Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Please post Expressions Code in the box below:


Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]