[−][src]Static p5_sys::global::curvePoint
pub static curvePoint: CurvePointInternalType
Evaluates the curve at position t for points a, b, c, d. The parameter t varies between 0 and 1, a and d are control points of the curve, and b and c are the start and end points of the curve. This can be done once with the x coordinates and a second time with the y coordinates to get the location of a curve at t.
Examples
noFill(); curve(5, 26, 5, 26, 73, 24, 73, 61); curve(5, 26, 73, 24, 73, 61, 15, 65); fill(255); ellipseMode(CENTER); let steps = 6; for (let i = 0; i <= steps; i++) { let t = i / steps; let x = curvePoint(5, 5, 73, 73, t); let y = curvePoint(26, 26, 24, 61, t); ellipse(x, y, 5, 5); x = curvePoint(5, 73, 73, 15, t); y = curvePoint(26, 24, 61, 65, t); ellipse(x, y, 5, 5); }
Parameters
a
coordinate of first control point of the curve
b
coordinate of first point
c
coordinate of second point
d
coordinate of second control point
t
value between 0 and 1