I'll try to explain a little bit more in-depth, I'm making a set of animations for a website and the client essentially wants a preview of how each element reacts to each other as you're scrolling down the page. I have no experience with website development and that is fine for this job, as all im doing is setting up an interactive preview for the developer.

So far I've parented all the elements to a Null object and the Y position value of that null to slider controls and so far so good.

Now where I'm lost or in fact, confused if it's even possible within AE is to set up each animation element to start its sequence once I scroll the slider to a specific value? I'm not too familiar with expressions so any help will be appreciated.

If you need me to explain in more detail please do ask, hopefully I've tried to make it clear for what I'm asking 👍🏽


You need to provide a bit more detail, but if you want an expression to happen only when a slider is above a certain value you can use if(something > somethingElse){do stuff here}.

To time an animation so that it starts at that point is more tricky. Expressions can't store variables; they just evaluate each frame. So to find how far through the action the animation should be you'd have to calculate the first frame at which the property went above the threshold. You can do this with a loop:

var propertyToWatch = thisComp.layer("someLayer").someProperty;
var threshold = 12345;
if (propertyToWatch > threshold){ // above the threshold, time to do stuff
    var t = 0;
    // now search for the time when the property went above the threshold
    while (t <= thisComp.duration && propertyToWatch.valueAtTime(t) < threshold){
        t += thisComp.frameDuration; //add one frame
    // t now equals the time when the property went above the threshold.
    // so the animation's relative age is time - t
    var animationAge = time - t;
    //do the animation stuff here, using animationAge as the time constant

This expression will get progressively slower to calculate as the sequence gets older, because the inner while loop has to be evaluated for each preceding frame. But usually only a problem if you have lots and lots of layers with this kind of expression, or your comp is half an hour long.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.