• Editor
  • Converting Spine Curve Data to Standard Cubic Bezier Curves

Hello everyone,

I'm working with animation data exported from Spine in JSON format, which includes curve values in an eight-value format. These values differ from the typical four-value cubic Bezier curve format that I am more familiar with. Here's an example of the Spine curve data from my export:

{
  "time": 0.0333,
  "y": 222.96,
  "curve": [0.109, 0, 0.094, 0, 0.109, 217.51, 0.094, -6.33]
}

I'm trying to understand how I can convert these Spine-specific curve values into standard cubic Bezier curves. For instance, for the above curve data, a near equivalent in standard cubic Bezier format appears to be (0.26, 0.06, 0.21, 0.97).

Could anyone please explain or provide guidance on how to perform this conversion accurately? Are there specific tools or scripts that facilitate this conversion? Any insights or references to documentation would be greatly appreciated.

Thank you!

Related Discussions
...

The curve data in Spine's JSON format represents Bezier curves using a specific format that includes control points for the curve. The eight-value format you see in the JSON is used to define the curve's control points in a way that is specific to Spine's animation system. To convert these values into a standard cubic Bezier curve format, you need to understand how these control points map to the standard Bezier curve control points.

In Spine, the curve data is stored as a series of control points that define the shape of the curve between keyframes. The values you see are likely representing the control points in a way that is relative to the animation's timeline and the values being animated. To convert these to a standard cubic Bezier format, you would need to map these control points to the standard (x1, y1, x2, y2) format used in cubic Bezier curves.

Unfortunately, there is no direct tool or script provided by Spine to perform this conversion automatically. However, you can manually calculate the equivalent cubic Bezier control points by understanding the relationship between the Spine-specific control points and the standard Bezier curve format. This involves interpreting the control points in the context of the animation's timeline and the specific property being animated.

For more detailed guidance, you might need to delve into the specifics of how Spine's curve data is structured and how it relates to the animation properties. The Spine JSON format documentation and the Spine Runtimes can provide additional insights into how these curves are used within Spine.