FORUMS: list search recent posts

Inertial decay of position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Navarro Parker
Inertial decay of position
on Mar 12, 2013 at 10:52:14 pm

I'm trying to replicate the motion of an iPad flick scroll. If I have a beginning and end position keyframe, I'd like an expression to continue the motion in the same direction but slowly brake/decay until it stops moving.

I'd like to define a stopping distance in frames/time. (such as: keep skidding for 15 frames after you hit the last position keyframe. But at the 16th frame, be at a complete dead stop)

I'd really appreciate some assistance. (A Google search only yielded elastic bouncy expressions)


Return to posts index

Todd Kopriva
Re: Inertial decay of position
on Mar 13, 2013 at 12:01:29 am

This script makes such things easy:
http://aescripts.com/ease-and-wizz/

---------------------------------------------------------------------------------------------------------
Todd Kopriva, Adobe Systems Incorporated
After Effects quality engineering
After Effects team blog
---------------------------------------------------------------------------------------------------------


Return to posts index

Navarro Parker
Re: Inertial decay of position
on Mar 13, 2013 at 6:35:38 pm

Thanks Todd. Yeah, I've been using E&W for years. Not exactly what I'm asking for.


Return to posts index


Dan Ebberts
Re: Inertial decay of position
on Mar 14, 2013 at 11:49:18 pm

I've been thinking about this off and on, and it turns out that it's trickier than it seems. But I think I've got something that works if you're willing to accept a sine ease. This assumes you have two keyframes and the ease will be applied after the second keyframe so that the overshoot ease is finished by the duration defined by variable frames:


frames = 15; // overshoot frames

if (numKeys == 2){
t2 = key(2).time;
if (time < t2){
value
}else{
ot = framesToTime(frames);
freq = 1/(4*ot);
t = Math.min(ot,time-t2)
amp = velocityAtTime(t2 - .001);
w = freq*Math.PI*2;
valueAtTime(t2) + amp*Math.sin(t*w)/w;
}
}else
value



Dan



Return to posts index

Navarro Parker
Re: Inertial decay of position
on Mar 15, 2013 at 6:13:49 pm

Thanks Dan. Yeah, this behaves differently than I imagine. That sine falloff is a lot "slippery-er" than I expect. Layers just want to slider off my page with the smallest push. Reducing the overshoot frames makes it brake unnaturally.

Hmmmm... I guess I want a more graceful braking. I'm scrolling through my iPod playlist. I can give a quick flick, and it'll scroll very fast, but then gently brake to a complete stop. Fiddling with your expression a little, I can't seem to get short fast motion with that perfect de-acceleration.


Return to posts index


Dan Ebberts
Re: Inertial decay of position
on Mar 15, 2013 at 11:17:32 pm

I don't know if this is headed in the right direction, but here's another version with an exponential ease. Variable damp adjusts how fast it slows down:



damp = 5;

if (numKeys == 2){
t2 = key(2).time;
if (time < t2){
value
}else{
t = time - t2;
amp = velocityAtTime(t2 - .001);
valueAtTime(t2) + amp*(1-1/Math.exp(t*damp))/damp
}
}else
value



Dan



Return to posts index


Navarro Parker
Re: Inertial decay of position
on Mar 19, 2013 at 10:57:49 pm

That's fantastic! Thank you very much!


Return to posts index

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