Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Extendscript replacement for the “velocityAtTime” function in AE expressions?

  • Extendscript replacement for the “velocityAtTime” function in AE expressions?

  • tiger billy

    December 14, 2022 at 1:52 am

    I was making small changes to the bounce expression below in order to call it in extendscript:

    Realistic Bounce and Overshoot (

    About 10 lines down we see:

    v = -velocityAtTime(key(n).time – .001)*e;


    According to the expressions documentation the velocityAtTime function lives on the property object: Property — After Effects Expression Reference 0.0.3 documentation (


    However, according to the scripting guide, there is no velocityAtTime function:

    Property object — After Effects Scripting Guide 22.3.0 documentation (


    Am I overlooking something or should I write this function myself? For further context, it looks like expressions have access to a variable space that is different from extendscript. e.g. I can call “numKeys” in an expression by itself but in extendscript I need to specify the comp -> layer = > property. This makes sense as an expression is “attached” to an existing property while an extendscript function exists in the global context.


    Thanks for any help you can provide!


  • Dan Ebberts

    December 14, 2022 at 8:16 am

    I guess there would be a couple of approaches. One would be to sample the value at a small amount of time on both sides of the target time and use those to calculate the velocity. Or, temporarily apply an expression, harvest the value, and delete the expression.

  • tiger billy

    December 14, 2022 at 9:36 pm

    Thanks for the thoughtful reply Dan. Do you know if there is a way to view the source code for expression function definitions? Ideally I’d like my extendscript velocityAtTime function to be a 1:1 copy in order to avoid unanticipated issues due to assumptions on my part.

  • Dan Ebberts

    December 15, 2022 at 12:32 am

    I can’t imagine that the source code would be accessible. You might be able to reverse engineer something based on information that you do have access to, like the KeyframeEase object and cubic bezier formulas. Sounds like a bit of work though…

Viewing 1 - 4 of 4 posts

Log in to reply.

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