Skip to content
🎉 Angular Three v4 is here! Read the announcement

Curves

angular-three-ecctrl/curves exports the public curve point, curve data, and LUT types together with bakeCurveLut and evaluateCurveLut.

ExportDescription
NgteEcctrlCurvePointA point with x, y, and optional incoming/outgoing tangent angles and weights: r_in, r_out, w_in, and w_out.
NgteEcctrlCurveDataCurve data with points and optional LUT samples.
NgteEcctrlCurveLutBaked lookup table with min, max, and values: Float32Array.
bakeCurveLutSorts points by x and bakes a lookup table.
evaluateCurveLutEvaluates a baked table, clamping input to its domain.

r_in and r_out are tangent angles in radians. w_in and w_out control tangent blending: 0 is linear and 1 uses the angle-derived tangent.

import { bakeCurveLut, evaluateCurveLut, type NgteEcctrlCurveData } from 'angular-three-ecctrl/curves';
const curve: NgteEcctrlCurveData = {
points: [
{ x: 0, y: 0, r_out: 0, w_out: 1 },
{ x: 1, y: 1, r_in: Math.PI, w_in: 0.75 },
],
samples: 64,
};
const lut = bakeCurveLut(curve);
const valueAtHalf = evaluateCurveLut(lut, 0.5);

Curves require at least two points. Bake a LUT when editable curve data changes, then evaluate that LUT during simulation. The data is structurally compatible with angular-three-tweakpane/curve, without either package depending on the other.

See the curve editor example.