Skip to content

Commit 9099bac

Browse files
authored
adding an example sketch for splineProperty 'ends'
1 parent 34ddffe commit 9099bac

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

src/shape/custom_shapes.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,69 @@ function customShapes(p5, fn) {
21232123
* }
21242124
* </code>
21252125
* </div>
2126+
*
2127+
* @example
2128+
* <div>
2129+
* <code>
2130+
* function setup() {
2131+
* createCanvas(360, 140);
2132+
* background(240);
2133+
* noFill();
2134+
*
2135+
* // Right panel: ends = INCLUDE (all spans).
2136+
* push();
2137+
* translate(10, 10);
2138+
* stroke(220);
2139+
* rect(0, 0, 160, 120);
2140+
* fill(30);
2141+
* textSize(11);
2142+
* text('ends: INCLUDE (all spans)', 8, 16);
2143+
* noFill();
2144+
*
2145+
* splineProperty('ends', INCLUDE);
2146+
* stroke(0);
2147+
* strokeWeight(2);
2148+
* spline(25, 46, 93, 44, 93, 81, 35, 85);
2149+
*
2150+
* // vertices
2151+
* strokeWeight(5);
2152+
* stroke(0);
2153+
* point(25, 46);
2154+
* point(93, 44);
2155+
* point(93, 81);
2156+
* point(35, 85);
2157+
* pop();
2158+
*
2159+
* // Right panel: ends = EXCLUDE (middle only).
2160+
* push();
2161+
* translate(190, 10);
2162+
* stroke(220);
2163+
* rect(0, 0, 160, 120);
2164+
* noStroke();
2165+
* fill(30);
2166+
* text('ends: EXCLUDE ', 18, 16);
2167+
* noFill();
2168+
*
2169+
* splineProperty('ends', EXCLUDE);
2170+
* stroke(0);
2171+
* strokeWeight(2);
2172+
* spline(25, 46, 93, 44, 93, 81, 35, 85);
2173+
*
2174+
* // vertices
2175+
* strokeWeight(5);
2176+
* stroke(0);
2177+
* point(25, 46);
2178+
* point(93, 44);
2179+
* point(93, 81);
2180+
* point(35, 85);
2181+
* pop();
2182+
*
2183+
* describe('Left panel shows spline with ends INCLUDE (three spans). Right panel shows EXCLUDE (only the middle span). Four black points mark the vertices.');
2184+
* }
2185+
* </code>
2186+
* </div>
21262187
*/
2188+
21272189
/**
21282190
* @method splineProperty
21292191
* @param {String} property

0 commit comments

Comments
 (0)