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!

One thought on “ AE Expression Showcase: Advanced Delay ”

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