ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# continue motion velocity

FAQ   •   VIEW ALL
 continue motion velocity by jsbaxteron Jan 17, 2006 at 2:54:21 pm

I would like to know how to continue velocity with a loop out expression. for example..I have a tracked subject that goes off frame..however the tracking markers go behind something durring the las 20 frames or so. The motion does a "U" shape..but at the end of the U is where it gets blocked..so is there a way for me to just allow after affects to figure out the motion and continue velocity? I tried "loopOut" with offset as the type..but it just continues the U shape over again, just offset from its final key frame..and obvious Pingpong wont work. Cycle will just repeat. and "Continue" doesnt seem to be a legit argument string..So can someone help me???

 Re: continue motion velocityby Myleniumon Jan 17, 2006 at 6:42:11 pm

loopOut("continue",0);

Use it all the time, dunno why it doesn't work for you.

Mylenium

[Pour Myl

 Re: continue motion velocityon Jan 17, 2006 at 7:06:35 pm

Me too. Check your syntax -- expressions seem to be case sensitive.

Steve

 Re: continue motion velocityon Feb 21, 2017 at 3:21:43 am

Mine worked after I removed the ",0" from the expression:

loopOut("continue");

 Re: continue motion velocityon Jan 17, 2006 at 6:57:53 pm

So, you want After effects to guess where a layer would end up if it would just continue at the same speed and direction as was established by the last known keyframes ?

The easiest way to do that is by hand:

Just create a new keyframe (position presumably) or just drag the layer to where you think it should go: check the motion path to inform your guess.

Now twirl open the speed option, and drag the keyframe in time untill the speed between the last keyframe and the one you created lines up.

It's not that hard to write an expression for this, but it seems a bit overkill, unless you want it to be mathematically correct.

 Re: continue motion velocityon Jan 17, 2006 at 7:18:49 pm

Ok, what the hell...

here's the expression:

``` nk=numKeys; value; if ((nk>1) && (key(nk).time<time)) { deltaV=key(nk).value - key(nk-1).value; deltaT=key(nk).time - key(nk-1).time; key(nk).value + deltaV*(time-key(nk).time)/deltaT; } ```

It works like a kind of "throw"

If you keyframe two postions, rotations, opacities, scales etc... the property will just keep on going at constant speed.
It does assume the interpolation is pretty linear.

 Re: continue motion velocityon Jan 17, 2006 at 10:55:53 pm

Came back to it after some thinking:

``` 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; } ```

This sees what the property was doing in the last Frame before the last keyFrame, so it's a bit smarter when it comes to non-linear interplation.
You could also set it to an even lower value like this: deltaT=0.001, in theory that would give you a more accurate value, untill the rounding errors kick in.

Take note though that we're still talking about a linear motion after the last keyframe. If you want the expression to guess how a layer that moves in a curve would continue to curve...

Well... do it by hand ;-)