I think one of the most used expression for After Effects is “valueAtTime()“. That’s pretty useful for offsetting timing/trail movement and so on.

I use it on almost every project and I’m sure that many animators/mographers use it frequently.
So today I share my expression code for advanced delay/timing offset like below GIF. If you want to animate like red one, please check my code and/or download AEP.

Advanced Delay Demo

I guess many animators use “valueAtTime()” like below to offset timing. By the way, I use position property as a sample case.

num = thisComp.layer("leader").index - index; // This number should be 1, 2, 3... n.
offset = framesToTime(2) * num; // You can adjust basic offset amount to change "framesToTime(2)" part.
thisComp.layer("leader").valueAtTime(time - offset);

 

And below is my sample code. Also, you can download sample AEP on my Gumroad.

[Advanced Delay]

decayRate = 0.95; // I recommend 0.95 as default for timing decay rate. And I always set it between 0.9 to 0.98.
basicOffset = framesToTime(4); // Basic timing offset amount(frames).
num = thisComp.layer("leader").index - index; // This number should be 1, 2, 3... n.
offset = basicOffset * num * Math.pow(decayRate, num - 1);
thisComp.layer("leader").transform.position.valueAtTime(time - offset);

 

[Minor changed version]

decayRate = 0.95;
basicOffset = framesToTime(4);
num = parseInt(name.match(/[0-9]+$/)); //In this case, use layer name's last number.
offset = basicOffset * num * Math.pow(decayRate, num - 1);
thisComp.layer("leader").transform.position.valueAtTime(time - offset);

 

Do you enjoy this article? This might not the best way to share AE expressions but I just got started!
I hope this helps you out even just a bit. And I really hope I’ll be able to continue to write this expression series post here on my blog!

4 thoughts on “ AE Expression Showcase: Advanced Delay ”

  1. Dear Shinsuke Matsumoto
    first of all thank you for your explanation and expression, I’ve been looking for the best expression to animate with offset, and it has been very very useful. The problem for mee is that I need lots and lots of shapes, so, I don’t Know why, when I put more than 20 the 21 doesn’t follow 20, and 22 doesn’t follow 21
    I aplied your expression to scale and I put 30 circles in line
    Could you help me please

    1. Thank you for your comment, Beatriz. I’m glad you feel it’s useful.
      I think your problem is the value of Decay Rate or Basic Offset. If you want to animate many elements like you said, the value of Decay Rate should be set to like “0.995” (closer to 1) for example. Or you should set Basic Offset to a larger number like “framesToTime(16)”.
      In any case, this expression might not work properly if you want to animate so many elements like 50 layers. I hope this helps you out.

      1. It was very useful, thanks for all, but I finally used this one

        decayRate = 0.98;
        basicOffset = framesToTime(2);
        num =(index-1);
        offset = basicOffset * num * Math.pow(decayRate, num – 1);
        thisComp.layer(“leader”).transform.scale.valueAtTime(time – offset);

        With an slider

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s