Getting max and min values from expressions

Moderators: Disciple, zlovatt

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Often I write an expression to animate and object and then use that animation to drive another property. I use linear() and ease() a lot to transpose animation from one type of property to another. The part that takes so long is trying to figure out what the max and min value is of the data you feed into the interpolation. Is there a way to do the interpolation without having to figure out what values your expression goes to? For instance, I have a sin wave driving the Y position, and the rotation is driven from the position. I then have to jump to different times to find approximatley what my max Y and min Y are to put into linear(). Then if I change the expression on Y, I have to do it over again.
Any ideas?
vidpat
Posts: 86
Joined: October 21st, 2004, 12:36 am
Location: Phoenix, AZ
Contact:

If I follow correctly, you could do the calculations in a normalized space and then, at the last minute, apply pixel dimensions for positioning on a layer.

The basic expressions can be computed over a normalized range [0.0..1.0] in an expression control (possibly on a null layer). That way, the bounds for the interpolation functions would always be 0.0 and 1.0. When using sine and cosine, the range is of course [-1.0..1.0] so you'll need to do

Code: Select all

aprime = Math.sin(a) * 0.5 + 0.5
to normalize the value.

Once you have the animation over the normalized space, you can just multiply the x' and y' values by the width and height of the comp when you apply the values to a property.

Hope this makes sense.
Post Reply