Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE AFTER EFFECTS: ForumAE BasicsAE ExpressionsTutorialsArticlesPodcastsMotion GraphicsTrainingCinema 4D

Re: CLAMP or LINEAR to limit scale?

Cow Forums : Adobe After Effects Expressions
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Return to Posts Index   •   Read Entire Thread   •   Reply To This Post


cow
Re: CLAMP or LINEAR to limit scale?
by Filip Vandueren on Jun 24, 2008 at 11:24:48 am

Hi David, position and scale are 2- (or 3-) dimensional properties. They have an x and a y component.
Motionscript uses an Array syntax or a list to assign those numbers.
For example: [100,50]
You can retrieve one component from a property by using it's index: x=0, y=1 like this:

x = position[0];
y = position[1];

since the linear() method likes to work with numbers, not lists/arrays, we apply the linear to x and y separately, then put the result back in a 2-dimensional array (because scale will give an error if it only gets a number as a result of the expression):


x_temp = thisComp.layer("UPDOWN").transform.position[0];
y_temp = thisComp.layer("UPDOWN").transform.position[1];

x_result = linear(x_temp, 150, 280, 65, 100);
y_result = linear(y_temp, 150, 280, 75, 100);

[x_result, y_result] ;



I hope that makes sense. You'll have to tweak the numbers in that linear expressions probably.



Return to Posts Index   •   Read Entire Thread   •   Reply To This Post


Current Message Thread:




Note: If you are a registered user and you do not see your name and email in the two respective fields above, you may reset your account cookies by clicking here. Your post will not be accepted if the name and email provided above are not currently registered in our database.

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


Message                Add Bold Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd Italic Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd Underline Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd Image Link Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd URL Link Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this button

Note: The following characters are HTML command 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. For more on how to post, click here.


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.



FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]