Skip to main content

animation_curve_fit

Functions

Calculates a Catmull-Rom style tangent (slope) for a point in the dataset.

Fits a smooth AnimationCurve to a set of discrete 2D points using adaptive Cubic Hermite Spline fitting.

This utility performs data reduction (lossy compression) on dense time-series data. It recursively subdivides the dataset, inserting Keyframes only where the interpolated curve deviates from the original points by more than maxError.

Tangents are automatically estimated based on the slope of the input data (Catmull-Rom style), ensuring smooth transitions between keyframes.

calculateTangent(points, points_offset, points_count, index)

Calculates a Catmull-Rom style tangent (slope) for a point in the dataset.

Kind: global function

ParamType
pointsArray.<number>
points_offsetnumber
points_countnumber
indexnumber

animation_curve_fit(points, [input_offset], [input_count], [maxError]) ⇒ AnimationCurve

Fits a smooth AnimationCurve to a set of discrete 2D points using adaptive Cubic Hermite Spline fitting.

This utility performs data reduction (lossy compression) on dense time-series data. It recursively subdivides the dataset, inserting Keyframes only where the interpolated curve deviates from the original points by more than maxError.

Tangents are automatically estimated based on the slope of the input data (Catmull-Rom style), ensuring smooth transitions between keyframes.

Kind: global function

ParamTypeDescription
pointsArray.<number>flat array of coordinates [x0, y0, x1, y1, ... xn, yn]
[input_offset]numberflat offset into the input array where to start reading data
[input_count]numbernumber of points to fit, counted in points i.e., pairs of (x,y) values
[maxError]numberMaximum allowed deviation. Higher values produce fewer keys (more compression), lower values preserve more detail.

animation_curve_fit~resultKeys : Array.<Keyframe>

Kind: inner constant of animation_curve_fit

animation_curve_fit~fitSegment(firstIndex, lastIndex)

Recursive function to find split points

Kind: inner method of animation_curve_fit

ParamType
firstIndexnumber
lastIndexnumber