Skip to main content

Home > @jsplumbtoolkit/browser-ui > pointOnCurve

pointOnCurve() function

calculates a point on the curve, for a Bezier of arbitrary order.

Signature:

export declare function pointOnCurve(curve: Curve, location: number): PointXY;

Parameters

ParameterTypeDescription
curveCurvean array of control points, eg [{x:10,y:20}, {x:50,y:50}, {x:100,y:100}, {x:120,y:100}]. For a cubic bezier this should have four points.
locationnumbera decimal indicating the distance along the curve the point should be located at. this is the distance along the curve as it travels, taking the way it bends into account. should be a number from 0 to 1, inclusive.

Returns:

PointXY