Monday 28 January 2013

Interpolation Methods


Interpolation Methods

After Effects provides some very handy global interpolation
methods for converting one set of values to another.
Say you wanted an Opacity expression that would fade in
over half a second, starting at the layer’s In point. This is
very easily accomplished using the linear() interpolation
method:
linear(time, inPoint, inPoint + 0.5, 0, 100)
As you can see, linear() accepts fi ve parameters (there is
also a seldom-used version that accepts only three parameters),
which are in order
. Input value that is driving the change
. Minimum input value
. Maximum input value
. Output value corresponding to the minimum
input value
. Output value corresponding to the maximum
input value


In the example, time is the input value (fi rst parameter),
and as it varies from the layer’s In point (second parameter)
to 0.5 seconds beyond the In point (third parameter),
the output of linear() varies from 0 (fourth parameter)
to 100 (fi fth parameter). For values of the input parameter
that are less than the minimum input value, the output of
linear() will be clamped at the value of the fourth parameter.
Similarly, if the value of the input parameter is greater
than the maximum input value, the output of linear() will
be clamped to the value of the fi fth parameter. Back to the
example, at times before the layer’s In point the Opacity
value will be held at 0. From the layer’s In point until
0.5 seconds beyond the In point, the Opacity value ramps
smoothly from 0 to 100. For times beyond the In point +
0.5 seconds, the Opacity value will be held at 100. Sometimes
it helps to read it from left to right like this: “As the
value of time varies from the In point to 0.5 seconds past
the In point, vary the output from 0 to 100.”
The second parameter should always be less than the third
parameter. Failure to set it up this way can result in some
bizarre behavior.
Note that the output values need not be numbers. Arrays
work as well. If you want to slowly move a layer from the
composition’s upper-left corner to the lower-right corner
over the time between the layer’s In point and Out point,
you could set it up like this:
linear(time, inPoint, outPoint, [0,0],
➥[thisComp.width, thisComp.height])
There are other equally useful interpolation methods in
addition to linear(), each taking exactly the same set of
parameters. easeIn() provides ease at the minimum value
side of the interpolation, easeOut() provides it at the
maximum value side, and ease() provides it at both. So if
you wanted the previous example to ease in and out of the
motion, you could do it like this:
ease(time, inPoint, outPoint, [0,0], [thisComp.width,
➥thisComp.height])


No comments:

Post a Comment