Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Time Remap expression for multiple keyframes

  • Time Remap expression for multiple keyframes

    Posted by Kirill Skorodelov on November 25, 2015 at 9:47 am

    Hi I’ve build an expression for Time Remap keyframes but it works with first four keyframes only. Maybe someone can prompt me how to make it work with more than these four keyframes.

    There are seven keyframes in total applied to the precomp with animation. An animation looks like a transitions between three static scenes. So three static scenes and three transitions between them and the main idea of this expression is to extend timing between “stop points” keyframes (wrapping static scenes) depending on the overall length of the animation driven by the value in a text layer, but at the same time it needs to keep distance between keyframes wrapping the transitions intact.

    Here’s the expression applied to Time Remap property.

    //7 Time Remap keyframes
    t1 = key(1).time;
    t2 = key(2).time;
    t3 = key(3).time;
    t4 = key(4).time;
    t5 = key(5).time;
    t6 = key(6).time;
    t7 = key(7).time;

    //Total length defined in a text layer
    Length=thisComp.layer("TotalLength").text.sourceText.value;

    //Number of the transitions
    AnimNum=3;

    //Number of the static scenes
    StopsNum=3;

    //Transition timings
    AnimTime1= t2-t1;
    AnimTime2= t4-t3;
    AnimTime3= t6-t5;
    TotalAnimTime = AnimTime1+AnimTime2+AnimTime3;

    //Static scenes duration depending on length
    StopTime=(Length-TotalAnimTime)/StopsNum;

    //New timing for keyframes recalculated depending on length
    NewTime1 = 0; //it should always be 0
    NewTime2 = NewTime1+AnimTime1;
    NewTime3 = NewTime2+StopTime;
    NewTime4 = NewTime3+AnimTime2;
    NewTime5 = NewTime4+StopTime;
    NewTime6 = NewTime5+AnimTime3;
    NewTime7 = Length;

    //And here is the part where I need help. So far I'm able to assign new timing with linear expression only but it works with four keyframes only.

    if (time<=NewTime2) { t = linear(time,NewTime1,NewTime2,t1,t2); valueAtTime(t) } else { t = linear(time,NewTime3,NewTime4,t3,t4); valueAtTime(t) }

    Miguel De mendoza replied 10 years, 5 months ago 2 Members · 1 Reply
  • 1 Reply
  • Miguel De mendoza

    November 25, 2015 at 1:48 pm

    Maybe this aproach is what do you need:
    https://motionscript.com/design-guide/marker-sync.html

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