2 Replies Latest reply on Jul 14, 2015 4:29 AM by bodymovin

    Real keyframes speed and influence of spatial properties

    bodymovin Level 1

      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.


      PropertyValueType.COLOR,ThreeD,TwoD,OneD

      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];


      PropertyValueType.ThreeD_Spatial,TwoD_Spatial

      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;


      PropertyValueType.SHAPE

      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.

      graph.jpg


      thanks!

      Hernan