ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Time remap based on velocity/direction?

FAQ   •   VIEW ALL
 Time remap based on velocity/direction? on Jan 6, 2020 at 9:59:24 pm

Hi there, I'm working on a whiteboard explainer video. I have a AE precomp with several hand photos holding a marker, and I'd like it to swap between frames depending on which direction it's travelling. I have photos for a neutral position, plus up, down, left and right (fairly subtle shifts in the hand so that it looks pretty natural). So, if it's travelling left, it'd go to frame 1, etc. Ideally it it's moving too slow, it would just go to the neutral pose, but that's not really necessary. Not sure if any of this is possible or not?

I assume it would need to evaluate which direction the precomp is travelling fastest in, as it will likely never be moving JUST vertically or horizontally. So, if it's going faster in negative X than negative or positive Y, it'd go to frame 1 (left pose).

Hopefully that makes sense. Thanks so much!

 Re: Time remap based on velocity/direction?on Jan 6, 2020 at 11:24:37 pm

Order of poses inside the comp : neutral, up, down, left, right.
Each holds one frame only.
Precomp framerate must equal active composition framerate.

``` neutralSpeed = 50; //pixels pe second, you can modify this vel = position.velocityAtTime(time); if (Math.abs(vel[0]) < neutralSpeed && Math.abs(vel[1])< neutralSpeed){ pose = 0; }else if (Math.abs(vel[0])>Math.abs(vel[1])){ pose = (vel[0]>0) ? 4 : 3; }else{ pose = (vel[1]>0) ? 2 : 1; } framesToTime(pose)```

Andrei
My Envato portfolio.