Delay

Delay x Position

 

//x position

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

x = thisLayer.transform.position.valueAtTime(time-d)[0];

[x,transform.position[1]]

 

Delay y Position

 

//y position

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

y = thisLayer.transform.position.valueAtTime(time-d)[1];

[transform.position[0],y]

 

Delay Rotation

 

//rotation

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

r = thisLayer.transform.rotation.valueAtTime(time-d);

[r]

 

Delay Scale

 

//scale

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

s = thisLayer.transform.scale.valueAtTime(time-d)[0];

[s,s]

 

Delay Time Remap

 

//time remap

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

t = thisLayer.timeRemap.valueAtTime(time-d);

[t]

 

The delay expression can sound a little confusing, but I’m going to do my best to include all variables of how this expression can be used.

This expression is used to delay the keyframes of a layer based on another layer.

In the example below, each layer has identical keyframes at identical times. It’s actually one layer duplicated twice, so they are identical in every way (except I moved them apart on the y axis).

The reason the animation is offset for each layer - is due to the expression. It told the layers below to delay starting their keyframes by a number of frames declared within the expression.

Setting this up is slightly more difficult than other expressions. This is all due to the fact you need to name your layers correctly!

Let’s create an example much like the one above. Here are the steps:

  1. Start with one layer which you would like to eventually duplicate and delay.

  2. Add keyframes to create your desired animation. In this case I animated the x position.

  3. Name that layer “1

  4. Whilst holding option on a mac or alt on a PC click the stopwatch next to the property with keyframes.

  5. Copy and paste the expression from below.

  6. Alter the top two lines for your desired outcome.

    • delay = the number of frames you would like the delay to equal. In the example above the delay is 5 frames.

    • framerate = the frame rate of your project. This can be check in composition > composition settings

  7. You can now duplicate this layer as many times as you wish.

  8. Don’t forget to adjust the y position as they will currently all be positioned in the same place.

    //x position

    delay = 5;

    framerate = 25;

    n = name - 1;

    d = n*(delay)/framerate;

    x = thisLayer.transform.position.valueAtTime(time-d)[0];

    [x,transform.position[1]]

If your layer is named correctly as “1” then each time you duplicate the layer it will automatically be named “2” then “3” and so on.

Essentially this is how the expression works. It looks at the layer with a name 1 less than its own and delays its keyframes based on its value.

If you get an error stating an ‘invalid numeric result’ then your layers are most likely not named correctly. They should be named from 1 at the bottom, then 2, then 3 and so on.

Delay y Position

Here’s the expression if you would like to delay the y position:

//y position

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

y = thisLayer.transform.position.valueAtTime(time-d)[1];

[transform.position[0],y]

Delay Rotation

Here’s the expression if you would like to delay the rotation:

//rotation

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

r = thisLayer.transform.rotation.valueAtTime(time-d);

[r]

Delay Scale

Here’s the expression if you would like to delay the scale:

//scale

delay = 5;

framerate = 25;

n = name - 1;

d = n*(delay)/framerate;

s = thisLayer.transform.scale.valueAtTime(time-d)[0];

[s,s]

There are endless options for this expression, so play with it and see what you can achieve!

Previous
Previous

Inertia

Next
Next

Bounce