Skip to content

Commit 66cf9ef

Browse files
committed
Smooth spline end example added
1 parent 49baf54 commit 66cf9ef

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/shape/custom_shapes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@ function customShapes(p5, fn) {
24372437
*
24382438
* By default,
24392439
* the controur has an `OPEN` end, and to close it,
2440-
* call `endContour(CLOSE)`.
2440+
* call `endContour(CLOSE)`. The CLOSE contour mode closes splines smoothly.
24412441
*
24422442
* Transformations such as <a href="#/p5/translate">translate()</a>,
24432443
* <a href="#/p5/rotate">rotate()</a>, and <a href="#/p5/scale">scale()</a>

src/shape/vertex.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,8 @@ function vertex(p5, fn){
688688
};
689689

690690
/**
691-
* Begins adding vertices to a custom shape.
692-
*
691+
* Concludes the vertices of a custom shape.
692+
*
693693
* The <a href="#/p5/beginShape">beginShape()</a> and `endShape()` functions
694694
* allow for creating custom shapes in 2D or 3D.
695695
* <a href="#/p5/beginShape">beginShape()</a> begins adding vertices to a
@@ -698,7 +698,9 @@ function vertex(p5, fn){
698698
* The first parameter, `mode`, is optional. By default, the first and last
699699
* vertices of a shape aren't connected. If the constant `CLOSE` is passed, as
700700
* in `endShape(CLOSE)`, then the first and last vertices will be connected.
701+
* When CLOSE mode is used for splines (with `splineVeertex()`), the shape is ended smoothly.
701702
*
703+
*
702704
* The second parameter, `count`, is also optional. In WebGL mode, it’s more
703705
* efficient to draw many copies of the same shape using a technique called
704706
* <a href="https://webglfundamentals.org/webgl/lessons/webgl-instanced-drawing.html" target="_blank">instancing</a>.
@@ -759,6 +761,28 @@ function vertex(p5, fn){
759761
* }
760762
* </code>
761763
* </div>
764+
*
765+
* <div>
766+
* <code>
767+
* function setup() {
768+
* createCanvas(100, 100);
769+
* background(200);
770+
*
771+
* beginShape();
772+
*
773+
* splineVertex(32, 91);
774+
* splineVertex(21, 17);
775+
* splineVertex(68, 19);
776+
* splineVertex(82, 91);
777+
*
778+
* endShape(CLOSE);
779+
*
780+
* describe(
781+
* 'A curvy four-sided slightly lopsided blob.'
782+
* );
783+
* }
784+
* </div>
785+
* </code>
762786
*
763787
* <div>
764788
* <code>

0 commit comments

Comments
 (0)