Logic and Grammar

Table of contents:

There are two keys to an understanding of expressions:

  • You must understand the solution you are pursuing in a methodical, step-by-step fashion.
  • You must translate this ordinary language methodology to the logic and syntax of expressions, to lines of code.

Expressions 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 fundamentally, there are three types of data on which expressions do their work:

  • Numbers
  • Booleans (True/False or Yes/No)
  • Text strings (and text hardly comes into play; After Effects is mostly about numbers)

Expressions can either

  • Link to existing values found among data in After Effects
  • Fabricate new data using criteria that you, the user, specify

Numerical and logic data can come from almost anywhere in the world of After Effects. They can derive from

  • Basic transform data of a layer
  • Current time in the composition
  • The index number of a layer (its order in the composition)
  • Dimensions and duration of the source composition or footage
  • Either/or conditions about the layer, such as whether it has a parent

Essentially 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.


The After Effects expressions language is based on JavaScript (or, more precisely, ECMAscript, the standardized version), a scripting language that was originally devised for Web browsers at Netscape. Many functions that are fundamental to JavaScript, such as the ability to perform mathematical operations, work identically in After Effects. Of course, many other functions from JavaScript are specific to the Web and interactivity. Likewise, After Effects adds its own keywords, functions, and attributes; these use the same basic syntax and rules of JavaScript but would not be recognized by it.


What Can't Expressions Do?

Expressions cannot natively evaluate certain types of data:

  • Pixel values
  • Audio waveforms
  • Mask 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.

Therefore 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.

Expressions are also only ever aware of conditions at the current point in time. You can create expressions that create a progression over time, but every frame up to the current one has to be recalculated from scratch on each frame, causing the expression to run more and more slowly over time. This can make physical simulations (such as the motion of a spring or the progression of a pattern) impractical.

Muting Keyframes

Section I. Working Foundations

The 7.0 Workflow

The Timeline

Selections: The Key to Compositing

Optimizing Your Projects

Section II. Effects Compositing Essentials

Color Correction

Color Keying

Rotoscoping and Paint

Effective Motion Tracking

Virtual Cinematography


Film, HDR, and 32 Bit Compositing

Section III. Creative Explorations

Working with Light

Climate: Air, Water, Smoke, Clouds

Pyrotechnics: Fire, Explosions, Energy Phenomena

Learning to See


Adobe After Effects 7. 0 Studio Techniques
Adobe After Effects 7.0 Studio Techniques
ISBN: 0321385527
EAN: 2147483647
Year: 2004
Pages: 157

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net