Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Is there a way to calculate the maximum velocity between two keyframes?

  • Is there a way to calculate the maximum velocity between two keyframes?

  • Tim Harwell

    April 1, 2020 at 6:08 pm

    Hello,

    I’m wanting to calculate the maximum speed between the most recent two keyframes and then use that value to initiate an exponentially decaying sine wave.

    This is about as far as I’ve gotten:

    thisComp.layer(“Shape Layer 1”).position.speed.toFixed(2);

    I’ve seen code for calculating the maximum value of keyframes, but not speed.

    Any help would be greatly appreciated!

    Thanks in advance,

    Tim

    myProp = transform.opacity;
    if (myProp.numKeys > 0){
    myMin = 9999;
    myMax = -9999;
    for (i = 1; i <= myProp.numKeys; i++){
    myMin = Math.min(myMin,myProp.key(i).value);
    myMax = Math.max(myMax,myProp.key(i).value);
    }
    }else{
    myMin = myMax = myProp.value;
    }

  • Darby Edelen

    April 4, 2020 at 9:55 pm

    When you say ‘between the most recent two keyframes’ do you mean the maximum speed that is reached at any point in between those keyframes or the maximum speed at one of those two keyframes?

    Darby Edelen

Viewing 1 - 2 of 2 posts

Log in to reply.

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