Skip to content

Instantly share code, notes, and snippets.

collarbone / catmullFitter.js
Created August 23, 2019 06:18 — forked from nicholaswmin/catmull-rom.js
Catmull Rom Fitting Algorithm in Javascript through a series of X/Y Points
* Interpolates a Catmull-Rom Spline through a series of x/y points
* Converts the CR Spline to Cubic Beziers for use with SVG items
* If 'alpha' is 0.5 then the 'Centripetal' variant is used
* If 'alpha' is 1 then the 'Chordal' variant is used
* @param {Array} data - Array of points, each point in object literal holding x/y values
* @return {String} d - SVG string with cubic bezier curves representing the Catmull-Rom Spline
collarbone / flatten.js
Created August 19, 2019 03:24 — forked from alexjlockwood/flatten.js
Flatten.js, general SVG flattener. Flattens transformations of SVG shapes and paths. All shapes and path commands are supported.
<!doctype html>
<title>Flatten.js, General SVG Flattener</title>
Random path and shape generator, flattener test base:
Basic usage example: