(Page 1 of 2 pages for this article  1 2 >)

Saturday, May 01, 2010

Filed under: Post ProductionVisual Effects

Deeper Modes of Expression, Part 5: Comp, Footage, and Layer Attributes

Chris Meyer | 05/01

Grabbing numbers from places such as the comp settings.

If you can keyframe it, chances are you can control it with an expression, or use it as part of another property’s expression – usually by dragging the pick whip to it. However, there are additional properties you have access to – including those you can’t access with a pick whip, such as whether a layer’s audio or video switches are on, or its current in or out point. You’ll need to either manually type in code to access these, or get some help from the expression language menu. To give you a taste for what’s possible, let’s discuss a couple of comp and footage attributes of interest.

Expressions can access a large number of composition attributes, including the width and height of the comp, the comp’s duration, the duration of a single frame at the comp’s current frame rate, and the comp’s pixel aspect ratio. This saves you from having to calculate or transcribe these numbers by hand; expressions that use these properties will also automatically update as you change a comp’s settings (such as its frame rate). It also makes expressions easier to reuse, as they can automatically refer to a comp or layer’s properties, rather than requiring you to edit the expressions to match a new comp or layer size or frame rate.

Let’s say we want to arrange a series of layers in a line from the upper left corner of a comp to the lower right corner - regardless of the size of the comp:

The upper left corner is easy; it’s value is always 0, 0. We could enter this as its value, but when you resize a comp, the Position values of layers can change. Therefore, to nail it down to that corner, we can enter the expression [0, 0] for the first layer’s Position. (As you know by now, Position for a 2D layer has two dimensions, so we need to give it two values - one for each dimension - inside brackets, separated by commas.)

To place an object in the lower right corner, we need to know the comp’s dimensions. To dig out that piece of information, we would apply the following expression to that layer’s Position:

[thisComp.width, thisComp.height]

Note that if we did not type thisComp. before width, After Effects would have assumed we wanted the layer’s width, not the comp’s width.

It follows that the expression to place an object in the center of a comp is [thisComp.width/2, thisComp.height/2]. And placing objects in between the center and the corners is just a matter of dividing the comp into quarters: [thisComp.width/4, thisComp.height/4] and [thisComp.width * (3/4), thisComp.height * (3/4)]. The resulting timeline panel would look like this (remember, you can select layers and press U to reveal any animating properties be they controlled by keyframes or expressions; type EE to see just the properties with expressions attached):

The advantage of using expressions like these is that we can change the comp’s size (maybe because the client neglected to give us the correct deliverable size before we started), and the objects will automatically redistribute themselves correctly with no intervention on our part:

(By the way, one of the small but useful features added in AE CS5 is that many dialogs - such as Composition Settings - have Live Preview switches, meaning you get to see the impact of your changes before you close the dialog. This is particularly handy for editing motion blur settings. But I digress…)

You can use the expression language menu to cut down on typing expressions such as these, but you will need to do it in three steps after you have enabled expressions:

Step 1: Select Global > thisComp
Step 2: Type a period (.)
Step 3: Select Comp > width (or whatever property you want)

It is up to you to decide if that’s easier than just typing thisComp.width – but if nothing else, the expression language menu reminds you of what’s available, and what the correct syntax (spelling) is.

next page: converting between frames and seconds

(Page 1 of 2 pages for this article  1 2 >)

               



You must be registered to comment. This is an effort to reduce spam. Please REGISTER HERE.

WOW! Cool topic and cool article, very well written.

Posted by .(JavaScript must be enabled to view this email address)  on  05/03  at  05:51 AM


Name:

Email:

Location:

URL:

Smileys

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:




After Effects Apprentice Free Video: Exploring Shape Effects
After Effects Apprentice Free Video: Drawing Parametric Shapes
After Effects Apprentice Free Video: The Puppet Starch Tool
After Effects Apprentice Free Video: Eraser Tool Modes
After Effects Apprentice Free Video: Tracking with mochaAE
After Effects Apprentice Free Video: Performing a Motion Track
After Effects Apprentice Free Video: Creating 3D Objects using Adobe Repoussé
After Effects Apprentice Free Video: Understanding Axis Modes
Using After Effects as an Advanced Titler for Premiere Pro
After Effects Apprentice Free Video: Creating an Orbit Camera Rig
CMG Hidden Gems: Chapter 45 – What’s Your Preference?
CMG Hidden Gems: Chapter 44 – Prerendering and Proxies
CMG Hidden Gems: Chapter 43 – Advanced Rendering
CMG Hidden Gems: Chapter 42 – Render Queue
CMG Hidden Gems: Chapter 41 – Video Issues
CMG Hidden Gems: Chapter 40B – 3D Channel Effects
CMG Hidden Gems: Chapter 40 – Integrating with 3D Applications
CMG Hidden Gems: Chapter 39 – Integration 101
After Effects Apprentice Free Video: Multiple Playback Speeds
CMG Hidden Gems: Chapter 38 – Import and Interpret
CMG Hidden Gems: Chapter 37B and 37C – Expressions and Scripting Bonus Chapters
CMG Hidden Gems: Chapter 37 – Expressions
CMG Hidden Gems: Chapter 36B – Audio Effects
CMG Hidden Gems: Chapter 36 – Working With Audio
Upgrading to After Effects CS5.5?
CMG Hidden Gems: Chapter 35 – The Puppet Tools
After Effects Apprentice Free Video: The Wiggle Expression
CMG Hidden Gems: Chapter 34 – Roto Brush
CMG Hidden Gems: Chapter 33 – Paint and Clone
After Effects Apprentice Free Video: What Could Go Wrong?







Expression Shorts - Numerical Readout

David Torno | 02/05

Create numerical readouts for use in HUD style graphics.

image

With this Expression, I will show you how to feed numerical property information…

JVC Unveils ProHD Portable Monitor Series

PVC News Staff | 01/30

Can display 480i, 480p, 720p, 1080i, and 1080p video signals at a variety of frame rates

image

JVC Professional Products Company, a division of JVC Americas Corp., today announced the DT-X71 Series of portable ProHD LCD monitors. Ideal for field and studio applications, the new seven-inch AC/DC…

CMG Hidden Gems: Chapter 37B and 37C – Expressions and Scripting Bonus Chapters

Chris and Trish Meyer | 09/02

This time, a collection of resources on expressions and scripting - including a PDF of Bonus Chapter 37C on scripting.

We’re going through our book Creating Motion Graphics with After Effects 5th Edition (CMG5) and pulling out a few “hidden gems” from…

CMG Hidden Gems: Chapter 37 – Expressions

Chris and Trish Meyer | 08/27

Another selection of “hidden gems” (and essential advice), this time from Chapter 37 of Creating Motion Graphics with After Effects.

We’re going through our book Creating Motion Graphics with After Effects 5th Edition (CMG5) and pulling out a few “hidden gems” from…

To be considered for listing, contact pr (at) provideocoalition (dot) com


Copyright © 2011, HD Expo, LLC a division of Diversified Business Communications. DBA Createasphere

All rights reserved. HD EXPO, High Def EXPO, Createasphere, E-Tech, Entertainment Technology Exposition, 3D Production Workshop, VariCamp, P2 Camp, ColorCamp 101, and Lighting, Filters & Gels for HD are all trademarks of HD Expo, LLC.

Terms of Use  |  Privacy Policy

Check PageRank