To the top
To the top
Type /* at the beginning of the comment and */ at the end of the comment. Any text between /* and */ is ignored. For example:
/* This is a
multiline comment. */
For examples of this type of comment, see Save and reuse expressions.
Save and reuse expressions
Once you have written an expression, you can save it for future use by copying and pasting it into a text-editing application or by saving it in an
animation preset or template project. However, because expressions are written in relation to other layers in a project and may use specific layer
names, you must sometimes modify an expression to transfer it between projects.
You can define your own functions within expressions using normal JavaScript function syntax. In this example, a function is defined that
calculates the average of two values, and the last line uses this function:
function average(a, b)
{
return (a + b) / 2;
}
average(position, thisComp.layer(1).position);
Note: You must define each function fully within each expression in which it is used. There is no global library of functions that you can add to.
If you want to save an expression for use in another project, you should add comments to the expression. (See Add comments to an expression.)
You should also use variables so that you can change a value in one place rather than having to change it in several places.
For example, this expression has a multiline comment at the beginning that explains what the expression does and a short comment after a
variable is declared and initialized that tells what the variable is for:
/* This expression on a Source Text property reports the name
of a layer and the value of its Opacity property. */
var myLayerIndex = 1; // layer to inspect, initialized to 1, for top layer
thisComp.layer(myLayerIndex).name + ": \rOpacity = " + thisComp.layer(myLayerIndex).opacity.value
You can save an animation preset that includes an expression and reuse it in other projects, as long as the expression does not refer to properties
that don’t exist in the other projects. When you save a preset in which a property has an expression but no keyframes, only the expression is
saved. If the property has one or more keyframes, the saved preset contains the expression along with all keyframe values.
You can copy an expression from a layer property, with or without the keyframes for the property.
To copy an expression and keyframes from one property to other properties, select the source layer property in the Timeline panel, copy the
layer property, select the target layer properties, and paste.
To copy an expression from one property to other properties without copying keyframes, select the source property, choose Edit > Copy
Expression Only, select the target properties, and paste.
Copying an expression without keyframes is useful when you want to simultaneously copy multiple expressions and paste them onto one
or more new layers, or when you want to copy one expression and paste it onto more than one layer.
Note: As with pasting keyframes and other items, you can often paste the item into the target layer and rely on After Effects to determine which
property should be the target of the paste operation. For example, this works for copying Position properties from one layer to another, but you
must select the target property yourself if you are pasting an expression from a Position property into a Scale property.
Paul Tuersley provides the
pt_ExpressEdit script
for managing and editing expressions.
Expression Controls effects
Use an Expression Controls effect to add a control that you can use to manipulate the values of one or many properties by linking the property to
the control using expressions. A single control can affect several properties at once.
The names for the Expression Control effects indicate what type of property control they provide: Angle Control, Checkbox Control, Color Control,
Layer Control, Point Control, Slider Control. After Effects CS5.5 and later includes a 3D Point Control, as well.
If you apply an animation preset from the Animation Presets > Shapes > Backgrounds category, you can see a custom Animated Shape
Control effect in the Effect Controls panel. This custom effect is a specialized expression control effect that was created specifically for these
animation presets. You can copy and paste this effect to other layers, or you can save it as an animation preset itself so that you can apply it
elsewhere.
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.
Summary of Contents for 12040118 - After Effects Standard
Page 1: ...ADOBE AFTER EFFECTS Help and tutorials...
Page 2: ...What s New...
Page 21: ......
Page 23: ...Legal Notices Online Privacy Policy...
Page 27: ...Workspace and workflow...
Page 29: ...Legal Notices Online Privacy Policy...
Page 36: ......
Page 42: ...Importing from Adobe After Effects Legal Notices Online Privacy Policy...
Page 76: ...Projects and compositions...
Page 92: ...Importing footage...
Page 97: ...Legal Notices Online Privacy Policy...
Page 102: ......
Page 128: ...Layers and properties...
Page 140: ......
Page 171: ...Views and previews...
Page 185: ...Animation and Keyframes...
Page 206: ...Legal Notices Online Privacy Policy...
Page 241: ...Color...
Page 257: ...Legal Notices Online Privacy Policy...
Page 258: ...Drawing painting and paths...
Page 293: ...Text...
Page 314: ......
Page 325: ...Transparency and compositing...
Page 336: ...Legal Notices Online Privacy Policy...
Page 345: ...Effects and animation presets...
Page 380: ...Legal Notices Online Privacy Policy...
Page 513: ...Legal Notices Online Privacy Policy...
Page 514: ...Markers...
Page 518: ......
Page 524: ...Memory storage performance...
Page 544: ...Expressions and automation...
Page 560: ...Legal Notices Online Privacy Policy...
Page 582: ...Rendering and Exporting...
Page 601: ...Legal Notices Online Privacy Policy...
Page 603: ......