Tutorial 17: ValueAtTime Animation Delay
In this tutorial, I will show you how you can use ValueAtTime expression to easily delay your animations, make them more complex with Time Delay and easily control the whole set up from 1 place and 1 set of keyframes.
You can use ValueAtTime on any property that gives you a numerical value. Rotation, position, opacity, Shape Size and so on.
Position Delay
By using index-1 property, we can easily duplicate the layer and reference “one above it” in the Layer Stack. This makes the whole rig much more flexible. You can add, swap or subtract layers, without breaking the expressions.
d = delay*thisComp.frameDuration;
By converting the delay value to Composition Time, we convert values form SECONDS to FRAMES. This is especially useful for precision of the delay, as you can go into incremental offsets e.g. 2.5 frames etc.
sourceLayer.position.valueAtTime(time – d)[0];
Final piece of code is the one that does the magic. ValueAtTime() can be added to any property, not only Transform properties. It simply “takes the value” and delay it by X amount of time.
Parented Position Delay
If you have a number of parented layers and want to use POSITION as you animation driver, you need to use different delay expression. It is because Layer and Comp spaces are 2 different things. And when one layer (A) is parented to another layer (B), then A exist in Layer Space vs B existing in Composition Space.
This is a bit confusing at first. Jake In Motion did an excellent video explaining this concept. Watch it if you are still confused about my explanation in my tutorial 🙂
Examples in Practice
Here are a number of examples I created to showcase, what you can do with ValueAtTime expression. All of the examples are driven by a small number of keyframes and using a combination of ValueAtTime + Slider Delay animation as well.
By combining them with other expressions, like incremental size increase in Triangle example, we can easily get more and more complex designs. And all of them can be modified quickly and efficiently.
Make sure to download the Project File to see how everything is structured and connected with each other. Have fun!
This project file contains all the assets necessary to make animation in the tutorial in final form. Everything is labeled, linked, with expressions and ready to use, if you wish to make your own version or just play around with it.
If you have any suggestions for tutorials or how I can improve, please do get in touch. I would love to hear from you.