After Effects Expressions [NOOK Book]


Put the power of Expressions to work in your animations with controls and efficiencies impossible to achieve with traditional keyframing techniques.
No programming skills are required. Foundation concepts and skills orient the new designer and serve as a handy reference to the experienced one. Basics of creating expressions, variables, commands, and expression helpers precede the leap into javascript and math essentials for more advanced ...
See more details below
After Effects Expressions

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$41.99 price
(Save 19%)$51.95 List Price


Put the power of Expressions to work in your animations with controls and efficiencies impossible to achieve with traditional keyframing techniques.
No programming skills are required. Foundation concepts and skills orient the new designer and serve as a handy reference to the experienced one. Basics of creating expressions, variables, commands, and expression helpers precede the leap into javascript and math essentials for more advanced expressions that include randomness, physical simularions and 3D.
Full color illustrations display the scripts and the resulting effects, pickwhip techniques, and sequential animations. Downloadable companion files include Quicktime movies of the demo animations, and AE project files that permit you to examine the Expressions. Extensive notes are provided to aid you in implementing the extensive library of Expressions available for your use on Adobe LiveDocs.
Read More Show Less

Editorial Reviews

From the Publisher
"After Effects Expressions offers a comprehensive resource guide that fills a niche like nothing else currently on the market. If you would like to add expressions to your bag of design and development tricks, this book comes highly recommended."—Tim Frick,
Read More Show Less

Product Details

  • ISBN-13: 9781136140532
  • Publisher: Taylor & Francis
  • Publication date: 7/18/2013
  • Sold by: Barnes & Noble
  • Format: eBook
  • Pages: 448
  • Sales rank: 1,131,603
  • File size: 13 MB
  • Note: This product may take a few minutes to download.

Meet the Author

is an Adobe-certified Instructor and Certified Expert and a Macromedia Certified Developer with over 15 years of experience in teaching media software. Marcus is a columnist in "Layers Magazine," author of several books and regular conference presenter at MacWorld, NAB Post Production Conference, among others.

Read More Show Less

Read an Excerpt

After Effects Expressions

By Marcus Geduld

Focal Press

Copyright © 2009 Marcus Geduld
All right reserved.

ISBN: 978-0-08-092753-4

Chapter One

Creating Simple Expressions


How do you create an Expression in After Effects (AE)? The easiest way is to Option click (PC: Alt click) any stopwatch in the Timeline or Effect Controls panel. I like to think of Expressions as another option (or another alternative) to keyframes, which helps me remember to hold down the Option (PC: Alt) key when I'm adding them. To animate with keyframes, you click a stopwatch; to animate with Expressions, you Option click (PC: Alt click) a stopwatch.

Let's say you want an Expression to control a layer's position: create a small solid—say 100 by 100. Or you can use the little guy in Chapter01.aep, Comp1. Now do this:

1. Twirl open the layer's properties in the Timeline.

2. Twirl open the Transform group.

3. Option click (PC: Alt click) the stopwatch by the Position property.

Don't be alarmed when the Comp window turns black and a scary-looking message appears underneath it in red. Starting in AE6, Adobe introduced a minor bug that causes the display to freeze while you're adding an Expression. (It's still with us in CS4, so maybe Adobe has grown fond of it.) The display will unfreeze as soon as you're done adding the Expression.

What's more important is that you notice several changes in the Timeline near Position: a bunch of new buttons and a text-entry area, in which you'll see the following text: transform.position. That's a default, placeholder Expression. I'll have more to say about it shortly, but it doesn't do anything. If you preview the Comp now, you'll see that nothing happens, so try this:

4. Select the text transform.position and delete it (the same way you select and delete text in a word processor).

Actually, the text is selected by default. When you add an Expression, AE autoselects the text. So if you just start typing, whatever you type will replace the placeholder Expression.

5. Type "wiggle(1,40)." Don't type the quotation marks or the period.

Make sure wiggle is all lowercase and that you've included the parentheses and the comma.

6. With your mouse, click anywhere outside of the text-entry area, say on a gray area of the Timeline. That tells After Effects you've finished typing the Expression. (It "finalizes" the Expression.)

If you see an error message, it means you made a typo. Don't fret. Just click back inside the text-entry area, edit the Expression until it's correct, and then click outside the text-entry area again.

7. Preview the Comp by pressing the spacebar.

We'll delve into the meaning of that Expression later. But hopefully you noticed that the layer did, in fact, wiggle. For some fun, try changing the numbers inside the parentheses—for example, change them to wiggle (3,100)—and see what happens. Don't worry; you can't break anything.

In short, use these steps to add an Expression:

1. Option click (PC: Alt click) a stopwatch.

2. Enter the Expression.

3. Finalize the Expression by clicking outside the text-entry area.

You can also finalize an Expression by pressing the Enter key on the numeric keypad. (Mac users: Never press the Return key on the main keyboard to finalize an Expression. PC users: Never press the Enter key on the main keyboard. Those keys drop the cursor down to the next line in the text-entry area, just as they would in a word processor. To finalize an Expression, always use the Enter key on the numeric keypad or click outside the text-entry area.)

If you're into menus, you can also add an Expression by following these steps:

1. Clicking a Property name (e.g., Position) to select it.

2. Choosing Animation Add Expression or clicking Option Shift Equals (PC: Alt Shift Equals). That's the keyboard shortcut for the menu option.


Let's say you want to stop the wiggle. Simply click the equal-sign button in the Timeline. It will become a not-equal-sign button, and the Expression will stop working.

Try previewing the Comp, and you'll notice that wiggling has stopped. Click the not-equal sign again, and it will toggle back to an equal sign. The layer will wiggle once again. This button is called the Enable Expression button, but a better name for it would be the Disable/Enable Expression button, because it's a toggle.

Next, I'll explain how to permanently remove an Expression, but in general I suggest that you disable them rather than remove them. That way, if you change your mind and want them back, you won't have to type them all over again.


You remove an Expression exactly the same way you create one: by Option clicking (PC: Alt clicking) a stopwatch. Option click once to add an Expression; Option click the same stopwatch again to remove the Expression. This is exactly the same toggle pattern you use with keyframes: You click a stopwatch to add keyframes and click it a second time to remove keyframes. The only difference is that with Expressions, you add in the Option key (PC: Alt key).

You can also remove an Expression by selecting the property it's applied to (e.g., by clicking the word "Position") and choosing Animation Remove Expression. Or you can select the property and type Option shift equals (PC: Alt shift equals).

One other way to remove an Expression is by deleting the Expression text and then clicking outside the text-entry area (or pressing Enter on the numeric keypad).


Now that you know how to add, disable, and remove Expressions, let's explore what they are and how they work. As I explained in the Introduction, Layer properties are controlled by numbers (with rare exceptions like the Source Text property of Type Layers, which is controlled by text).

This is as true with keyframes as it is with Expressions. Let's say you turn on the stopwatch for a layer's Rotation property. You then move the Current Time Indicator (CTI) to 3 seconds and, with the Rotation tool, rotate the layer to 19 degrees. After Effects will plop a keyframe in the Timeline at 3 seconds. This keyframe is "remembering" the number 19. Whenever you scrub the Current Time Indicator to 3 seconds (or play the Comp through the 3-second mark), the keyframe reminds AE to rotate the layer to 19 degrees. At 3 seconds, the number 19 is controlling the layer's Rotation property.

Expressions give you an alternative way to make the numbers that control properties (e.g., the wiggle Expression spits out random numbers, and those random numbers control the property). Let's watch this in action in the simplest possible way:

1. In an empty Comp, create a solid. Or you can use the Red Star layer in Chapter01.aep, Comp2.

2. Twirl open its Transform properties.

3. Add an Expression to the Rotation property.

4. Remove the default Expression, and type "45" (without the quotation marks) in its place.

5. Click outside the text-entry area, or press Enter on the numeric keypad.

This is the stupidest Expression you'll ever write. If you want a layer to be rotated 45 degrees, it's much easier to just use the Rotation tool or scrub the property value. My point here isn't to show you how to do something useful; it's to teach you something about the basic mechanics of Expressions. And even with this simple (useless) one, there's plenty to talk about.

If you took a screenshot of the Timeline and grayed out everything except the name of the property, the equal sign (the Enable Expression button), and the Expression itself (45), you'd see what was really going on.

Rotation = 45

That's a great way of thinking about Expressions. Expressions set a Property equal to some number.

If you click the equal sign, it becomes a not-equal sign. Now,

Rotation [not equal to] 45

The layer returns to its default rotation (zero degrees) or to whatever degree of rotation you left it at before you added the Expression, because now Rotation is not equal to 45 degrees.

Reenable the Expression and change it to the following, remembering to click outside the text-entry area when you're finished typing. (Okay, this is really the last time I'm going to remind you to finalize Expressions.)

45 + 10 - 2

This will set the Rotation to 53 degrees. Again, I can't think of a good reason to do this, but it shows off a little more about how Expressions work.

Properties eat numbers for breakfast. They crave numbers. As long as AE can resolve an Expression into a number, it will work. That number will drive the property. And it can resolve 45+10-2 into the number 53 by doing some simple arithmetic, which it knows how to do.

If AE could somehow count the number of eggs in my refrigerator, I could write the following Expression.

Rotation = the number of eggs in my refrigerator

Maybe someday.

By the way, you could have written that earlier Expression as 45+10-2 (without the spaces) or, if you're a bit eccentric, as 45 +10 - 2. JavaScript is pretty lax about spacing. Different people will space out Expressions in different ways. So you should get used to slight variations in people's styles of Expression-writing.

45 +10 -2 and 45+10-2 both work the same way.

You'll rarely (if ever) write Expressions that are just arithmetic problems, so I don't want to bore you with them for much longer. But I do want to point out a couple more things: assuming that an Expression is still controlling Rotation (add one back or enable one if necessary), notice that the display values have turned red.

This signifies that the property they're associated with is controlled by an Expression. This is useful if you ever twirl closed the property. If you do, you'll no longer be able to see the Expression. The red value will be your only clue an Expression is controlling the property.

Try scrubbing or changing the red value to 90 degrees. Don't change the Expression. Just use the Rotation tool or scrub the value of Rotation in the Timeline.

AE appears to let you do it, but as soon as you quit scrubbing, the value pops back to whatever it's set to by the Expression. As long as the Expression is enabled, it—not you—controls the property. But AE remembers your 90 degrees. If you disable or remove the Expression, your layer will rotate to 90 degrees.


We're about to leap out of useless-Expression world and land on a much more interesting planet. Try the following:

1. If you still have an Expression on Rotation, remove it.

2. Add a new Expression to Rotation. This time, instead of a number, type "transform.opacity" (without the quotation marks).

3. Finalize the Expression by pressing the Enter key on the numeric keypad or clicking outside the text. (I said I wasn't going to remind you to do this any more. Well, I lied. But this really, really is the last time. Finalize your Expressions!)

Your Expression is

rotation = transform.opacity

Transform refers to the Transform group in the Timeline, and opacity refers to the Opacity property within that group.

Written in English, your Expression would read

Set Rotation's value to the same number as Opacity's value.

Because Opacity is 100 (unless you've messed with it), Rotation should also be 100. Okay, that's a little weird. Opacity's 100 means 100%; Rotation's 100 means 100 degrees. Rotation and Opacity use completely different number systems. It doesn't matter. In the wacky world of Expressions, it's just the number itself that counts.

Remember my silly example? Rotation = the number of eggs in my refrigerator? Rotation and eggs have nothing in common, except a number (degrees and number in the fridge). Same with Rotation and Opacity. They're two entirely different sorts of properties, but they now share a controlling number.

Note that you haven't permanently set Rotation to 100. Instead, you've set Rotation to the value of Opacity, and the value of Opacity can change. In essence, you've said, "Let Rotation's number be whatever Opacity's number is right now. If Opacity changes, let Rotation change too." Opacity is the "parent" of Rotation. As you animate or adjust Opacity, Rotation will change automatically.

To test this relationship, try scrubbing Opacity: take it down to zero, and you'll see the layer rotate to zero degrees as it fades out. Now set Opacity to 50%; Rotation will be 50 degrees.

Take a deep breath and think about the ramifications of this. With Expressions, you can link any two properties so that one controls the other: Opacity can control Rotation, Rotation can control Opacity, Position can control Scale, The Blurriness of a Gaussian Blur can control the strength of Gravity in Particle Playground.


Excerpted from After Effects Expressions by Marcus Geduld Copyright © 2009 by Marcus Geduld. Excerpted by permission of Focal Press. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Read More Show Less

Table of Contents

Pt. 1 Using Expressions Ch. 1 Creating Simple Expressions 3 Ch. 2 Variables, Comments, and Dimensions 41 Ch. 3 Commands 91 Ch. 4 Expression Helpers 171 Pt. 2 Foundations for Advanced Expressions Ch. 5 JavaScript for Expressions 227 Ch. 6 Math Is Your Friend 277 Ch. 7 Advanced Techniques 321 Ch. 8 Randomness 351 Ch. 9 Physical Simulations 383 Index 413
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)