Reference+
Name
curve()
Description
Draws a curved line on the screen. The first and second parameters specify the beginning control point and the last two parameters specify the ending control point. The middle parameters specify the start and stop of the curve. Longer curves can be created by putting a series of curve() functions together or using curveVertex(). An additional function called curveTightness() provides control for the visual quality of the curve. The curve() function is an implementation of Catmull-Rom splines. Using the 3D version requires rendering with P3D (see the Environment reference for more information).
Examples
size(400, 400); noFill(); stroke(255, 102, 0); curve(20, 104, 20, 104, 292, 96, 292, 244); stroke(0); curve(20, 104, 292, 96, 292, 244, 60, 260); stroke(255, 102, 0); curve(292, 96, 292, 244, 60, 260, 60, 260);
Syntax
curve(x1, y1, x2, y2, x3, y3, x4, y4)
curve(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
Parameters
x1
(float)
coordinates for the beginning control pointy1
(float)
coordinates for the beginning control pointx2
(float)
coordinates for the first pointy2
(float)
coordinates for the first pointx3
(float)
coordinates for the second pointy3
(float)
coordinates for the second pointx4
(float)
coordinates for the ending control pointy4
(float)
coordinates for the ending control pointz1
(float)
coordinates for the beginning control pointz2
(float)
coordinates for the first pointz3
(float)
coordinates for the second pointz4
(float)
coordinates for the ending control point
Return
void
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.