Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Offset timing of 3rd and 4th Keyframe via slider

  • Offset timing of 3rd and 4th Keyframe via slider

    Posted by James Ronan on January 22, 2018 at 1:58 pm

    Hi there

    What I would like to do is to control what time the 3rd and 4th keyframes (one second apart) begin via a slider.

    e.g. If the slider value is 4, then the 3rd keyframe will start at 4 seconds and the 4th keyframe is at 5 seconds.
    If the slider value is 10, then the 3rd keyframe will start at 10 seconds, and the 4th keyframe will be at 11 seconds.

    etc. etc.

    I want to keep all the easing I already have between the two if that is possible.

    So far I’ve been messsing around with:

    if (numKeys > 2){
    dur = (effect(Slider Control")("Slider"))
    t = time - dur
    valueAtTime(t)
    } else
    value

    This is sort of doing it but not quite…

    Any suggestions would be awesome!

    Thanks

    James

    James Ronan replied 8 years, 3 months ago 1 Member · 1 Reply
  • 1 Reply
  • James Ronan

    January 22, 2018 at 3:08 pm

    SOLVED!

    After more searching I’ve found an old post with something that will work:

    Instead, this uses a slider to hold the values between 2nd and 3rd keyframes…

    holdTime = effect("Slider Control")("Slider");
    k1 = 2; // 1st hold keyframe
    k2 = 3; // 2nd hold keyframe
    p = transform.position;
    t1 = p.key(k1).time;
    t2 = t1 + holdTime;
    if (time < t1)
    t = time
    else if (time < t2)
    t = linear(time,t1,t2,t1,p.key(k2).time)
    else
    t = p.key(k2).time + (time - t2);
    valueAtTime(t)

    The old post for reference:
    https://forums.creativecow.net/thread/227/18402

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