I’m writing a script that exports layer properties based on their keyframes to animate on html.
There are 3 different groups of properties and each takes a different calculation.
This is the easiest. For each dimension I get the averageSpeed. And then I calculate the control points of the easing curve.
averageSpeed[index] = (endKey.value[index] - initKey.value[index])/duration;
bezierIn.x[index] = 1 - item.influence / 100;
bezierOut.x[index] = initKey.easeOut[index].influence / 100;
bezierIn.y[index] = 1 - ((item.speed) / averageSpeed[index]) * (item.influence / 100);
bezierOut.y[index] = ((initKey.easeOut[index].speed) / averageSpeed[index]) * bezierOut.x[index];
For these spatial properties, to get the average speed I need to get first the spatial distance of the curve, and then it’s similar to the case before.
averageSpeed = getCurveLength(initKey.value,endKey.value, initKey.tangentOut, endKey.tangentIn)/duration;
bezierIn.x = 1 - endKey.easeIn.influence / 100;
bezierOut.x = initKey.easeOut.influence / 100;
bezierIn.y = 1 - ((endKey.easeIn.speed) / averageSpeed) * (endKey.easeIn.influence / 100);
bezierOut.y = ((initKey.easeOut.speed) / averageSpeed) * bezierOut.x;
Shape is the same as the previous one, only that average speed is always 1.
All of them work fine in common cases. But for spatial properties, After Effects reports the influence incorrectly in some cases.
It seems the influence is intentionally limited so the speed won’t get negative values along the path.
I don’t understand exactly how the influence is limited but the property´s keyInTemporalEase and keyOutTemporalEase still reports the value set by the user and not the limited value.
I need to get the actual value so I can replicate the animation correctly when I export it.
Does anyone have any idea how to get the real value of the influence property? Am I understanding what is going on correctly?
Here´s a graph that shows the curve when the influence is limited.