facebookarchive / Keyframes

A library for converting Adobe AE shape based animations to a data format and playing it back on Android and iOS devices.
https://facebookincubator.github.io/Keyframes/
Other
5.33k stars 302 forks source link

Values in timing_curves outside of [0,1] #148

Open trethaller opened 6 years ago

trethaller commented 6 years ago

We are integrating Keyframes in our project using AE CC 2018. We noticed that timing_curves sometimes contain values greater than 1, which using our bezier interpolation is causing the interpolation to overshoot the range of previous-next keyframes values (control points end-up outside the [0,0] [1,1] window).

For example:

image

Exports to:

{
          "property": "X_POSITION",
          "key_values": [
            {
              "start_frame": 3,
              "data": [
                992
              ]
            },
            {
              "start_frame": 1559,
              "data": [
                861
              ]
            }
          ],
          "timing_curves": [
            [
              [
                1,
                2.61756432200488
              ],
              [
                0.76461011577208,
                1
              ]
            ]
          ]
        }

The 2.617564.. value seems to be caused by the very long yellow curve handle on the first point. Is that expected? If so, what interpolation formula are we expected to use to stay within the keyframes range?

-- Edit: Here is an example of what cubic bezier interpolation gives for control points (1, 2.6) and (0.76, 1) http://cubic-bezier.com/#1,2.6,.76,1