Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Offset animation, then loopOut.

  • Offset animation, then loopOut.

    Posted by Griffin Englander on November 7, 2024 at 12:32 am

    Hello all,

    Is there a way to offset the time of some animation (using valueAtTime & framesToTime currently), and then loopOut from that new time?

    I basically want the time of 2 keyframes to be offset (temporally) by a slider, and then loopOut(offset or continue) from there.

    Hopefully it’s obvious, and I’m just dumb.

    Thanks in advance.

    Brie Clayton replied 2 months, 1 week ago 4 Members · 6 Replies
  • 6 Replies
  • Yoan Boisjoli

    November 7, 2024 at 12:45 am

    Hi Griffin! Is the property only one value or an array of 2 or more?

  • Dan Ebberts

    November 7, 2024 at 12:47 am

    I’m not real clear on exactly what you’re asking, but it might end up being something like this:

    tOffset = effect("Slider Control")("Slider");
    t1 = key(1).time;
    t2 = key(2).time;
    dur = t2 - t1;
    t = (time - (t1 + tOffset))%dur;
    valueAtTime(t1+t)
  • Griffin Englander

    November 7, 2024 at 12:55 am

    Thanks guys.

    Hi Yoan! It’s a value of 1 in this case mate.

    Dan, I’ll try and explain a little better.

    I have a tall strip of numbers pre-comped (think an odometer), and this precomp has 3 keyframes on its Y position. Say two keyframes to go from 0 – 100, then a third keyframe to dictate the pause before loopOut(“offset”) comes in and exponentially cycles the animation.

    What I’m hoping for, is to use another slider to offset the point at which that whole animation starts.

    Sorry if that’s even less clear, but thank you for helping.

  • Yoan Boisjoli

    November 7, 2024 at 1:24 am

    Alright I got something like that to work. I’m animating the slider with hold keyframes but feel free to try something else. I’m joining a screencast of how it’s behaving and my ae file also.

    // Time Offset from Slider
    var offset = effect("Slider Control")("Slider")/10; //dividing it by 10 becasue it's sensitive
    // Total duration of the loop (from first to last keyframe)
    var firstKeyTime = key(1).time;
    var lastKeyTime = key(numKeys).time;
    var loopDuration = lastKeyTime - firstKeyTime;
    // Current Time adjusted by the offset
    var adjustedTime = time - offset;
    // Calculate the looped time
    var loopedTime = (adjustedTime - firstKeyTime) % loopDuration + firstKeyTime;
    // Ensure loopedTime doesn't go below the first keyframe time
    loopedTime = (loopedTime < firstKeyTime) ? firstKeyTime : loopedTime;
    // value at the looped time
    valueAtTime(loopedTime);


  • Griffin Englander

    November 7, 2024 at 2:39 am

    Thank you, Yoan. Legend

    I can make that work.

  • Brie Clayton

    November 7, 2024 at 2:52 am

    Thank you for solving this, Yoan!

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