programming4us
 
Graphics
 

Adobe After Effects CS5 : Expressions - Linking an Effect Parameter to a Property

5/30/2013 9:07:23 PM

1. The Language of Expressions

The After Effects expression language is based on a subset of JavaScript. JavaScript is a scripting language used largely for Web page design and includes many features specifically aimed at that task. The JavaScript implementation for expressions includes the core features only. That means there’s a lot about JavaScript that you won’t need to know, but it also means that any JavaScript reference you pick up (and you’re going to need one if you really want to master expressions) is going to have a lot of content that will be of little or no use to you.

The rest of the expression language consists of extensions that Adobe has added specifically for After Effects. This means that in addition to a good JavaScript reference, you’ll also be frequenting Adobe’s After Effects Expression Element Reference. The most up-to-date version of this reference can be found at Adobe’s Help on the Web. The After Effects Help menu will take you there: Help > After Effects Help, or you can go to www.adobe.com/support/aftereffects.

2. Linking an Effect Parameter to a Property

Here’s the scenario: You want to link an effect to an audio track. Specifically, you want to link the Field of View (FOV) parameter of the Optics Compensation effect to the amplitude of an audio layer. Expressions can’t access audio levels directly, so first you have to use a keyframe assistant (Animation > Keyframe Assistant > Convert Audio to Keyframes) to create a null layer named Audio Amplitude with Slider Controls keyframed for the audio levels of the Left, Right, and Both channels (for a stereo source). Next, you just Alt-click (Opt-click) the stopwatch for the FOV parameter of the Optics Compensation effect and drag the pick whip to the Both Channels Slider property of the Audio Amplitude layer (Figure 1). Doing so generates this expression:

thisComp.layer("Audio Amplitude").effect("Both
Channels")("Slider")

Figure 1. Select the Both Channels slider with the pick whip to replace the highlighted default expression text.

Take a closer look at its syntax: From JavaScript, the After Effects expression language inherits a left-to-right “dot” notation used to separate objects and attributes in a hierarchy. If your expression references a property in a different layer, you first have to identify the composition. You can use thisComp if the other layer happens to be in the same composition (as in this example). Otherwise, you would use comp("other comp name"), with the other composition name in quotes. Next you identify the layer using layer("layer name") and finally, the property, such as effect("effect name")("property name") or possibly transform.rotation.

In addition to objects and properties, the dot notation hierarchy can include references to an object’s attributes and methods. An attribute is just what you would guess: a property of an object, such as a layer’s height or a composition’s duration. In fact, in JavaScript documentation, attributes are actually referred to as properties, but in order to avoid confusion with the layer properties such as Position and Rotation (which existed long before expressions came along), in After Effects documentation (and here) they’re referred to as attributes. For example, each layer has a height attribute that can be referenced this way:

comp("Comp 1").layer("Layer 1").height

Methods are a little harder to grasp. Just think of them as actions or functions associated with an object. You can tell the difference between attributes and methods by the parentheses that follow a method. The parentheses may enclose some comma-separated parameters.

It’s important to note that you don’t have to specify the full path in the dot notation hierarchy if you’re referencing attributes or properties of the layer where the expression resides. If you leave out the comp and layer references, After Effects assumes you mean the layer with the expression. So, for example, if you specify only width, After Effects assumes you mean the width of the layer, not the width of the composition.

Let’s forge ahead. You linked the amplitude of your audio layer to your effect parameter, but suppose you want to increase the effect that the audio level has on the parameter. You can use a little JavaScript math to multiply the value by some amount, like this


thisComp.layer("Audio Amplitude").effect("Both
Channels")("Slider") * 3
 
Others
 
- Adobe Fireworks CS5 : Working with Vector Graphics - Customizing fills and strokes (part 4) - Adding to the skyline, Adding windows to the building
- Adobe Fireworks CS5 : Working with Vector Graphics - Customizing fills and strokes (part 3) - Using the Compound Shape tool, Working with compound shapes
- Adobe Fireworks CS5 : Working with Vector Graphics - Customizing fills and strokes (part 2) - Customizing the stroke, Importing and resizing a vector object
- Adobe Fireworks CS5 : Working with Vector Graphics - Customizing fills and strokes (part 1) - Adding a gradient fill
- Adobe Flash Professional CS5 : Working Within the Flash Environment - Setting General Preferences
- Adobe Flash Professional CS5 : Working Within the Flash Environment - Creating Keyboard Shortcuts
- Adobe Flash Professional CS5 : Working Within the Flash Environment - Creating a Workspace
- Adobe InDesign CS5 : Working with Objects and Layers - Repeating Object Transformations
- Adobe InDesign CS5 : Working with Objects and Layers - Arranging Object Stack Order, Transforming Objects
- Adobe InDesign CS5 : Working with Objects and Layers - Distributing Objects
 
 
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