ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to maintain linear velocity

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matthew Woods
Expression to maintain linear velocity
on Aug 19, 2010 at 9:08:32 pm

I seem to remember there being a simple expression that you can add to a keyframed property similar to loopOut that will extrapolate and maintain a linear velocity based on the velocity and vector of the last keyframe. I can't find it or figure it out though. Can anyone tell me what it is? It would really help me on this project.

Thanks,

-Matt


Return to posts index


Chris Wright
Re: Expression to maintain linear velocity
on Aug 19, 2010 at 11:40:18 pm

That's easy, just take the very last keyframe, then distance = velocity * time. And the exact same code pasted into the rotation will work too.


n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}

if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*t;
}else{
value;
}

http://technicolorsoftware.hostzi.com/


Return to posts index


Walter Soyka
Re: Expression to maintain linear velocity
on Aug 20, 2010 at 12:31:42 am

Well, that, or this:

loopOut("continue")

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index


Chris Wright
Re: Expression to maintain linear velocity
on Aug 20, 2010 at 12:49:35 am

true, but you can't use sliders with that.

http://technicolorsoftware.hostzi.com/


Return to posts index

Matthew Woods
Re: Expression to maintain linear velocity
on Aug 20, 2010 at 1:17:57 pm

loopOut("continue") was what I was looking for.
I couldn't remember it.

Thanks both for the helpful replies!

-Matt

Need a quick break from motion graphics?
Try my game Constellation at:
http://www.paperdragongames.com


Return to posts index

Walter Soyka
Re: Expression to maintain linear velocity
on Aug 20, 2010 at 1:22:47 pm

I'll keep Chris's expression in my back pocket, too -- he really knows his stuff, and if he's concerned about limitations of loopOut("continue"), it'd be good to have his code around if you run into them.

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]