Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Continued motion expression error

  • Continued motion expression error

    Posted by Dan Tiffany on January 5, 2023 at 8:47 pm

    Hi,

    I have this expression that takes the value of the last keyframe and continues.
    I use it often but I am now getting an error.
    I am not great at coding or writing expressions, so any help would be appreciated.

    Thanks,

    nk=numKeys;

    value;

    if ((nk>1) && (key(nk).time<time)) {

    startT=key(nk).time;

    deltaT=thisComp.frameDuration;

    deltaV=key(nk).value – valueAtTime(startT-deltaT);

    key(nk).value + deltaV*(time-startT)/deltaT;}

    Dan Ebberts replied 3 years, 4 months ago 3 Members · 6 Replies
  • 6 Replies
  • Manuel Moellmann

    January 5, 2023 at 9:06 pm

    what kind of error do you get? and what does ‘take the value of the last keyframe and continues’ mean? continues to take the value of the last keyframe? thats what usually happens if its tge last keyframe 😛

  • Dan Tiffany

    January 5, 2023 at 9:16 pm

    Good point.
    It works with most properties, but if you were to use it with position, it would keep the object moving in the same trajectory and speed after the last keyframe.

    This is the error I’m getting.

  • Dan Tiffany

    January 5, 2023 at 9:24 pm

    The strange thing is that in the viewport it shows the bounding box reacting the way it should, but the object stops at the last keyframe.

  • Dan Ebberts

    January 5, 2023 at 9:25 pm

    I think you might just need to rearrange it a little to make the JavaScript engine happy:

    nk=numKeys;
    if ((nk>1) && (key(nk).time<time)) {
    startT=key(nk).time;
    deltaT=thisComp.frameDuration;
    deltaV=key(nk).value - valueAtTime(startT-deltaT);
    key(nk).value + deltaV*(time-startT)/deltaT;
    }else
    value
  • Dan Tiffany

    January 5, 2023 at 9:32 pm

    Thank you so much!

  • Dan Ebberts

    January 5, 2023 at 9:41 pm

    Does this do the same thing?

    if (numKeys > 0)
    loopOut("continue")
    else
    value

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