Example: position one layer between two others, Example: create a trail of images, Example: create a bulge between two layers – Adobe After Effects CS3 User Manual
Page 588
AFTER EFFECTS CS3
User Guide
583
thisComp.layer("hour hand").rotation*12
Guy Chen provides a simple project that takes this idea further, connecting a clock's minute hand and hour hand's
rotation to the rotation of the second hand:
Example: Position one layer between two others
This example expression positions and maintains one layer at a balanced distance between two other layers.
1
Start with three layers. (See “Creating layers” on page 133.)
2
Animate the positions of the first two layers in the Timeline panel. (See “Creating and modifying motion paths”
3
Select the third layer, press P to reveal the Position property, and Alt-click (Windows) or Option-click (Mac OS)
the stopwatch
button to the left of the property name.
4
Enter the following in the expression field:
(thisComp.layer(1).position + thisComp.layer(2).position)/2
Example: Create a trail of images
This example expression instructs a layer to be at the same position as the next higher layer in the Timeline panel,
but delayed by a specified amount of time (in this case, 0.5 seconds). You can set similar expressions for the other
geometric properties.
1
Start with two solid-color layers that are scaled to approximately 30% of the composition size. (See “Create or
modify a solid-color layer” on page 136.)
2
Animate the position of the first layer. (See “Creating and modifying motion paths” on page 197.)
3
Select the second layer, press P to reveal the Position property, and Alt-click (Windows) or Option-click (Mac OS)
the stopwatch
button to the left of the property name.
4
Enter the following in the expression field:
thisComp.layer(thisLayer, -1).position.valueAtTime(time - .5)
5
Duplicate the last layer five times by selecting it and pressing Ctrl+D (Windows) or Command+D (Mac OS) five
times.
All layers follow the same path, and each is delayed 0.5 seconds from the previous.
Example: Create a bulge between two layers
This example expression synchronizes the Bulge Center argument of the Bulge effect in one layer with the position
of another layer. For example, you can create an effect that looks like a magnifying glass moving over a layer, with
the contents under the magnifying glass bulging as the lens (that is, the overlying layer) moves. This expression uses
the
fromWorld
method, which makes the expression work correctly regardless of whether you move the magnifying
glass layer or the underlying layer. You can rotate or scale the underlying layer, and the expression stays intact.
You can also use other effects, such as Ripple, with this expression.
1
Start with two layers. Make one layer a magnifying glass or similar object with a hole in the middle and name it
Magnifier. (See “Creating layers” on page 133.)
2
Animate the position of the magnifying glass layer. (See “Creating and modifying motion paths” on page 197.)
3
Apply the Bulge effect to the other layer. (See “Apply an effect or animation preset” on page 351.)