Draws a curve using a Catmull-Rom spline.
Spline curves can form shapes and curves that slope gently. They’re like cables that are attached to a set of points. By default (ends: INCLUDE
), the curve passes through all four points you provide, in order p0(x1,y1)
-> p1(x2,y2)
-> p2(x3,y3)
-> p3(x4,y4)
. Think of them as points on a curve. If you switch to ends: EXCLUDE
, p0 and p3 act like control points and only the middle span p1->p2
is drawn.
Spline curves can also be drawn in 3D using WebGL mode. The 3D version of spline()
has twelve arguments because each point has x-, y-, and z-coordinates.
Ejemplos
Sintaxis
spline(x1, y1, x2, y2, x3, y3, x4, y4)
spline(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
Parámetros
Referencias Relacionadas
bezier
Dibuja una curva de Bézier.
bezierDetail
Establece el número de segmentos utilizados para dibujar curvas de Bézier en modo WebGL.
bezierPoint
Calcula coordenadas a lo largo de una curva de Bézier utilizando interpolación.
bezierTangent
Calcula coordenadas a lo largo de una línea tangente a una curva de Bézier.