beautypg.com

Expression examples, Expression example: rotate the hands of a clock – Adobe After Effects CS4 User Manual

Page 689

background image

683

USING AFTER EFFECTS CS4

Expressions

Last updated 12/21/2009

Expression examples

Many of the examples in this section are based on expressions provided by Dan Ebberts. Dan Ebberts also has an
excellent collection of example expressions and tutorials for learning how to work with expressions on his

MotionScript website

. For example, Dan provides an excellent

page about collision detection

.

Colin Braley provides a tutorial and example project on

his website

that show how to use expressions to make one layer

repel others in a natural-seeming manner.

The AE Enhancers forum provides many examples and much useful information about expressions, as well as scripts
and animation presets. In

this post on the AE Enhancers forum

, Paul Tuersley provides a tutorial and example project

that show how to use expressions to animate several layers in a swarm.

Rick Gerard provides an example on

his website

that demonstrates rolling a square object along a floor so that the sides

stay in contact with the floor plane.

Carl Larsen provides a video tutorial on the

Creative COW website

that demonstrates how to use expressions and

parenting to relate the rotation of a set of wheels to the horizontal movement of a vehicle.

Marcus Geduld provides some examples from his book, After Effects Expressions, on the Focal Press website. In the

"String Manipulation"

section, Marcus shows how to use basic JavaScript to manipulate the text in the Source Text

property of a layer. He even shows how to use an array of strings so that a layer's Source Text property can be set to a
specific word from a list. In the

"Physical Simulations"

section, Marcus shows how to use expressions for orbits,

bounces, jiggles, and collision detection.

Chris Zwar provides an example project on

his website

for automatically arranging still images or videos into a grid

(like a video wall). You can easily adjust position and spacing with sliders that are connected to a system of expressions.
There are three compositions in the project—one for stills, one for videos, and one to create an auto-storyboard in
which a video is sampled at user-defined intervals and aligned into a grid.

JJ Gifford’s website

provides several example projects that demonstrate how to use expressions.

Rhys Enniks provides a video tutorial on

his website

in which he uses expressions and multiple text animators and

range selectors to animate text as if it is being typed onto a computer screen.

Expression example: Make a layer revolve in a circle

You can create an expression without using properties from other layers. For example, you can make a layer revolve
in a perfect circle.

1

Select a layer, press P to reveal its Position property in the Timeline panel, and Alt-click (Windows) or Option-click
(Mac OS) the stopwatch to the left of the property name.

2

Enter the following in the expression field:

[(thisComp.width/2), (thisComp.height/2)] + [Math.sin(time)*50, -Math.cos(time)*50]

Expression example: Rotate the hands of a clock

You can use the pick whip to link rotation values between layers to animate the hands on a clock—as the hour hand
moves from hour to hour, the minute hand rotates the full circumference of the clock face. This type of animation
would take a long time to create if you had to set each keyframe for both hand layers, but with the pick whip, you can
do it in a matter of minutes.

1

Import or create two long, narrow solid-color layers: an hour hand and a minute hand. (See “

Create or modify a

solid-color layer or footage item

” on page 141.)

This manual is related to the following products: