programming4us
 
Graphics
 

Adobe After Effects CS5 : Expressions - Creating Expressions

12/20/2012 5:33:17 PM

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.

 
Others
 
- 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
 
 
REVIEW
 
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- Sigma 24mm f/1.4 DG HSM Art

- Canon EF11-24mm f/4L USM

- Creative Sound Blaster Roar 2

- Alienware 17 - Dell's Alienware laptops

- Smartwatch : Wellograph

- Xiaomi Redmi 2
 
VIDEO TUTORIAL
 
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
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
 
Top 10
 
- How To Install Android Market & Google Apps On Kindle Fire
- How To Make Ubuntu Look Like Windows 7
- How To Add A New Account in MS Outlook 2013
- Get Android & Mac OS X Style Gadgets For Windows 7 & Windows 8 With XWidget
- How To Activate Microsoft Office 2013
- How To Install Actual Facebook App On Kindle Fire
- How To Create, View And Edit Microsoft Office Files On Kindle Fire
- Download Attractive Business PowerPoint Templates For Free At SlideHunter
- How To Use And Enable Hibernate & Sleep Mode In Windows 8
- How To Get Microsoft Office 2013 Trial Product Key From Microsoft