KurvenLineal

bezier curve fitting

degree
offsets

curve

sizes · output · □ on curve

color ramp · lch, random lightness · top input · bottom fitted

KurvenLineal

GitHub

kurvenlineal is a bezier easing run in reverse. Normally you start with a cubic-bezier() and sample values from it, in this case you start with the values: hand it a list of numbers and it finds the quadratic or cubic easing (endpoints fixed at 0,0 → 1,1) that stays as close as possible to all of them (a least-squares fit).

The fit also records each value's deviation from the curve, so a resampled list can carry those deviations along, as absolute offsets or relative ratios.

One thing it's useful for: design-system scales. Point it at the type or spacing sizes you already have and you get the curve behind them — as a function, or as bezier control points — plus the ability to resample the scale to any number of steps.

Acknowledgments

The library is dependency-free. The typefaces are the open-source Iosevka and Astloch.

Created by David Aerne.