-
Is there a way to calculate the maximum velocity between two keyframes?
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;
}