@@ -528,81 +528,80 @@ function primitives3D(p5, fn){
528
528
*
529
529
* - `SIMPLE`: Optimizes for speed by disabling caps, joins, and stroke color features.
530
530
* Use this mode for faster line rendering when these visual details are unnecessary.
531
- * - `FULLY `: Enables caps, joins, and stroke color for lines.
531
+ * - `FULL `: Enables caps, joins, and stroke color for lines.
532
532
* This mode provides enhanced visuals but may reduce performance due to additional processing.
533
533
*
534
534
* Choose the mode that best suits your application's needs to either improve rendering speed or enhance visual quality.
535
535
*
536
536
* @method strokeMode
537
537
* @param {string } mode - The stroke mode to set. Possible values are:
538
538
* - `'SIMPLE'`: Fast rendering without caps, joins, or stroke color.
539
- * - `'FULLY '`: Detailed rendering with caps, joins, and stroke color.
539
+ * - `'FULL '`: Detailed rendering with caps, joins, and stroke color.
540
540
*
541
541
* @example
542
542
* <div>
543
543
* <code>
544
544
* function setup() {
545
- * createCanvas(100, 100, WEBGL);
546
- * strokeWeight(10);
547
- * stroke(0);
545
+ * createCanvas(300, 300, WEBGL);
548
546
*
549
- * describe('A red, horizontal, rectangular shape with rounded edges (resembling a pill or capsule) in a grey background');
547
+ * describe('A sphere with red stroke and a red, wavy line on a gray background. ');
550
548
* }
551
549
*
552
550
* function draw() {
553
- * strokeMode(FULLY); // Enables detailed rendering with caps, joins, and stroke color.
554
- * stroke('red');
555
- *
556
551
* background(128);
557
- *
558
- * let centerX = 0 ;
559
- * let centerY = 0 ;
560
- *
561
- * // Length of the small centered line
562
- * let lineLength = 50 ;
552
+ * strokeMode(FULL); // Enables detailed rendering with caps, joins, and stroke color.
553
+ * push() ;
554
+ * strokeWeight(1) ;
555
+ * translate(0, -50, 0);
556
+ * sphere(50);
557
+ * pop() ;
563
558
*
564
- * beginShape(LINES);
565
- * vertex(centerX - lineLength / 2, centerY, 0);
566
- * vertex(centerX + lineLength / 2, centerY, 0);
559
+ * noFill();
560
+ * strokeWeight(15);
561
+ * beginShape();
562
+ * vertex(-150, 100);
563
+ * stroke('red');
564
+ * bezierVertex(-50, -100, 30, 300, 130, 50);
567
565
* endShape();
568
566
* }
569
567
* </code>
570
568
* </div>
571
569
*
572
570
* <div>
573
571
* <code>
574
- * function setup() {
575
- * createCanvas(100, 100, WEBGL);
576
- * strokeWeight(10);
577
- * stroke(0);
572
+ * function setup() {
573
+ * createCanvas(300, 300, WEBGL);
578
574
*
579
- * describe('A black, horizontal, rectangular shape without rounded edges in a grey background');
575
+ * describe('A sphere with red stroke and a wavy line without full curve decorations without caps and color on a gray background. ');
580
576
* }
581
577
*
582
578
* function draw() {
583
- * strokeMode(SIMPLE); // Enables detailed rendering with caps, joins, and stroke color.
584
- * stroke(`red`);
585
579
* background(128);
586
- *
587
- * let centerX = 0 ;
588
- * let centerY = 0 ;
589
- *
590
- * // Length of the small centered line
591
- * let lineLength = 50 ;
580
+ * strokeMode(SIMPLE); // Enables simple rendering without caps, joins, and stroke color.
581
+ * push() ;
582
+ * strokeWeight(1) ;
583
+ * translate(0, -50, 0);
584
+ * sphere(50);
585
+ * pop() ;
592
586
*
593
- * beginShape(LINES);
594
- * vertex(centerX - lineLength / 2, centerY, 0);
595
- * vertex(centerX + lineLength / 2, centerY, 0);
587
+ * noFill();
588
+ * strokeWeight(15);
589
+ * beginShape();
590
+ * vertex(-150, 100);
591
+ * stroke('red');
592
+ * bezierVertex(-50, -100, 30, 300, 130, 50);
596
593
* endShape();
597
594
* }
598
595
* </code>
599
596
* </div>
600
597
*/
601
598
602
- fn . strokeMode = function ( mode ) {
603
- if ( mode === constants . SIMPLE ) {
604
- this . _renderer . _simpleLines = true ;
605
- } else if ( mode === constants . FULLY ) {
599
+ fn . strokeMode = function ( mode ) {
600
+ if ( mode === undefined ) {
601
+ return this . _renderer . _simpleLines ? constants . SIMPLE : constants . FULL ;
602
+ } else if ( mode === constants . SIMPLE ) {
603
+ this . _renderer . _simpleLines = true ;
604
+ } else if ( mode === constants . FULL ) {
606
605
this . _renderer . _simpleLines = false ;
607
606
} else {
608
607
throw Error ( 'no such parameter' ) ;
0 commit comments