UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

17 lines 1.22 kB
/** * Fits a smooth {@link 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 {@link Keyframe}s 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. * * @param {number[]} points flat array of coordinates [x0, y0, x1, y1, ... xn, yn] * @param {number} [input_offset] flat offset into the input array where to start reading data * @param {number} [input_count] number of points to fit, counted in points i.e., pairs of (x,y) values * @param {number} [maxError] Maximum allowed deviation. Higher values produce fewer keys (more compression), lower values preserve more detail. * @returns {AnimationCurve} */ export function animation_curve_fit(points: number[], input_offset?: number, input_count?: number, maxError?: number): AnimationCurve; import { AnimationCurve } from "./AnimationCurve.js"; //# sourceMappingURL=animation_curve_fit.d.ts.map