@@ -2286,18 +2286,114 @@ function customShapes(p5, fn) {
22862286 } ;
22872287
22882288 /**
2289- * Get or set multiple spline properties at once.
2290- *
2291- * Similar to <a href="#/p5/splineProperty">splineProperty()</a>:
2292- * `splineProperty('tightness', t)` is the same as
2293- * `splineProperties({'tightness': t})`
2289+ * Sets multiple properties for spline curves at once.
2290+ *
2291+ * `splineProperties()` accepts an object with key-value pairs to configure
2292+ * how spline curves are drawn. This is a convenient way to set multiple
2293+ * spline properties with a single function call, rather than calling
2294+ * <a href="#/p5/splineProperty">splineProperty()</a> multiple times.
2295+ *
2296+ * The properties object can include:
2297+ * - `tightness`: A number that controls how tightly the curve fits to the
2298+ * vertex points. The default value is 0. Positive values make the curve
2299+ * tighter (straighter), while negative values make it looser. Values
2300+ * between -5 and 5 work best.
2301+ * - `ends`: Controls whether to draw the end segments of the spline. Set to
2302+ * `EXCLUDE` to skip drawing the segments between the first and second
2303+ * points and between the second-to-last and last points. This is useful
2304+ * when you want to use the first and last points as control points only.
2305+ *
2306+ * `splineProperties()` affects curves drawn with
2307+ * <a href="#/p5/splineVertex">splineVertex()</a> within
2308+ * <a href="#/p5/beginShape">beginShape()</a> and
2309+ * <a href="#/p5/endShape">endShape()</a>, as well as curves drawn with
2310+ * <a href="#/p5/spline">spline()</a>. The properties remain active until
2311+ * changed by another call to `splineProperties()` or
2312+ * <a href="#/p5/splineProperty">splineProperty()</a>.
22942313 *
22952314 * @method splineProperties
2296- * @param {Object } properties An object containing key-value pairs to set.
2297- */
2298- /**
2315+ * @param {Object } values an object containing spline property key-value pairs
2316+ * @chainable
2317+ *
2318+ * @example
2319+ * <div>
2320+ * <code>
2321+ * function setup() {
2322+ * createCanvas(100, 100);
2323+ * background(220);
2324+ *
2325+ * // Set spline tightness using splineProperties
2326+ * splineProperties({
2327+ * tightness: 0.5
2328+ * });
2329+ *
2330+ * // Draw a spline curve
2331+ * noFill();
2332+ * stroke(0);
2333+ * strokeWeight(2);
2334+ *
2335+ * beginShape();
2336+ * splineVertex(20, 80);
2337+ * splineVertex(30, 30);
2338+ * splineVertex(70, 30);
2339+ * splineVertex(80, 80);
2340+ * endShape();
2341+ *
2342+ * // Show vertex points
2343+ * fill(255, 0, 0);
2344+ * noStroke();
2345+ * circle(20, 80, 6);
2346+ * circle(30, 30, 6);
2347+ * circle(70, 30, 6);
2348+ * circle(80, 80, 6);
2349+ *
2350+ * describe('A smooth curved line with tightness 0.5 connecting four red points.');
2351+ * }
2352+ * </code>
2353+ * </div>
2354+ *
2355+ * @example
2356+ * <div>
2357+ * <code>
2358+ * function setup() {
2359+ * createCanvas(100, 100);
2360+ * background(220);
2361+ *
2362+ * // Exclude end segments - first and last points become control points
2363+ * splineProperties({
2364+ * tightness: 0,
2365+ * ends: EXCLUDE
2366+ * });
2367+ *
2368+ * // Draw curve only between middle points
2369+ * noFill();
2370+ * stroke(0);
2371+ * strokeWeight(2);
2372+ *
2373+ * beginShape();
2374+ * splineVertex(10, 50); // Control point (affects curve but not drawn to)
2375+ * splineVertex(30, 20); // Start of visible curve
2376+ * splineVertex(70, 80); // End of visible curve
2377+ * splineVertex(90, 50); // Control point (affects curve but not drawn to)
2378+ * endShape();
2379+ *
2380+ * // Show all points
2381+ * fill(200, 0, 0);
2382+ * noStroke();
2383+ * circle(10, 50, 6); // Control point
2384+ * circle(90, 50, 6); // Control point
2385+ *
2386+ * fill(0, 0, 255);
2387+ * circle(30, 20, 6); // Visible curve point
2388+ * circle(70, 80, 6); // Visible curve point
2389+ *
2390+ * describe('A curved line between two blue points, with red control points at the ends.');
2391+ * }
2392+ * </code>
2393+ * </div>
2394+ *
22992395 * @method splineProperties
2300- * @returns {Object } The current spline properties.
2396+ * @return {Object }
23012397 */
23022398 fn . splineProperties = function ( values ) {
23032399 return this . _renderer . splineProperties ( values ) ;
0 commit comments