Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions function to smooth out motion, POST expression, no keyframes?

  • function to smooth out motion, POST expression, no keyframes?

    Posted by Ze’ev Gilad on August 19, 2020 at 8:23 pm

    Say I have a layer whose position is set only by expression, i.e.
    L=thisComp.layer("text_iso"); s=L.sourceRectAtTime(); r= [s.left + s.width/2, s.top + s.height/2];
    The layer it’s taking its position from ‘cuts’ from position to position.
    Now I want this new layer to move in a linear fashion from the last position to the new position over .5 seconds.
    I thought `smooth()` might do this, but it’s not.

    I know I can do this by writing a `linear()` function that looks for change through `valueAtTime`, etc., but is there an easier way?

    Or does someone have that snippet handy?

    Ze’ev Gilad replied 6 years ago 2 Members · 2 Replies
  • 2 Replies
  • Filip Vandueren

    August 19, 2020 at 8:54 pm

    you can take some samples at different times and average them out, that is how smooth() works.
    so something like.


    L=thisComp.layer("text_iso");

    r=[0,0];

    for (t=0; t < 0.5; t+=0.05) {
    s=L.sourceRectAtTime(time+t);
    r+= [s.left + s.width/2, s.top + s.height/2];
    }
    r/10;

  • Ze’ev Gilad

    August 19, 2020 at 9:40 pm

    That works great, thanks!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy