Save time and create animations quickly.
Expressions enable you to automate actions (such as wiggle, jitter or bounce). This saves significant time, in that you don't have to create new keyframes for each action. Here are a few examples to get you started.
- After Effects User Guide
- Beta releases
- Getting started
- Projects and compositions
- Importing footage
- Text and Graphics
- Motion Graphics
- Work with Motion Graphics templates in After Effects
- Use expressions to create drop-down lists in Motion Graphics templates
- Work with Essential Properties to create Motion Graphics templates
- Replace images and videos in Motion Graphics templates and Essential Properties
- Animate faster and easier using the Properties panel
- Drawing, Painting, and Paths
- Overview of shape layers, paths, and vector graphics
- Paint tools: Brush, Clone Stamp, and Eraser
- Taper shape strokes
- Shape attributes, paint operations, and path operations for shape layers
- Use Offset Paths shape effect to alter shapes
- Creating shapes
- Create masks
- Remove objects from your videos with the Content-Aware Fill panel
- Roto Brush and Refine Matte
- Layers, Markers, and Camera
- Animation, Keyframes, Motion Tracking, and Keying
- Motion tracking
- Transparency and Compositing
- Adjusting color
- Effects and Animation Presets
- Effects and animation presets overview
- Effect list
- Effect Manager
- Simulation effects
- Stylize effects
- Audio effects
- Distort effects
- Perspective effects
- Channel effects
- Generate effects
- Transition effects
- The Rolling Shutter Repair effect
- Blur and Sharpen effects
- 3D Channel effects
- Utility effects
- Matte effects
- Noise and Grain effects
- Detail-preserving Upscale effect
- Obsolete effects
- Expressions and Automation
- Expression basics
- Understanding the expression language
- Using expression controls
- Editing expressions
- Expression errors
- Using the Expressions editor
- Use expressions to edit and access text properties
- Expression language reference
- Expression examples
- Immersive video, VR, and 3D
- Construct VR environments in After Effects
- Apply immersive video effects
- Compositing tools for VR/360 videos
- Tracking 3D camera movement
- Work in 3D Design Space
- 3D Transform Gizmos
- Do more with 3D animation
- Preview changes to 3D designs real time with the Mercury 3D engine
- Add responsive design to your graphics
- Views and Previews
- Rendering and Exporting
- Basics of rendering and exporting
- H.264 Encoding in After Effects
- Export an After Effects project as an Adobe Premiere Pro project
- Converting movies
- Multi-frame rendering
- Automated rendering and network rendering
- Rendering and exporting still images and still-image sequences
- Using the GoPro CineForm codec in After Effects
- Working with other applications
- Collaboration: Frame.io, and Team Projects
- Memory, storage, performance
- Knowledge Base
Learn about the basics of creating and working with expressions.
Unlike a script, which tells the application to do something, an expression tells a property to do something.. For example, you have a ball moving across the screen from left to right, but you also want that ball to wiggle. Rather than animating the Position property with keyframes, you can apply a wiggle expression to it.
Here's a basic example of looping with expressions:
Why use expressions?
The expression UI
Before we get into working with expressions, the first step is to know the user interface. Use the following steps to get started:
Create a comp, and select Layer > New > Solid to create a solid layer.
In the Timeline panel, select the layer and press S on your keyboard to reveal the scale property. From here, your journey with expressions starts.
Let's create an expression. In the timeline panel, Alt+Click (Win) or Opt+Click (Mac) the stopwatch next to Position to add an expression to the property. After Effects assigns default expressions to all the properties which you can modify later.
Notice the changes in the user interface that take place from creating the expression. First, the value of the Scale property (shown as 100,100) changes from blue to red. The red color indicates that the value has an active expression.
See that a twirls has appeared to the left of the stopwatch, click it open. Use it to expose the expression itself.
- The first button looks like an equals sign ("=") and toggles the expression on and off. It appears blue when the expression is enabled.
- The second button toggles showing the expression's value over time in the Graph Editor.
- The third button with the little spiral is the pick whip which you can use to help construct expressions.
- The fourth button opens the Expression Language menu, which can be used to help construct expressions.
Finally, to the right of the four buttons you can view the default expression transform.position. If you want to change the expression, click on the expression text in the Timeline to activate the expression editor field. It works just like any text field; copy, paste, select, or drag text. Pressing enter creates a new line, and you can resize the height. Click it and type the expression you want such as wiggle(3,50). To learn more, see Editing expressions.
Expressions and Keyframes
All properties in After Effects that can be animated have a pre-expression value and a post-expression value.
The pre-expression value is simply the value of the property before any expression is applied, either static or animated by keyframes. You can think of pre-expression values as similar to a layer's pixels without any effects applied. These pre-expression values can then be modified or used by an expression, just as an effect changes or uses the pixels of a layer, resulting in the post-expression value.
The highlight color of the property's value in the UI indicates whether the property is using a pre-expression or post-expression value; pre-expression values are blue, while post-expression values are red.
The pre-expression value of any property can be accessed within an expression using the attribute value. For example, the expression value+90 on a Rotation property would add 90 degrees to the value the property had before the expression was applied. This also works for keyframed values; if the Rotation is keyframed from 0 to 45, the same value+90 expression will cause it to animate from 90 to 135. The keyframes' values can also be accessed similarly via key(index).value, using 1 for the index to get the first keyframe's value, 2 for the second, etc. The attribute numKeys will always be equal to the number of keyframes on the property, so key(numKeys).value is the value of the last keyframe.
Some methods, such as wiggle() or the various loop, implicitly use the pre-expression value.
For example, the expression wiggle(10, 10) animates between -10 and 10 if a property has a value of 0, adding wiggling movement around its existing value. The same is true when the expression is applied to a keyframed property, creating secondary animation on top of the original animated values. See Property attributes and methods (expression reference).
Using simple math in expressions
The values for a property that contains an expression appear in red or pink type.
A good way to begin working with expressions is to create a simple expression with the pick whip and then adjust the behavior of the expression using simple math operations, such as those listed in the following table:
Perform opposite of original, such as counterclockwise instead of clockwise.
For example, you can double the result by typing *2 at the end of the expression; or you can halve the result by typing /2 at the end of the expression.
As you develop comfort editing expressions, you can combine these simple operations—and more. For example, you can add /360*100 to the end of an expression to change its range from 0-360 to 0-100. This change would be useful if you wanted to convert the values of a 360-degree dial to a slider that is measured in percentages.
The Expression Language menu
Common expressions you can use
For more such examples, see Expression examples.
Edit an expression manually
Enter text-editing mode by clicking in the expression field.Huomautus:
When you enter text-editing mode, the entire expression is selected. To add to the expression, click within the expression to place the insertion point; otherwise, you will replace the entire expression.
Type and edit text in the expression field, optionally using the Expression Language menu.
To exit text-editing mode and activate the expression, do one of the following:
Press Enter on the numeric keypad.
Click outside the expression field.
Customize the appearance of expressions in the Expression Editor
You can customize how expressions look in the Expression Editor located in the Timeline panel using the Scripting & Expressions preferences.
To open Expression Editor,
- macOS: Select After Effects > Preferences > Scripting & Expressions.
- Windows: Select Edit > Preferences > Scripting & Expressions.
Watch the following video to kickstart exploring expressions.
More Expression resources
Now that you have understood some of the concepts behind expressions, come to the community for some real-life examples, and to share your work.
You can also check out Dan Ebberts' excellent collection of example expressions and tutorials on his MotionScript website.
The AE Enhancers forum also provides many examples and much information about expressions, as well as scripts and animation presets.