n-degree Bezier curve interpolation.
Returns the value at
t for a bezier curve of
In other words, if you pass it a 3-element array you'll get the results of a
3-degree (quadratic) curve.
var bezier =// 1// 1.5
You can use a curve for each dimension to get the resulting bezier you're probably familiar with:
var canvas = documentvar ctx = canvasvar bezier =var x = 0 1 2var y = 2 1 0ctxctxstrokeStyle = '#000'for var t = 0; t < 1; t += 001ctxctxctx
curve = require('bezier').prepare(pointCount)
Generates a function which takes
pointCount number of points to draw a
bezier curve. For higher values of
pointCount, this function is generated on
the fly such that it can run with as little overhead as possible.
It's a small trade-off in flexibility for a small benefit in performance :)
Given an array of
points that is
pointCount long, return the value across
the curve at
var quadratic =var cubic =// 1// 1.5// Note that these functions expect// arrays of the correct length:// 1// NaN
MIT. See LICENSE.md for details.