Easy things to do with expressions #3

Understand the code
Post Reply
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Create an expression that does nothing.

Ok, maybe not the most exciting tutorial, but it gives me a chance to explain a
few expression fundamentals.

Create a new solid and press "p" to view its position property.

Add a few position keyframes along the Timeline to make the layer move around
the comp window.

Now add an expression to the position property. You can do this either by selecting
the position name and choosing Animation > Add Expression from the main menu,
or much easier, just option-click on the stopwatch icon beside the property.

The default expression will be:

If you preview through the Timeline, you'll see the layer is moving in exactly the
same way as before you applied the expression. You have successfully created an
expression that does nothing!

NOTE: Basically, the default expression on any property will always produce
a result that is the same as if there was no expression applied.

The word
position is used by After Effects to represent the position value for the
layer containing the expression. The expression is setting the layer's current
position to the layer's current position value, so nothing changes.

In the last tutorial, the expression was essentially telling position what it's value
should be. Make the value of this property (which was position) equal

In this example, the expression is asking for the property's current value by using
the word
position (which represents the current position value). Because this is
the last line of the expression, it also becomes the result of the expression.

So the expression
position is asking for the layer's current position value, then
telling it to set the current position value to that same value. Kind of like saying:
currentPosition = position;
position = currentPosition;

Something else to understand about expressions, is that they are recalculated
on every frame.

Although the expression in the last tutorial
[160,120] is recalculated on every
frame, the result is always the same, so the layer remains fixed to a spot.

But in this example, because the expression is setting the position to whatever
its current position value is on any given frame (in this case they are keyframed
values), the result is that the layer continues to move around in exactly the
same way as it did without the expression.

Admittedly, on its own this expression is completely useless. This is just to
introduce you to the concept of using words like
position, opacity, rotation,
to read a layer's current values.
Posts: 1
Joined: June 12th, 2007, 5:35 pm
Location: Ohio

But also...
this method of "nothing" expressions can come in very handy when your would like to convert the expressions to keyframes.

Then you might use the scale timing parameters to stretch or condense the timing of your animation OR select all of your keyframes, and OPT-Drag the last one (to scale out or in but keeping the keyframes evenly spaced).

Once you have keyframes stretched or timed and finessed, you can turn off the expression and select all your keyframes and toggle hold keyframes to get a stop-motion effect or to do a "Vegas circle light" animation (kudos to Total Training for this knowledge).
“Motivation is what gets you started. Habit is what keeps you going.” –Jim Ryun
User avatar
Posts: 21
Joined: August 30th, 2017, 8:35 pm
Location: Detroit, Mi

I sometimes use value or the nothing method to use the EE shortcut, so I can pick a certain property or properties in a layer. 
Post Reply