Convert an expression to keyframes, The expression language – Adobe After Effects User Manual
Page 679
You apply Expression Controls effects to a layer in the same ways that you apply other effects, such as dragging the effect onto the layer from the
Effects & Presets panel.
You can apply Expression Controls effects to any layer; however, it is useful to apply them to a null layer, which you can simply use as a
controlling layer. You then add expressions to properties on other layers to take input from that control. For example, you can add the Slider
Control effect to a null layer (Null 1), and then apply this expression to the Position properties of multiple layers:
position+[0,10*(index-1)*thisComp.layer("Null 1").effect("Slider Control")("Slider")]
In this example, as you drag the slider, each layer with this expression moves. The layers with greater index numbers (layers toward the bottom in
the Timeline panel) are shifted more than the layers with lower index numbers, at 10-pixel intervals. You can set keyframes for the slider on the
null layer, and all of the other layers animate accordingly.
It is often useful to rename each instance of an Expression Control effect to indicate its use. For example, renaming an instance of the Color
Control effect to sky color makes it easier to tell what the effect is controlling. You can rename each instance of an Expression Control effect just
as you rename any other effect: select it in the Timeline panel or Effect Controls panel and press Enter on the main keyboard (Windows) or Return
(Mac OS).
To modify the range of a control, right-click (Windows) or Control-click (Mac OS) the underlined property value for the control and choose Edit
Value from the context menu.
Additional resources about Expression Controls effects
Jerzy Drozda, Jr. (Maltaannon) provides a simple explanation and demonstration of the Angle Control effect and Expression Controls effects in
general on the
Aharon Rabinowitz’s three-part “After Effects Expression Controls” series of video tutorials on the
introduces the
Expression Controls effects and shows some basic examples of their uses.
Todd Kopriva provides instructions for using the sampleImage method and the Point Control effect to monitor colors for a specified point during
.
Convert an expression to keyframes
In some situations, it’s useful to convert an expression to keyframes. For example, if you want to freeze the values in an expression, you can
convert the expression to keyframes and then adjust the keyframes accordingly; or, if an expression takes a long time to evaluate, you can convert
it to keyframes so that it renders more quickly. When you convert an expression to keyframes, After Effects evaluates the expression, creating a
keyframe at every frame, and then disables the expression.
In the Timeline panel, select the property on which the expression is written and choose Animation > Keyframe Assistant > Convert
Expression To Keyframes.
The expression language
The After Effects expression language is based on JavaScript 1.2, with an extended set of built-in objects. After Effects uses only the core
standard JavaScript 1.2 language, not the web browser–specific extensions. After Effects contains its own set of extension objects—such as Layer,
Comp, Footage, and Camera—that you can use to get most of the values in an After Effects project.
Though the expression language is based on a scripting language, a subtle but important difference exists between a script and an expression:
Whereas a script tells an application to do something, an expression says that a property is something.
For more information about JavaScript, see a JavaScript reference resource.
When creating expressions, keep in mind the following:
The value of an expression is the value of the last statement evaluated.
675