p5 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +1 -1
  2. package/dist/accessibility/color_namer.js +4 -4
  3. package/dist/accessibility/index.js +4 -4
  4. package/dist/accessibility/outputs.js +1 -1
  5. package/dist/app.js +4 -4
  6. package/dist/color/color_conversion.js +4 -4
  7. package/dist/color/index.js +1 -1
  8. package/dist/color/setting.js +1 -1
  9. package/dist/{constants-C2DVjshm.js → constants-8IpwyBct.js} +1 -1
  10. package/dist/core/constants.js +1 -1
  11. package/dist/core/environment.js +1 -1
  12. package/dist/core/friendly_errors/fes_core.js +1 -1
  13. package/dist/core/friendly_errors/index.js +1 -1
  14. package/dist/core/friendly_errors/param_validator.js +1 -1
  15. package/dist/core/friendly_errors/sketch_verifier.js +1 -1
  16. package/dist/core/helpers.js +1 -1
  17. package/dist/core/init.js +4 -4
  18. package/dist/core/legacy.js +4 -4
  19. package/dist/core/main.js +4 -4
  20. package/dist/core/p5.Graphics.js +3 -3
  21. package/dist/core/p5.Renderer.js +2 -2
  22. package/dist/core/p5.Renderer2D.js +4 -4
  23. package/dist/core/rendering.js +3 -3
  24. package/dist/dom/dom.js +1 -1
  25. package/dist/dom/index.js +1 -1
  26. package/dist/dom/p5.Element.js +1 -1
  27. package/dist/dom/p5.MediaElement.js +1 -1
  28. package/dist/image/const.js +1 -1
  29. package/dist/image/filterRenderer2D.js +3 -3
  30. package/dist/image/image.js +3 -3
  31. package/dist/image/index.js +3 -3
  32. package/dist/image/loading_displaying.js +3 -3
  33. package/dist/image/p5.Image.js +2 -2
  34. package/dist/io/files.js +3 -3
  35. package/dist/io/index.js +3 -3
  36. package/dist/{main-rEhlsQtb.js → main-B3Z63C6j.js} +3 -3
  37. package/dist/math/Matrices/Matrix.js +1 -1
  38. package/dist/math/Matrices/MatrixNumjs.js +1 -1
  39. package/dist/math/index.js +1 -1
  40. package/dist/math/p5.Matrix.js +1 -1
  41. package/dist/math/p5.Vector.js +1 -1
  42. package/dist/math/trigonometry.js +1 -1
  43. package/dist/{p5.Renderer-DO9wIL55.js → p5.Renderer-DoDzbpcT.js} +1 -1
  44. package/dist/{rendering-CpHn8PfG.js → rendering-BELwvfI6.js} +3 -3
  45. package/dist/shape/2d_primitives.js +1 -1
  46. package/dist/shape/attributes.js +1 -1
  47. package/dist/shape/curves.js +143 -74
  48. package/dist/shape/custom_shapes.js +261 -277
  49. package/dist/shape/index.js +1 -1
  50. package/dist/type/index.js +2 -2
  51. package/dist/type/p5.Font.js +2 -2
  52. package/dist/type/textCore.js +2 -2
  53. package/dist/webgl/3d_primitives.js +3 -3
  54. package/dist/webgl/GeometryBuilder.js +1 -1
  55. package/dist/webgl/ShaderGenerator.js +10 -7
  56. package/dist/webgl/ShapeBuilder.js +1 -1
  57. package/dist/webgl/index.js +3 -3
  58. package/dist/webgl/interaction.js +1 -1
  59. package/dist/webgl/light.js +3 -3
  60. package/dist/webgl/loading.js +3 -3
  61. package/dist/webgl/material.js +3 -3
  62. package/dist/webgl/p5.Camera.js +3 -3
  63. package/dist/webgl/p5.Framebuffer.js +3 -3
  64. package/dist/webgl/p5.Geometry.js +1 -1
  65. package/dist/webgl/p5.Quat.js +1 -1
  66. package/dist/webgl/p5.RendererGL.js +3 -3
  67. package/dist/webgl/p5.Shader.js +3 -3
  68. package/dist/webgl/p5.Texture.js +3 -3
  69. package/dist/webgl/text.js +3 -3
  70. package/lib/p5.esm.js +414 -358
  71. package/lib/p5.esm.min.js +1 -1
  72. package/lib/p5.js +414 -358
  73. package/lib/p5.min.js +1 -1
  74. package/package.json +1 -1
  75. package/types/core/main.d.ts +87 -71
  76. package/types/global.d.ts +87 -71
  77. package/types/p5.d.ts +87 -71
  78. package/types/shape/curves.d.ts +130 -56
  79. package/types/shape/custom_shapes.d.ts +188 -252
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "test/**/*.js": "eslint",
19
19
  "utils/**/*.{js,mjs}": "eslint"
20
20
  },
21
- "version": "2.0.4",
21
+ "version": "2.0.5",
22
22
  "dependencies": {
23
23
  "@davepagurek/bezier-path": "^0.0.2",
24
24
  "@japont/unicode-range": "^1.0.0",
@@ -3380,7 +3380,7 @@ declare module 'p5' {
3380
3380
  * Draws a Bézier curve.Bézier curves can form shapes and curves that slope gently. They're defined
3381
3381
  * by two anchor points and two control points. Bézier curves provide more
3382
3382
  * control than the spline curves created with the
3383
- * curve() function.The first two parameters, `x1` and `y1`, set the first anchor point. The
3383
+ * spline() function.The first two parameters, `x1` and `y1`, set the first anchor point. The
3384
3384
  * first anchor point is where the curve starts.The next four parameters, `x2`, `y2`, `x3`, and `y3`, set the two control
3385
3385
  * points. The control points "pull" the curve towards them.The seventh and eighth parameters, `x4` and `y4`, set the last anchor
3386
3386
  * point. The last anchor point is where the curve ends.Bézier curves can also be drawn in 3D using WebGL mode. The 3D version of
@@ -3443,13 +3443,11 @@ declare module 'p5' {
3443
3443
 
3444
3444
  /**
3445
3445
  * Draws a curve using a Catmull-Rom spline.Spline curves can form shapes and curves that slope gently. They’re like
3446
- * cables that are attached to a set of points. Splines are defined by two
3447
- * anchor points and two control points.The first two parameters, `x1` and `y1`, set the first control point. This
3448
- * point isn’t drawn and can be thought of as the curve’s starting point.The next four parameters, `x2`, `y2`, `x3`, and `y3`, set the two anchor
3449
- * points. The anchor points are the start and end points of the curve’s
3450
- * visible segment.The seventh and eighth parameters, `x4` and `y4`, set the last control
3451
- * point. This point isn’t drawn and can be thought of as the curve’s ending
3452
- * point.Spline curves can also be drawn in 3D using WebGL mode. The 3D version of
3446
+ * cables that are attached to a set of points. By default (`ends: INCLUDE`),
3447
+ * the curve passes through all four points you provide, in order
3448
+ * `p0(x1,y1)` -> `p1(x2,y2)` -> `p2(x3,y3)` -> `p3(x4,y4)`. Think of them as
3449
+ * points on a curve. If you switch to `ends: EXCLUDE`, p0 and p3 act
3450
+ * 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
3453
3451
  * `spline()` has twelve arguments because each point has x-, y-, and
3454
3452
  * z-coordinates.
3455
3453
  *
@@ -3467,15 +3465,15 @@ declare module 'p5' {
3467
3465
  spline(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, x3: number, y3: number, z3: number, x4: number, y4: number, z4: number): void;
3468
3466
 
3469
3467
  /**
3470
- * Calculates coordinates along a spline curve using interpolation.`splinePoint()` calculates coordinates along a spline curve using the
3471
- * anchor and control points. It expects points in the same order as the
3468
+ * Calculates coordinates along a spline curve using interpolation.`splinePoint()` calculates coordinates along a spline curve using four
3469
+ * points p0, p1, p2, p3. It expects points in the same order as the
3472
3470
  * spline() function. `splinePoint()` works one axis
3473
- * at a time. Passing the anchor and control points' x-coordinates will
3474
- * calculate the x-coordinate of a point on the curve. Passing the anchor and
3475
- * control points' y-coordinates will calculate the y-coordinate of a point on
3476
- * 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
3477
- * 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
3478
- * is the first anchor point, 1 is the second anchor point, and 0.5 is halfway
3471
+ * at a time. Passing the points' x-coordinates will
3472
+ * calculate the x-coordinate of a point on the curve. Passing the
3473
+ * points' y-coordinates will calculate the y-coordinate of a point on
3474
+ * the curve.The first parameter, `a`, is the coordinate of point p0.The second and third parameters, `b` and `c`, are the coordinates of
3475
+ * points p1 and p2.The fourth parameter, `d`, is the coordinate of point p3.The fifth parameter, `t`, is the amount to interpolate along the span
3476
+ * from p1 to p2. `t = 0` is p1, `t = 1` is p2, and `t = 0.5` is halfway
3479
3477
  * between them.
3480
3478
  *
3481
3479
  * @param
@@ -3488,15 +3486,14 @@ declare module 'p5' {
3488
3486
 
3489
3487
  /**
3490
3488
  * Calculates coordinates along a line that's tangent to a spline curve.Tangent lines skim the surface of a curve. A tangent line's slope equals
3491
- * the curve's slope at the point where it intersects.`splineTangent()` calculates coordinates along a tangent line using the
3492
- * spline curve's anchor and control points. It expects points in the same
3493
- * order as the spline() function. `splineTangent()`
3494
- * works one axis at a time. Passing the anchor and control points'
3495
- * x-coordinates will calculate the x-coordinate of a point on the tangent
3496
- * line. Passing the anchor and control points' y-coordinates will calculate
3497
- * the y-coordinate of a point on the tangent line.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
3498
- * 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
3499
- * is the first anchor point, 1 is the second anchor point, and 0.5 is halfway
3489
+ * the curve's slope at the point where it intersects.`splineTangent()` calculates coordinates along a tangent line using four
3490
+ * points p0, p1, p2, p3. It expects points in the same order as the
3491
+ * spline() function. `splineTangent()` works one
3492
+ * axis at a time. Passing the points' x-coordinates returns the x-component of
3493
+ * the tangent vector; passing the points' y-coordinates returns the y-component.
3494
+ * The first parameter, `a`, is the coordinate of point p0.The second and third parameters, `b` and `c`, are the coordinates of
3495
+ * points p1 and p2.The fourth parameter, `d`, is the coordinate of point p3.The fifth parameter, `t`, is the amount to interpolate along the span
3496
+ * from p1 to p2. `t = 0` is p1, `t = 1` is p2, and `t = 0.5` is halfway
3500
3497
  * between them.
3501
3498
  *
3502
3499
  * @param
@@ -3531,49 +3528,44 @@ declare module 'p5' {
3531
3528
  bezierOrder(): number;
3532
3529
 
3533
3530
  /**
3534
- * Adds a spline curve segment to a custom shape.`splineVertex()` adds a curved segment to custom shapes. The spline curves
3535
- * it creates are defined like those made by the
3536
- * curve() function. `splineVertex()` must be called
3537
- * between the beginShape() and
3531
+ * Connects points with a smooth curve (a spline).`splineVertex()` adds a curved segment to custom shapes.
3532
+ * The curve it creates follows the same rules as the ones
3533
+ * made with the spline() function.
3534
+ * `splineVertex()` must be called between the
3535
+ * beginShape() and
3538
3536
  * endShape() functions.Spline curves can form shapes and curves that slope gently. They’re like
3539
- * cables that are attached to a set of points. Splines are defined by two
3540
- * anchor points and two control points. `splineVertex()` must be called at
3541
- * least four times between
3537
+ * cables that are attached to a set of points. `splineVertex()` draws a smooth
3538
+ * curve through the points you give it.
3542
3539
  * beginShape() and
3543
- * endShape() in order to draw a curve:`beginShape();
3540
+ * endShape() in order to draw a curve:If you provide three points, the spline will pass through them.
3541
+ * It works the same way with any number of points.`beginShape();
3544
3542
  *
3545
- * // Add the first control point.
3546
- * splineVertex(84, 91);
3543
+ * // Add the first point.
3544
+ * splineVertex(25, 80);
3547
3545
  *
3548
- * // Add the anchor points to draw between.
3549
- * splineVertex(68, 19);
3550
- * splineVertex(21, 17);
3546
+ * // Add the second point.
3547
+ * splineVertex(20, 30);
3551
3548
  *
3552
- * // Add the second control point.
3553
- * splineVertex(32, 91);
3549
+ * // Add the last point.
3550
+ * splineVertex(85, 60);
3554
3551
  *
3555
- * endShape();`The code snippet above would only draw the curve between the anchor points,
3556
- * similar to the curve() function. The segments
3557
- * between the control and anchor points can be drawn by calling
3558
- * `splineVertex()` with the coordinates of the control points:`beginShape();
3552
+ * endShape();`Passing in `CLOSE` to `endShape()` closes the spline smoothly.`beginShape();
3559
3553
  *
3560
- * // Add the first control point and draw a segment to it.
3561
- * splineVertex(84, 91);
3562
- * splineVertex(84, 91);
3554
+ * // Add the first point.
3555
+ * splineVertex(25, 80);
3563
3556
  *
3564
- * // Add the anchor points to draw between.
3565
- * splineVertex(68, 19);
3566
- * splineVertex(21, 17);
3557
+ * // Add the second point.
3558
+ * splineVertex(20, 30);
3567
3559
  *
3568
- * // Add the second control point.
3569
- * splineVertex(32, 91);
3560
+ * // Add the second point.
3561
+ * splineVertex(85, 60);
3570
3562
  *
3571
- * // Uncomment the next line to draw the segment to the second control point.
3572
- * // splineVertex(32, 91);
3573
- *
3574
- * endShape();`The first two parameters, `x` and `y`, set the vertex’s location. For
3575
- * example, calling `splineVertex(10, 10)` adds a point to the curve at
3576
- * `(10, 10)`.Spline curves can also be drawn in 3D using WebGL mode. The 3D version of
3563
+ * endShape(CLOSE);`By default (`ends: INCLUDE`), the curve passes through
3564
+ * all the points you add with `splineVertex()`, similar to
3565
+ * the spline() function. To draw only
3566
+ * the middle span p1->p2 (skipping p0->p1 and p2->p3), set
3567
+ * `splineProperty('ends', EXCLUDE)`. You don’t need to duplicate
3568
+ * vertices to draw those spans.Spline curves can also be drawn in 3D using WebGL mode. The 3D version of
3577
3569
  * `splineVertex()` has three arguments because each point has x-, y-, and
3578
3570
  * z-coordinates. By default, the vertex’s z-coordinate is set to 0.Note: `splineVertex()` won’t work when an argument is passed to
3579
3571
  * beginShape().
@@ -3590,19 +3582,43 @@ declare module 'p5' {
3590
3582
  splineVertex(x: number, y: number, z: number, u: number, v: number): void;
3591
3583
 
3592
3584
  /**
3593
- * Sets the property of a curve.For example, set tightness,
3594
- * use `splineProperty('tightness', t)`, with `t` between 0 and 1,
3595
- * at 0 as default.Spline curves are like cables that are attached to a set of points.
3596
- * Adjusting tightness adjusts how tightly the cable is
3597
- * attached to the points. The parameter, tightness, determines
3598
- * how the curve fits to the vertex points. By default,
3599
- * tightness is set to 0. Setting tightness to 1, as in
3600
- * `splineProperty('tightness', 1)`, connects the curve's points
3601
- * using straight lines. Values in the range from –5 to 5
3602
- * deform curves while leaving them recognizable.This function can also be used to set 'ends' property
3603
- * (see also: the curveDetail() example),
3604
- * such as: `splineProperty('ends', EXCLUDE)` to exclude
3605
- * vertices, or `splineProperty('ends', INCLUDE)` to include them.
3585
+ * Gets or sets a given spline property.Use `splineProperty()` to adjust the behavior of splines
3586
+ * created with `splineVertex()` or `spline()`. You can control
3587
+ * two key aspects of a spline: its end behavior (`ends`) and
3588
+ * its curvature (`tightness`).By default, the ends property is set to `INCLUDE`, which means
3589
+ * the spline passes through every point, including the endpoints.
3590
+ * You can also set it to `EXCLUDE` i.e. `splineProperty('ends', EXCLUDE)`,
3591
+ * which makes the spline pass through all points except the endpoints.`INCLUDE` case will have the spline passing through
3592
+ * all points, like this:`splineProperty('ends', INCLUDE); // no need to set this, as it is the default
3593
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);
3594
+ *
3595
+ * point(25, 46);
3596
+ * point(93, 44);
3597
+ * point(93, 81);
3598
+ * point(35, 85);`EXCLUDE case will have the spline passing through
3599
+ * the middle points, like this:`splineProperty('ends', INCLUDE);
3600
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);
3601
+ *
3602
+ * point(25, 46);
3603
+ * point(93, 44);
3604
+ * point(93, 81);
3605
+ * point(35, 85);`By default, the tightness property is set to `0`,
3606
+ * producing a smooth curve that passes evenly through
3607
+ * the vertices. Negative values make the curve looser,
3608
+ * while positive values make it tighter. Common values
3609
+ * range between -1 and 1, though values outside this
3610
+ * range can also be used for different effects.For example, To set tightness, use `splineProperty('tightness', t)`,
3611
+ * (default: t = 0).Here's the example showing negetive value of tightness,
3612
+ * which creates a rounder bulge:`splineProperty('tightness', -5)
3613
+ * stroke(0);
3614
+ * strokeWeight(2);
3615
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);`Here's the example showing positive value of tightness,
3616
+ * which makes the curve tighter and more angular:`splineProperty('tightness', 5)
3617
+ * stroke(0);
3618
+ * strokeWeight(2);
3619
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);`In all cases, the splines in p5.js are cardinal splines.
3620
+ * When tightness is 0, these splines are often known as
3621
+ * Catmull-Rom splines
3606
3622
  *
3607
3623
  * @param
3608
3624
  * @param
package/types/global.d.ts CHANGED
@@ -2830,7 +2830,7 @@ declare global {
2830
2830
  * Draws a Bézier curve.Bézier curves can form shapes and curves that slope gently. They're defined
2831
2831
  * by two anchor points and two control points. Bézier curves provide more
2832
2832
  * control than the spline curves created with the
2833
- * curve() function.The first two parameters, `x1` and `y1`, set the first anchor point. The
2833
+ * spline() function.The first two parameters, `x1` and `y1`, set the first anchor point. The
2834
2834
  * first anchor point is where the curve starts.The next four parameters, `x2`, `y2`, `x3`, and `y3`, set the two control
2835
2835
  * points. The control points "pull" the curve towards them.The seventh and eighth parameters, `x4` and `y4`, set the last anchor
2836
2836
  * point. The last anchor point is where the curve ends.Bézier curves can also be drawn in 3D using WebGL mode. The 3D version of
@@ -2872,13 +2872,11 @@ declare global {
2872
2872
 
2873
2873
  /**
2874
2874
  * Draws a curve using a Catmull-Rom spline.Spline curves can form shapes and curves that slope gently. They’re like
2875
- * cables that are attached to a set of points. Splines are defined by two
2876
- * anchor points and two control points.The first two parameters, `x1` and `y1`, set the first control point. This
2877
- * point isn’t drawn and can be thought of as the curve’s starting point.The next four parameters, `x2`, `y2`, `x3`, and `y3`, set the two anchor
2878
- * points. The anchor points are the start and end points of the curve’s
2879
- * visible segment.The seventh and eighth parameters, `x4` and `y4`, set the last control
2880
- * point. This point isn’t drawn and can be thought of as the curve’s ending
2881
- * point.Spline curves can also be drawn in 3D using WebGL mode. The 3D version of
2875
+ * cables that are attached to a set of points. By default (`ends: INCLUDE`),
2876
+ * the curve passes through all four points you provide, in order
2877
+ * `p0(x1,y1)` -> `p1(x2,y2)` -> `p2(x3,y3)` -> `p3(x4,y4)`. Think of them as
2878
+ * points on a curve. If you switch to `ends: EXCLUDE`, p0 and p3 act
2879
+ * 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
2882
2880
  * `spline()` has twelve arguments because each point has x-, y-, and
2883
2881
  * z-coordinates.
2884
2882
  */
@@ -2887,30 +2885,29 @@ declare global {
2887
2885
  function spline(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, x3: number, y3: number, z3: number, x4: number, y4: number, z4: number): void;
2888
2886
 
2889
2887
  /**
2890
- * Calculates coordinates along a spline curve using interpolation.`splinePoint()` calculates coordinates along a spline curve using the
2891
- * anchor and control points. It expects points in the same order as the
2888
+ * Calculates coordinates along a spline curve using interpolation.`splinePoint()` calculates coordinates along a spline curve using four
2889
+ * points p0, p1, p2, p3. It expects points in the same order as the
2892
2890
  * spline() function. `splinePoint()` works one axis
2893
- * at a time. Passing the anchor and control points' x-coordinates will
2894
- * calculate the x-coordinate of a point on the curve. Passing the anchor and
2895
- * control points' y-coordinates will calculate the y-coordinate of a point on
2896
- * 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
2897
- * 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
2898
- * is the first anchor point, 1 is the second anchor point, and 0.5 is halfway
2891
+ * at a time. Passing the points' x-coordinates will
2892
+ * calculate the x-coordinate of a point on the curve. Passing the
2893
+ * points' y-coordinates will calculate the y-coordinate of a point on
2894
+ * the curve.The first parameter, `a`, is the coordinate of point p0.The second and third parameters, `b` and `c`, are the coordinates of
2895
+ * points p1 and p2.The fourth parameter, `d`, is the coordinate of point p3.The fifth parameter, `t`, is the amount to interpolate along the span
2896
+ * from p1 to p2. `t = 0` is p1, `t = 1` is p2, and `t = 0.5` is halfway
2899
2897
  * between them.
2900
2898
  */
2901
2899
  function splinePoint(a: number, b: number, c: number, d: number, t: number): number;
2902
2900
 
2903
2901
  /**
2904
2902
  * Calculates coordinates along a line that's tangent to a spline curve.Tangent lines skim the surface of a curve. A tangent line's slope equals
2905
- * the curve's slope at the point where it intersects.`splineTangent()` calculates coordinates along a tangent line using the
2906
- * spline curve's anchor and control points. It expects points in the same
2907
- * order as the spline() function. `splineTangent()`
2908
- * works one axis at a time. Passing the anchor and control points'
2909
- * x-coordinates will calculate the x-coordinate of a point on the tangent
2910
- * line. Passing the anchor and control points' y-coordinates will calculate
2911
- * the y-coordinate of a point on the tangent line.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
2912
- * 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
2913
- * is the first anchor point, 1 is the second anchor point, and 0.5 is halfway
2903
+ * the curve's slope at the point where it intersects.`splineTangent()` calculates coordinates along a tangent line using four
2904
+ * points p0, p1, p2, p3. It expects points in the same order as the
2905
+ * spline() function. `splineTangent()` works one
2906
+ * axis at a time. Passing the points' x-coordinates returns the x-component of
2907
+ * the tangent vector; passing the points' y-coordinates returns the y-component.
2908
+ * The first parameter, `a`, is the coordinate of point p0.The second and third parameters, `b` and `c`, are the coordinates of
2909
+ * points p1 and p2.The fourth parameter, `d`, is the coordinate of point p3.The fifth parameter, `t`, is the amount to interpolate along the span
2910
+ * from p1 to p2. `t = 0` is p1, `t = 1` is p2, and `t = 0.5` is halfway
2914
2911
  * between them.
2915
2912
  */
2916
2913
  function splineTangent(a: number, b: number, c: number, d: number, t: number): number;
@@ -2937,49 +2934,44 @@ declare global {
2937
2934
  function bezierOrder(): number;
2938
2935
 
2939
2936
  /**
2940
- * Adds a spline curve segment to a custom shape.`splineVertex()` adds a curved segment to custom shapes. The spline curves
2941
- * it creates are defined like those made by the
2942
- * curve() function. `splineVertex()` must be called
2943
- * between the beginShape() and
2937
+ * Connects points with a smooth curve (a spline).`splineVertex()` adds a curved segment to custom shapes.
2938
+ * The curve it creates follows the same rules as the ones
2939
+ * made with the spline() function.
2940
+ * `splineVertex()` must be called between the
2941
+ * beginShape() and
2944
2942
  * endShape() functions.Spline curves can form shapes and curves that slope gently. They’re like
2945
- * cables that are attached to a set of points. Splines are defined by two
2946
- * anchor points and two control points. `splineVertex()` must be called at
2947
- * least four times between
2943
+ * cables that are attached to a set of points. `splineVertex()` draws a smooth
2944
+ * curve through the points you give it.
2948
2945
  * beginShape() and
2949
- * endShape() in order to draw a curve:`beginShape();
2946
+ * endShape() in order to draw a curve:If you provide three points, the spline will pass through them.
2947
+ * It works the same way with any number of points.`beginShape();
2950
2948
  *
2951
- * // Add the first control point.
2952
- * splineVertex(84, 91);
2949
+ * // Add the first point.
2950
+ * splineVertex(25, 80);
2953
2951
  *
2954
- * // Add the anchor points to draw between.
2955
- * splineVertex(68, 19);
2956
- * splineVertex(21, 17);
2952
+ * // Add the second point.
2953
+ * splineVertex(20, 30);
2957
2954
  *
2958
- * // Add the second control point.
2959
- * splineVertex(32, 91);
2955
+ * // Add the last point.
2956
+ * splineVertex(85, 60);
2960
2957
  *
2961
- * endShape();`The code snippet above would only draw the curve between the anchor points,
2962
- * similar to the curve() function. The segments
2963
- * between the control and anchor points can be drawn by calling
2964
- * `splineVertex()` with the coordinates of the control points:`beginShape();
2958
+ * endShape();`Passing in `CLOSE` to `endShape()` closes the spline smoothly.`beginShape();
2965
2959
  *
2966
- * // Add the first control point and draw a segment to it.
2967
- * splineVertex(84, 91);
2968
- * splineVertex(84, 91);
2960
+ * // Add the first point.
2961
+ * splineVertex(25, 80);
2969
2962
  *
2970
- * // Add the anchor points to draw between.
2971
- * splineVertex(68, 19);
2972
- * splineVertex(21, 17);
2963
+ * // Add the second point.
2964
+ * splineVertex(20, 30);
2973
2965
  *
2974
- * // Add the second control point.
2975
- * splineVertex(32, 91);
2966
+ * // Add the second point.
2967
+ * splineVertex(85, 60);
2976
2968
  *
2977
- * // Uncomment the next line to draw the segment to the second control point.
2978
- * // splineVertex(32, 91);
2979
- *
2980
- * endShape();`The first two parameters, `x` and `y`, set the vertex’s location. For
2981
- * example, calling `splineVertex(10, 10)` adds a point to the curve at
2982
- * `(10, 10)`.Spline curves can also be drawn in 3D using WebGL mode. The 3D version of
2969
+ * endShape(CLOSE);`By default (`ends: INCLUDE`), the curve passes through
2970
+ * all the points you add with `splineVertex()`, similar to
2971
+ * the spline() function. To draw only
2972
+ * the middle span p1->p2 (skipping p0->p1 and p2->p3), set
2973
+ * `splineProperty('ends', EXCLUDE)`. You don’t need to duplicate
2974
+ * vertices to draw those spans.Spline curves can also be drawn in 3D using WebGL mode. The 3D version of
2983
2975
  * `splineVertex()` has three arguments because each point has x-, y-, and
2984
2976
  * z-coordinates. By default, the vertex’s z-coordinate is set to 0.Note: `splineVertex()` won’t work when an argument is passed to
2985
2977
  * beginShape().
@@ -2993,19 +2985,43 @@ declare global {
2993
2985
  function splineVertex(x: number, y: number, z: number, u: number, v: number): void;
2994
2986
 
2995
2987
  /**
2996
- * Sets the property of a curve.For example, set tightness,
2997
- * use `splineProperty('tightness', t)`, with `t` between 0 and 1,
2998
- * at 0 as default.Spline curves are like cables that are attached to a set of points.
2999
- * Adjusting tightness adjusts how tightly the cable is
3000
- * attached to the points. The parameter, tightness, determines
3001
- * how the curve fits to the vertex points. By default,
3002
- * tightness is set to 0. Setting tightness to 1, as in
3003
- * `splineProperty('tightness', 1)`, connects the curve's points
3004
- * using straight lines. Values in the range from –5 to 5
3005
- * deform curves while leaving them recognizable.This function can also be used to set 'ends' property
3006
- * (see also: the curveDetail() example),
3007
- * such as: `splineProperty('ends', EXCLUDE)` to exclude
3008
- * vertices, or `splineProperty('ends', INCLUDE)` to include them.
2988
+ * Gets or sets a given spline property.Use `splineProperty()` to adjust the behavior of splines
2989
+ * created with `splineVertex()` or `spline()`. You can control
2990
+ * two key aspects of a spline: its end behavior (`ends`) and
2991
+ * its curvature (`tightness`).By default, the ends property is set to `INCLUDE`, which means
2992
+ * the spline passes through every point, including the endpoints.
2993
+ * You can also set it to `EXCLUDE` i.e. `splineProperty('ends', EXCLUDE)`,
2994
+ * which makes the spline pass through all points except the endpoints.`INCLUDE` case will have the spline passing through
2995
+ * all points, like this:`splineProperty('ends', INCLUDE); // no need to set this, as it is the default
2996
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);
2997
+ *
2998
+ * point(25, 46);
2999
+ * point(93, 44);
3000
+ * point(93, 81);
3001
+ * point(35, 85);`EXCLUDE case will have the spline passing through
3002
+ * the middle points, like this:`splineProperty('ends', INCLUDE);
3003
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);
3004
+ *
3005
+ * point(25, 46);
3006
+ * point(93, 44);
3007
+ * point(93, 81);
3008
+ * point(35, 85);`By default, the tightness property is set to `0`,
3009
+ * producing a smooth curve that passes evenly through
3010
+ * the vertices. Negative values make the curve looser,
3011
+ * while positive values make it tighter. Common values
3012
+ * range between -1 and 1, though values outside this
3013
+ * range can also be used for different effects.For example, To set tightness, use `splineProperty('tightness', t)`,
3014
+ * (default: t = 0).Here's the example showing negetive value of tightness,
3015
+ * which creates a rounder bulge:`splineProperty('tightness', -5)
3016
+ * stroke(0);
3017
+ * strokeWeight(2);
3018
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);`Here's the example showing positive value of tightness,
3019
+ * which makes the curve tighter and more angular:`splineProperty('tightness', 5)
3020
+ * stroke(0);
3021
+ * strokeWeight(2);
3022
+ * spline(25, 46, 93, 44, 93, 81, 35, 85);`In all cases, the splines in p5.js are cardinal splines.
3023
+ * When tightness is 0, these splines are often known as
3024
+ * Catmull-Rom splines
3009
3025
  */
3010
3026
  function splineProperty(property: string, value: any): void;
3011
3027