ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Smoothing rotation of auto-orient along path

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mike Foran
Smoothing rotation of auto-orient along path
on Sep 16, 2019 at 6:20:43 pm

I have an object moving along a 2D path with auto orient turned on. The path has several 90° angles, which predictably cause the object to instantly rotate to match. I'm looking for an expression that will replace Auto-Orient that can smooth this rotation out, so the spreads out over x period of time. Anyone know how I could do this?


Return to posts index

Dan Ebberts
Re: Smoothing rotation of auto-orient along path
on Sep 16, 2019 at 6:57:09 pm

Maybe something like this:


f = 2; // number of frames before and after to average
v = [0,0];
for (i = -f; i <= f; i++){
v += position.velocityAtTime(i*thisComp.frameDuration + time);
}
v /= (f*2+1);
a = Math.atan2(v[1],v[0]);
radiansToDegrees(a)



Dan



Return to posts index

Dan Ebberts
Re: Smoothing rotation of auto-orient along path
on Sep 16, 2019 at 7:09:32 pm

Oh yeah, you'd also turn off auto orient.

Dan



Return to posts index


Mike Foran
Re: Smoothing rotation of auto-orient along path
on Sep 16, 2019 at 7:25:20 pm

After all these years I am still in awe of your mastery. Works like a charm. Thanks so much Dan!


Return to posts index

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