@@ -410,20 +410,17 @@ function vertex(p5, fn){
410
410
* <a href="#/p5/bezier">bezier()</a> function. `bezierVertex()` must be
411
411
* called between the
412
412
* <a href="#/p5/beginShape">beginShape()</a> and
413
- * <a href="#/p5/endShape">endShape()</a> functions. The curved segment uses
414
- * the previous vertex as the first anchor point, so there must be at least
415
- * one call to <a href="#/p5/vertex">vertex()</a> before `bezierVertex()` can
416
- * be used.
417
- *
418
- * The first four parameters, `x2`, `y2`, `x3`, and `y3`, set the curve’s two
419
- * control points. The control points "pull" the curve towards them.
420
- *
421
- * The fifth and sixth parameters, `x4`, and `y4`, set the last anchor point.
422
- * The last anchor point is where the curve ends.
423
- *
424
- * Bézier curves can also be drawn in 3D using WebGL mode. The 3D version of
425
- * `bezierVertex()` has eight arguments because each point has x-, y-, and
426
- * z-coordinates.
413
+ * <a href="#/p5/endShape">endShape()</a> functions. There must be at least
414
+ * one call to <a href="#/p5/vertex">bezierVertex()</a>, before
415
+ * a number of `bezierVertex()` calls that is a multiple of the parameter
416
+ * set by <a href="#/p5/bezierOrder">bezierOrder(...)</a> (default 3).
417
+ *
418
+ * Each curve of order 3 requires three calls to `bezierVertext`, so
419
+ * 2 curves would need 7 calls to `bezierVertex()`:
420
+ * (1 one initial anchor point, two sets of 3 curves describing the curves)
421
+ * With `bezierOrder(2)`, two curves would need 5 calls: 1 + 2 + 2.
422
+ *
423
+ * Bézier curves can also be drawn in 3D using WebGL mode.
427
424
*
428
425
* Note: `bezierVertex()` won’t work when an argument is passed to
429
426
* <a href="#/p5/beginShape">beginShape()</a>.
@@ -449,10 +446,12 @@ function vertex(p5, fn){
449
446
* beginShape();
450
447
*
451
448
* // Add the first anchor point.
452
- * vertex (30, 20);
449
+ * bezierVertex (30, 20);
453
450
*
454
451
* // Add the Bézier vertex.
455
- * bezierVertex(80, 0, 80, 75, 30, 75);
452
+ * bezierVertex(80, 0);
453
+ * bezierVertex(80, 75);
454
+ * bezierVertex(30, 75);
456
455
*
457
456
* // Stop drawing the shape.
458
457
* endShape();
@@ -489,10 +488,12 @@ function vertex(p5, fn){
489
488
* beginShape();
490
489
*
491
490
* // Add the first anchor point.
492
- * vertex (30, 20);
491
+ * bezierVertex (30, 20);
493
492
*
494
493
* // Add the Bézier vertex.
495
- * bezierVertex(80, 0, 80, 75, 30, 75);
494
+ * bezierVertex(80, 0);
495
+ * bezierVertex(80, 75);
496
+ * bezierVertex(30, 75);
496
497
*
497
498
* // Stop drawing the shape.
498
499
* endShape();
@@ -549,10 +550,12 @@ function vertex(p5, fn){
549
550
* beginShape();
550
551
*
551
552
* // Add the first anchor point.
552
- * vertex (30, 20);
553
+ * bezierVertex (30, 20);
553
554
*
554
555
* // Add the Bézier vertex.
555
- * bezierVertex(x2, y2, 80, 75, 30, 75);
556
+ * bezierVertex(x2, y2);
557
+ * bezierVertex(80, 75);
558
+ * bezierVertex(30, 75);
556
559
*
557
560
* // Stop drawing the shape.
558
561
* endShape();
@@ -596,11 +599,16 @@ function vertex(p5, fn){
596
599
* beginShape();
597
600
*
598
601
* // Add the first anchor point.
599
- * vertex (30, 20);
602
+ * bezierVertex (30, 20);
600
603
*
601
604
* // Add the Bézier vertices.
602
- * bezierVertex(80, 0, 80, 75, 30, 75);
603
- * bezierVertex(50, 80, 60, 25, 30, 20);
605
+ * bezierVertex(80, 0);
606
+ * bezierVertex(80, 75);
607
+ * bezierVertex(30, 75);
608
+ *
609
+ * bezierVertex(50, 80);
610
+ * bezierVertex(60, 25);
611
+ * bezierVertex(30, 20);
604
612
*
605
613
* // Stop drawing the shape.
606
614
* endShape();
@@ -632,16 +640,30 @@ function vertex(p5, fn){
632
640
*
633
641
* // Draw the first moon.
634
642
* beginShape();
635
- * vertex(-20, -30, 0);
636
- * bezierVertex(30, -50, 0, 30, 25, 0, -20, 25, 0);
637
- * bezierVertex(0, 30, 0, 10, -25, 0, -20, -30, 0);
643
+ * bezierVertex(-20, -30, 0);
644
+ *
645
+ * bezierVertex(30, -50, 0);
646
+ * bezierVertex(30, 25, 0);
647
+ * bezierVertex(-20, 25, 0);
648
+ *
649
+ * bezierVertex(0, 30, 0);
650
+ * bezierVertex(10, -25, 0);
651
+ * bezierVertex(-20, -30, 0);
638
652
* endShape();
639
653
*
640
654
* // Draw the second moon.
641
655
* beginShape();
642
- * vertex(-20, -30, -20);
643
- * bezierVertex(30, -50, -20, 30, 25, -20, -20, 25, -20);
644
- * bezierVertex(0, 30, -20, 10, -25, -20, -20, -30, -20);
656
+ *
657
+ * bezierVertex(-20, -30, -20);
658
+ *
659
+ * bezierVertex(30, -50, -20);
660
+ * bezierVertex(30, 25, -20);
661
+ * bezierVertex(-20, 25, -20);
662
+ *
663
+ * bezierVertex(0, 30, -20);
664
+ * bezierVertex(10, -25, -20);
665
+ * bezierVertex(-20, -30, -20);
666
+ *
645
667
* endShape();
646
668
* }
647
669
* </code>
@@ -1068,9 +1090,7 @@ function vertex(p5, fn){
1068
1090
* <a href="https://p5js.org/tutorials/intro-to-shaders/" target="_blank">writing a custom shader</a>.
1069
1091
*
1070
1092
* After calling <a href="#/p5/beginShape">beginShape()</a>, shapes can be
1071
- * built by calling <a href="#/p5/vertex">vertex()</a>,
1072
- * <a href="#/p5/bezierVertex">bezierVertex()</a>,
1073
- * <a href="#/p5/quadraticVertex">quadraticVertex()</a>, and/or
1093
+ * <a href="#/p5/bezierVertex">bezierVertex()</a> and/or
1074
1094
* <a href="#/p5/splineVertex">splineVertex()</a>. Calling
1075
1095
* `endShape()` will stop adding vertices to the
1076
1096
* shape. Each shape will be outlined with the current stroke color and filled
0 commit comments