Monday 28 January 2013

What Expressions Are


What Expressions Are

The After Effects expression language is a powerful set of
tools with which you can control the behavior of a layer’s
properties. Expressions can range in complexity from
ridiculously simple to mind-numbingly complicated. At the
simple end of the spectrum, you can use expressions to
link one property to another or to set a property to a static

value. At the other extreme, you can create complex linkages,
manipulate time, perform calculations in 3D space,
set up tricky procedural animations, and more.
Sometimes you’ll use expressions instead of keyframes
(most properties that can be keyframed can be controlled
by expressions). In other cases you’ll use expressions to augment
the keyframed behavior. For example, you could use
keyframes to move a layer along a specifi c path and then
add an expression to add some randomness to the motion.



Expressions Have Limitations
Although the After Effects expression language presents you with an impressive
arsenal of powerful tools, it’s important to understand the limitations of expressions
so that you can avoid making assumptions that lead you astray.
. An expression may generally be applied only to a property that can be keyframed,
and it can affect only the value of that property. That is, a expression can
affect one, and only one thing: the value of the property to which it is applied.
This means there are no global variables. This also means that although an
expression has access to many composition and layer attributes (layer width and
height, for example) as well as the values of other properties, it can only read,
not change, them.
. Expressions can’t create objects. For example, an expression cannot spawn a new
layer, add an effect, create a paint stroke, change a blend mode—the list goes on
and on. Remember, if you can’t keyframe it, you can’t create an expression for it.
. Expressions can’t access information about individual mask vertexes.
. Expressions can’t access text layer formatting attributes, such as font face, font
size, leading, or even the height and width of the text itself.
. Expressions cannot access values they created on previous frames, which
means expressions have no memory. If you’ve had a little Flash programming
experience, you might expect to be able to increment a value at each frame.
Nope. Even though you can access previous values of the property using
valueAtTime(), what you get is the pre-expression value (the static value
of the property plus the effect of any keyframes). It’s as if the expression didn’t
exist. There is no way for an expression to communicate with itself from one
frame to the next. Note, however, just to make things more confusing, the postexpression
value of a property is available to any other expression, just not the
one applied to that property. In fact, the post expression value is the only value
available to expressions applied to other properties. To summarize: an expression
has access only to the pre-expression value of the property to which it is
applied, and it only has access to the post-expression values for other properties
with expressions. It’s confusing at first, but it sinks in eventually.


No comments:

Post a Comment