Introduction to Expressions and Parenting
![]() |
|
The purpose of this tutorial is to create one layer of keyframed movement on a layer and make another layer react to the movement. Don't be afraid!
- Create a new comp. Mine is 320x240, 15 fps, 3 seconds long, the background color black.
- Add a
new solid (Layer > New > Solid). Click the "Make Comp Size"
button so that the layer will be 320x240. I called my solid "Amoeba"
and made it a circus peanut orange.

Square masks and mode settings - On the layer, use the pen tool to draw a mask. Mine is sort of amoeba shaped, hence the name (actually, I think it looks more like one of those space age table tops, but no matter...)
- Add a new solid (Layer > New > Solid). Click the "Make Comp Size" button again so that the layer will be 320x240. (You probably already knew that, but repetition is the way to learn!) I called my solid "Square" and made it a dark shade of mango. Set the transfer mode to Add.
- On the
"Square" layer, draw a square mask. Inside that square, make
another square (like a window). You can change the mask by clicking
the yellow square next to the mask. This makes it easier to keep track
of multiple masks on a layer, plus, sometimes, it's just difficult to
see that light yellow. Set Mask 2 in Subtract mode, so that a hole is
cut out of the square. You can use guides to center your square and
amoebas so that their anchor point is directly in the centers. Check
the manual if you aren't sure how to do it.
- Time to animate! Go to frame one and set a rotation keyframe on your amoeba layer. Set it to 0 x 0°. Go to the midway point of your comp (1:15 if you set your comp to 3 seconds) and set a keyframe to 1 x 0°. Go to the end of the comp and set the keyframe to to 0 x 0°. When you preview it should spin around once and spin back.
- We want to make the "Amoeba" layer the parent to the "Square" layer. You can either drag the pickwhip (the swirl icon under the parent section of the timeline) from the "Square" layer to the Source Name of "Amoeba", or you can simply choose "Amoeba" in the pulldown menu on the "Square" layer. Preview your movie and you'll see both of your layers moving together.
- But... what if we want the square to rotate the opposite way? Time to add our first expression! Take a deep breath... Make sure that rotate is showing in both of your layers by selecting both layers and hitting the "r" key. We are applying the expression to the rotation parameter on the square layer. The easiest way I've found to get started with expressions is to hold down the option key and click the keyframe stopwatch icon. Instead of adding a keyframe, it adds an expression. In the switches/modes section of the timeline, 3 buttons appear: a graph, a pickwhip (spiral icon) and an arrow, which contains mathematic commands. The word rotate appears in the timeline as well. Drag the pickwhip in the switches/modes section and drag it to the rotation parameter of your amoeba. Text will appear that will read: this_comp.layer("amoeba").rotation
- So... how to you make it spin in reverse, you ask? Get out your algebra books (just kidding!) You will want to multiply the rotation by a negative factor. If you multiply it by -1, though, nothing happens, so you'll want to try a negative number. this_comp.layer("amoeba").rotation*-2 If you don't want it to spin in reverse, but twice as fast as the amoeba layer, multiply it by positive 2. this_comp.layer("amoeba").rotation*2 Spinning too fast for you? Try dividing instead of multiplying this_comp.layer("amoeba").rotation/-2 Play with the numbers until you figure out how positive and negative values affect the movement. You can use decimals, too (example .725).
- Pretty
cool, eh... and that wasn't so scary. Want to learn some more? We will
apply an expression to the scale of the amoeba.
Select the amoeba layer and hit the "r" key, then the "s"
key, so that both the rotation and scale parameters are showing. Hold
down the option key and click the scale stopwatch to add an expression.
Those three icons appear once again. Drag the scale pickwhip to the
word "rotation". Text will appear that says:
[rotation, rotation]
The first rotation is the horizontal scale and the second is the
vertical scale. Preview your comp. Notice how the shapes are scaled
to 0 at the first and last frames and become zoomed to 360% at the middle
of your timeline.
We don't want the animation to scale to zero and disappear. The smallest
we would like to get is 20%. We'll add 20 to both the horizontal and
vertical scale, which looks like this:
[rotation+20, rotation+20]
This solves the problem of the beginning and end, but it makes the middle
scale even larger! See if you can figure it out.
More Resources
Introduction to Expressions by JJ Gifford

