After Effects: Express yourself with Expressions

One of the most powerful and yet often under utilised additions to After Effects from version 5 onwards is the inclusion of expressions. While its implementation may not be as strong or as easy as using Action Script in Flash 5, it has one critical advantage. One of the primary strengths of Flash is its ability to use scripting to calculate variables and attribute values on the fly, which keeps file sizes down and interactivity to a maximum. But what you cannot do with flash is to take an “Action-Scripted” animation and render it to use in broadcast or film – with After Effects you can. After Effects uses JavaScript 1.2 for expressions, so if you’re pretty handy with ActionScript or JavaScript or the like, there’s a lot you can do within After Effects.

To add an expression, with the relevant layer attribute highlighted select:

Animation > Add Expression.

Even if you are new to expressions and scripting, there is still a lot you can do, with some very basic in built expressions.

For example you can use the wiggle expression to randomly effect the values of various layer attributes for different effects:

try opacity.wiggle(10,50) for a faulty projector flicker effect, where 10 is frequency – changes per second, and 50 is the amplitude – the largest value the attribute will change.

try position.wiggle(5,10) for a film projector mis-registration effect or position.wiggle(50,50) for some violent camera shake > if you don’t want to see the edges of your layer and you don’t want to scale it beyond 100% don’t forget to render it out at a higher resolution before you comp it)

For added authenticity, you could also play around with expressions to get your artificial “hair in the gate” moving or make “fake film scratches” jump about. Of course the settings above are just a starting point. Try different settings for a variety of results, keeping in mind what resolution you a working with because it naturally effects what settings you need for particular results.

And remember, if your layer is a 3D layer, you can use expressions for movement in 3D as well.

Expressions for a layer attribute can also be used in conjunction with keyframes for that attribute, although you will need to turn the expression off when you set a keyframe, but you can then turn it back on again.

For some great information on expressions and some useful applications of trigonometry go to:

http://www.jjgifford.com/expressions/

Although I haven’t tried it yet, you may also want to check out the javascript plug-ins written by Freidrich Munch at:

http://homepage.mac.com/bresnev_shu/starts.html

Submitter: Peter Reynolds via mIke