There are only two components to learning how to use expressions:
Expressions really do only one thing: translate data values. Granted, that's a little bit like saying your computer's hard drive only has ones and zeros on it, but it's useful to think of this. Fundamentally, there are three types of data with which expressions work:
Expressions can either link to these values where they are found among data in After Effects or fabricate the data using criteria that you, the user, specify. And generally, text is used as only a label for a layer or effect, not as an input/output valueso text almost doesn't count. So where do these numbers come from? Almost anywhere. They can derive from the basic transform data (position, rotation, scale, opacity, anchor point) of a layer, the current position on the timeline, the number in which the layer appears in the composition, the pixel dimensions of the source footage, whether or not a layer has a parent, and on and on. Pretty much every piece of numerical or Boolean data that exists in your After Effects project is accessible to expressions and can be used to create animations. Okay, What Can't Expressions Do?Expressions cannot evaluate certain types of data:
Nor can they handle certain complex effects data, such as effects channels that can be keyframed but whose keyframe values are not made up of four or fewer numerical values. For example, expressions work with RGBA datared, green, blue, and alpha channel values normalized between 0 and 1but they can't handle the Channel Range color control in Hue/Saturation.
So, although you can change the pixel values and audio levels of a layer using expressions, you can't sample a given pixel's RGB values, the decibel level of a soundtrack, or the position of a mask point. One other major limitation is that expressions are incapable of compounding data over time. In other words, calculations that involve a progression from frame to frame cause expressions to recalculate all frames prior to the current one as each new frame is loaded; in such cases, the further you get down the timeline, the longer frames require to render. For example, in After Effects 5.5 Magic (New Riders Publishing), I demonstrated drawing a spirograph shape over time using the Write On effect to add a series of dots to make a line. Each successive dot took longer to calculate its position than the one previous, because it had to know the positions of all of the dots up to that point to know what came next. If that still sounds confusing, don't worry about it; until you find yourself writing an expression that increments with time, you won't likely run up against it. |