ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Time remap based on velocity/direction?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mike Douglas
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!

Return to posts index

Andrei Popa
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;
pose = (vel[1]>0) ? 2 : 1;


My Envato portfolio.

Return to posts index

Mike Douglas
Re: Time remap based on velocity/direction?
on Jan 7, 2020 at 12:10:46 am

Wow - that's perfect! Thanks so very much, Andrei - you've just saved me hours and hours of work. Very much appreciated!!

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 All Rights Reserved