Expression Copied to Clipboard! πŸ—‚
← Back to Expressions

Delay Keyframes With Slider ValueAtTime() - After Effects Expression

Use a slider control to delay keyframe animation by a defined amount of seconds. Works like a marker trigger, but simpler. Useful for MOGRTs

Delay Keyframes With Slider ValueAtTime()

delay = thisComp.layer("Controls").effect("Delay")("Slider"); // pickwhip to your Delay Slider (in seconds)
valueAtTime(time-delay)

Copied to Clipboard!
delay = thisComp.layer("Controls").effect("Delay")("Slider"); // pickwhip to your Delay Slider (in seconds) valueAtTime(time-delay)

How to Delay Keyframes with ValueAtTime() and a Slider

The valueAtTime() expression get the property's current value at the provided time. If you use valueAtTime(1), the expression will return the value at second 1 of your composition.

But here's the magic. You can add a delay to the "time" and offset your current animation by and adjustable amount.

valueAtTime(time-delay)

Then, just link the delay variable to a Slider Control and you have an easy, animatable controlled delay to your animation.

(extremely useful for templates)

How to Create a Delay between Layers

You can also use this type expression to have one layer follow another layer with a delay. Just add this expression to the position property of Layer B (the following layer).

var delay = 0.5
var layerAPosition = // pickwhip to the leading layer
layerAPosition.valueAtTime(time-delay)

Now Layer B will follow Layer A with a 0.5 second delay!

More expressions you might like...

Credit