Reference curvePoint()

curvePoint()

Calculates coordinates along a spline curve using interpolation.

curvePoint() calculates coordinates along a spline curve using the anchor and control points. It expects points in the same order as the curve() function. curvePoint() works one axis at a time. Passing the anchor and control points' x-coordinates will calculate the x-coordinate of a point on the curve. Passing the anchor and control points' y-coordinates will calculate the y-coordinate of a point on the curve.

The first parameter, a, is the coordinate of the first control point.

The second and third parameters, b and c, are the coordinates of the anchor points.

The fourth parameter, d, is the coordinate of the last control point.

The fifth parameter, t, is the amount to interpolate along the curve. 0 is the first anchor point, 1 is the second anchor point, and 0.5 is halfway between them.

Examples

Syntax

curvePoint(a, b, c, d, t)

Parameters

a

coordinate of first anchor point.

b

coordinate of first control point.

c

coordinate of second control point.

d

coordinate of second anchor point.

t

amount to interpolate between 0 and 1.

Notice any errors or typos? Please let us know. Please feel free to edit src/core/shape/curves.js and open a pull request!

Related References