IT tutorials

Adobe After Effects CS5 : Expressions - Creating Expressions

12/20/2012 5:33:17 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

1. What Expressions Are

The After Effects expression language is a powerful set of tools with which you can control the behavior of a layer’s properties. Expressions can range in complexity from ridiculously simple to mind-numbingly complicated. At the simple end of the spectrum, you can use expressions to link one property to another or to set a property to a static value. At the other extreme, you can create complex linkages, manipulate time, perform calculations in 3D space, set up tricky procedural animations, and more.

Sometimes you’ll use expressions instead of keyframes (most properties that can be keyframed can be controlled by expressions). In other cases you’ll use expressions to augment the keyframed behavior. For example, you could use keyframes to move a layer along a specific path and then add an expression to add some randomness to the motion.

Close-up: Expressions Have Limitations

Although the After Effects expression language presents you with an impressive arsenal of powerful tools, it’s important to understand the limitations of expressions so that you can avoid making assumptions that lead you astray.

  • An expression may generally be applied only to a property that can be keyframed, and it can affect only the value of that property. That is, an expression can affect one and only one thing: the value of the property to which it is applied. This means there are no global variables. This also means that although an expression has access to many composition and layer attributes (layer width and height, for example) as well as the values of other properties, it can only read, not change, them.

  • Expressions can’t create objects. For example, an expression cannot spawn a new layer, add an effect, create a paint stroke, change a blend mode—the list goes on and on. Remember, if you can’t keyframe it, you can’t create an expression for it.

  • Expressions can’t access information about individual mask vertices.

  • Expressions can’t access text layer formatting attributes, such as font face, font size, leading, or even the height and width of the text itself.

  • Expressions cannot access values they created on previous frames, which means expressions have no memory. If you’ve had a little Flash programming experience, you might expect to be able to increment a value at each frame. Nope. Even though you can access previous values of the property using valueAtTime(), what you get is the pre-expression value (the static value of the property plus the effect of any keyframes). It’s as if the expression didn’t exist. There is no way for an expression to communicate with itself from one frame to the next. Note, however, just to make things more confusing, the postexpression value of a property is available to any other expression, just not the one applied to that property. In fact, the postexpression value is the only value available to expressions applied to other properties. To summarize: An expression has access only to the pre-expression value of the property to which it is applied, and it only has access to the postexpression values for other properties with expressions. It’s confusing at first, but it sinks in eventually.

2. Creating Expressions

The easiest way to create an expression is to simply Alt-click (Opt-click) the stopwatch of the property where you want the expression to go. After Effects then creates a default expression, adds four new tool icons, changes the color of the property value to red (indicating that the value is determined by an expression), and leaves the expression text highlighted for editing (Figure 1).

Figure 1. When you create an expression, After Effects creates a default expression with the text highlighted for editing, changes the color of the property value to red, and adds four new tool icons: an enable/disable toggle, a Graph Editor toggle, a pick whip, and an Expression Language menu fly-out.

At this point you have a number of options. You can simply start typing, and your text will replace the default expression. Note that while you’re in edit mode, the Enter(Return) key moves you to a new line in the expression (this is how you can create multiline expressions) and leaves you in edit mode.

Another option while the text is highlighted is to paste in the text of an expression that you have copied from a text editor. This is the method I generally use if I’m working on a multiline expression.

Instead of replacing all the default text by typing or pasting, you can click somewhere in the highlighted text to create an edit point for inserting additional text.

Alternatively, you can drag the expression’s pick whip to another property or object (the target can even be in another composition), and After Effects will insert the appropriate text when you let go. Note that if an object or property can be referenced using the pick whip, a rounded rectangle appears around the name as you drag the pick whip over it. If this doesn’t happen, you won’t be able to pick whip it.

Finally, you can also use the Expression Language menu to insert various language elements.

After creating your expression, exit edit mode by clicking somewhere else in the timeline or pressing Enter on the numeric keypad. If your expression text contains an error, After Effects displays an error message, disables the expression, and displays a little yellow warning icon (Figure 2). You can temporarily disable an expression by clicking on the enable/disable toggle.

Figure 2. If your expression contains an error, After Effects disables the expression, changes the enable/disable toggle to the disabled state, returns the Property value to its normal color, displays an error icon, and displays an error message dialog box.

Working with existing expressions is as easy as creating them. Some common operations include

  • editing. Click in the expression text area to select the entire expression; you now have the same options as when creating a new expression. If your expression consists of multiple lines, you may need to expand the expression editing area to be able to see all (or at least more) of it by positioning the cursor over the line below the expression text until you see a double-ended arrow and then clicking and dragging.

  • deleting. Simply Alt-click (Opt-click) the property’s stopwatch, or you can delete all the text for the expression and press Enter on the numeric keypad.

  • exposing. Select a layer in the Timeline and press EE to expose any expressions applied to that layer.

  • copying. In the Timeline panel, select a layer property containing an expression and choose Edit > Copy Expression Only to copy just the property’s expression. You now can select as many other layers as you’d like and Edit > Paste to paste the expression into the appropriate property of the other layers.

- Adobe Fireworks CS5 : Working with Vector Graphics - Basic vector drawing techniques
- Adobe Fireworks CS5 : Working with Selections - Converting a selection to a path
- Adobe Flash Professional CS5 : Working Within the Flash Environment - Working with Layers
- Adobe Flash Professional CS5 : Working Within the Flash Environment - Using the Timeline
- Adobe InDesign CS5 : Working with Objects and Layers - Using the Selection Tool
- Adobe InDesign CS5 : Working with Objects and Layers - Creating Lines, Creating Multiple Objects in a Grid
- Adobe InDesign CS5 : Working with Objects and Layers - Creating Shapes
- Adobe Illustrator CS5 : Working with Objects - Creating Pixel Aligned Objects, Creating Rectangles and Ellipses
- Adobe Illustrator CS5 : Working with Objects - Understanding Vector and Raster Graphics, Understanding Paths, Selecting a Drawing Mode
- Adobe PhotoShop CS5 : Acquiring Digital Images - Scanners
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
Popular tags
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS