Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Trigger animation by trim path

  • Trigger animation by trim path

  • Joseph Fowler

    November 15, 2022 at 10:00 pm

    Hello all, obligatory I’ve looked for this everywhere and can’t seem to find an answer, so thanks in advance for your patients! I’m making a video that features an animated timeline. As time passes in the video the timeline is highlighted to show where we are in time, and I want thumbnails to pop up at various intervals as the highlighter reaches that point. So a picture for 2010 pops up as the highlighter passes 2010.

    What I’ve done is added a trim path to the highlighter shape, then used a linear function to remap the percentage to correspond to the x values in the comp (0 to 1920). Then I created a conditional function on the scale property of the first thumbnail that looks the xPosition of the highlighter trim path and compares it to the xPosition of the current Thumbnail. When the highlighter passes the thumbnail, the condition is met. Here’s my problem:

    I want the thumbnail to actually animate on (as opposed to being a binary on or off). So I added a linear function, but I can’t figure out what to do about time. If the reference for time is static, I have to change it for every layer (and pretty much making this whole exercise pointless as I could simply precomp the animation and change in the in points to roughly coincide with the animation of the timeline). But if the reference for time is relative it creates an infinite loop. I couldn’t do time and time + 3 for example because it continues on forever without actually getting there.

    So my question is, what can I put for t1 and t2 in the below example in order for the linear function to start exactly when the condition of the if statement is met?

    t1 =

    t2 =

    S = linear(time, t1, t2, 0, 100);

    if (thisComp.layer(“Timeline Animation”).effect(“Trim Path to Pixels”)(“Slider”) < transform.xPosition) {[0,0]} else {[S,S]}

  • Dan Ebberts

    November 15, 2022 at 10:32 pm

    The key to something like this is for the expression to calculate when the Trim Paths reached the triggering threshold for this particular layer and calculate the time since that event, and use that to drive the animation. Worst case, you could do something like this:

    dur = .5; // duration of scale-up (in seconds)
    s = 0;
    x = thisComp.layer("Timeline Animation").effect("Trim Path to Pixels")("Slider");
    if (x > transform.xPosition){
    t = time - thisComp.frameDuration;
    while (x.valueAtTime(t) > transform.xPosition){
    t -= thisComp.frameDuration;
    delta = time - t;
    s = linear(delta,0,dur,0,100);
  • Dan Ebberts

    November 16, 2022 at 1:11 am

    If you’re animating the Trim Path’s End property with linear keyframes, there’s likely a more efficient way to do it.

Viewing 1 - 3 of 3 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy