Skip to content

Commit fa71a4a

Browse files
committed
fix: convert strands examples to @example format for proper rendering
Convert all 13 inline shader examples from markdown code fence (```js example) to JSDoc @example tags so they render correctly on the p5.js website.
1 parent 7c46fa4 commit fa71a4a

1 file changed

Lines changed: 13 additions & 26 deletions

File tree

src/math/calculation.js

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function calculation(p5, fn){
4040
* `abs()` can also be used in shaders with p5.strands. The following example
4141
* uses `abs()` to create a mirror effect on the color of a shape.
4242
*
43-
* ```js example
43+
* @example
4444
* let myShader;
4545
*
4646
* function setup() {
@@ -65,7 +65,6 @@ function calculation(p5, fn){
6565
* noStroke();
6666
* sphere(30);
6767
* }
68-
* ```
6968
*/
7069
fn.abs = Math.abs;
7170

@@ -109,7 +108,7 @@ function calculation(p5, fn){
109108
* `ceil()` can also be used in shaders with p5.strands. The following example
110109
* uses `ceil()` to create a stepped color effect on a shape.
111110
*
112-
* ```js example
111+
* @example
113112
* let myShader;
114113
*
115114
* function setup() {
@@ -133,7 +132,6 @@ function calculation(p5, fn){
133132
* noStroke();
134133
* sphere(30);
135134
* }
136-
* ```
137135
*/
138136
fn.ceil = Math.ceil;
139137

@@ -325,7 +323,7 @@ function calculation(p5, fn){
325323
* `exp()` can also be used in shaders with p5.strands. The following example
326324
* uses `exp()` to create an accelerating color transition on a shape.
327325
*
328-
* ```js example
326+
* @example
329327
* let myShader;
330328
*
331329
* function setup() {
@@ -350,7 +348,6 @@ function calculation(p5, fn){
350348
* noStroke();
351349
* sphere(30);
352350
* }
353-
* ```
354351
*/
355352
fn.exp = Math.exp;
356353

@@ -389,7 +386,7 @@ function calculation(p5, fn){
389386
* `floor()` can also be used in shaders with p5.strands. The following example
390387
* uses `floor()` to create banding effects on a shape.
391388
*
392-
* ```js example
389+
* @example
393390
* let myShader;
394391
*
395392
* function setup() {
@@ -413,7 +410,6 @@ function calculation(p5, fn){
413410
* noStroke();
414411
* sphere(30);
415412
* }
416-
* ```
417413
*/
418414
fn.floor = Math.floor;
419415

@@ -500,7 +496,7 @@ function calculation(p5, fn){
500496
* GLSL `mix()` function. The following example uses `lerp()` to blend colors
501497
* on a shape over time.
502498
*
503-
* ```js example
499+
* @example
504500
* let myShader;
505501
*
506502
* function setup() {
@@ -525,7 +521,6 @@ function calculation(p5, fn){
525521
* noStroke();
526522
* sphere(30);
527523
* }
528-
* ```
529524
*/
530525
fn.lerp = function(start, stop, amt) {
531526
// p5._validateParameters('lerp', arguments);
@@ -584,7 +579,7 @@ function calculation(p5, fn){
584579
* `log()` can also be used in shaders with p5.strands. The following example
585580
* uses `log()` to create a decelerating color transition on a shape.
586581
*
587-
* ```js example
582+
* @example
588583
* let myShader;
589584
*
590585
* function setup() {
@@ -610,7 +605,6 @@ function calculation(p5, fn){
610605
* noStroke();
611606
* sphere(30);
612607
* }
613-
* ```
614608
*/
615609
fn.log = Math.log;
616610

@@ -730,7 +724,7 @@ function calculation(p5, fn){
730724
* `map()` can also be used in shaders with p5.strands. The following example
731725
* uses `map()` to remap time values to color in a shader.
732726
*
733-
* ```js example
727+
* @example
734728
* let myShader;
735729
*
736730
* function setup() {
@@ -753,7 +747,6 @@ function calculation(p5, fn){
753747
* noStroke();
754748
* sphere(30);
755749
* }
756-
* ```
757750
*/
758751
fn.map = function(n, start1, stop1, start2, stop2, withinBounds) {
759752
// p5._validateParameters('map', arguments);
@@ -826,7 +819,7 @@ function calculation(p5, fn){
826819
* `max()` can also be used in shaders with p5.strands. The following example
827820
* uses `max()` to clamp values in a shader.
828821
*
829-
* ```js example
822+
* @example
830823
* let myShader;
831824
*
832825
* function setup() {
@@ -849,7 +842,6 @@ function calculation(p5, fn){
849842
* noStroke();
850843
* sphere(30);
851844
* }
852-
* ```
853845
*/
854846
/**
855847
* @method max
@@ -930,7 +922,7 @@ function calculation(p5, fn){
930922
* `min()` can also be used in shaders with p5.strands. The following example
931923
* uses `min()` to clamp values in a shader.
932924
*
933-
* ```js example
925+
* @example
934926
* let myShader;
935927
*
936928
* function setup() {
@@ -953,7 +945,6 @@ function calculation(p5, fn){
953945
* noStroke();
954946
* sphere(30);
955947
* }
956-
* ```
957948
*/
958949
/**
959950
* @method min
@@ -1058,7 +1049,7 @@ function calculation(p5, fn){
10581049
* `pow()` can also be used in shaders with p5.strands. The following example
10591050
* uses `pow()` to create a gamma curve effect on colors in a shader.
10601051
*
1061-
* ```js example
1052+
* @example
10621053
* let myShader;
10631054
*
10641055
* function setup() {
@@ -1083,7 +1074,6 @@ function calculation(p5, fn){
10831074
* noStroke();
10841075
* sphere(30);
10851076
* }
1086-
* ```
10871077
*/
10881078
fn.pow = Math.pow;
10891079

@@ -1142,7 +1132,7 @@ function calculation(p5, fn){
11421132
* `round()` can also be used in shaders with p5.strands. The following example
11431133
* uses `round()` to quantize colors in a shader.
11441134
*
1145-
* ```js example
1135+
* @example
11461136
* let myShader;
11471137
*
11481138
* function setup() {
@@ -1165,7 +1155,6 @@ function calculation(p5, fn){
11651155
* noStroke();
11661156
* sphere(30);
11671157
* }
1168-
* ```
11691158
*/
11701159
fn.round = function(n, decimals) {
11711160
if (!decimals) {
@@ -1282,7 +1271,7 @@ function calculation(p5, fn){
12821271
* `sqrt()` can also be used in shaders with p5.strands. The following example
12831272
* uses `sqrt()` to create a smooth easing curve on colors in a shader.
12841273
*
1285-
* ```js example
1274+
* @example
12861275
* let myShader;
12871276
*
12881277
* function setup() {
@@ -1307,7 +1296,6 @@ function calculation(p5, fn){
13071296
* noStroke();
13081297
* sphere(30);
13091298
* }
1310-
* ```
13111299
*/
13121300
fn.sqrt = Math.sqrt;
13131301

@@ -1345,7 +1333,7 @@ function calculation(p5, fn){
13451333
* `fract()` can also be used in shaders with p5.strands. The following example
13461334
* uses `fract()` to create repeating patterns in a shader.
13471335
*
1348-
* ```js example
1336+
* @example
13491337
* let myShader;
13501338
*
13511339
* function setup() {
@@ -1368,7 +1356,6 @@ function calculation(p5, fn){
13681356
* noStroke();
13691357
* sphere(30);
13701358
* }
1371-
* ```
13721359
*/
13731360
fn.fract = function(toConvert) {
13741361
// p5._validateParameters('fract', arguments);

0 commit comments

Comments
 (0)