p5 2.2.1-rc.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/accessibility/color_namer.js +5 -6
  2. package/dist/accessibility/describe.js +4 -26
  3. package/dist/accessibility/index.js +5 -6
  4. package/dist/accessibility/outputs.js +6 -38
  5. package/dist/app.js +5 -6
  6. package/dist/color/color_conversion.js +5 -6
  7. package/dist/color/creating_reading.js +1 -1
  8. package/dist/color/index.js +2 -2
  9. package/dist/color/p5.Color.js +1 -1
  10. package/dist/color/setting.js +59 -357
  11. package/dist/{constants-DEJVKr9Z.js → constants-DQyACdzq.js} +11 -61
  12. package/dist/core/constants.js +1 -1
  13. package/dist/core/environment.js +26 -158
  14. package/dist/core/filterShaders.js +1 -1
  15. package/dist/core/friendly_errors/fes_core.js +1 -1
  16. package/dist/core/friendly_errors/file_errors.js +1 -1
  17. package/dist/core/friendly_errors/index.js +1 -1
  18. package/dist/core/friendly_errors/param_validator.js +1 -1
  19. package/dist/core/friendly_errors/sketch_verifier.js +1 -1
  20. package/dist/core/helpers.js +1 -1
  21. package/dist/core/init.js +5 -6
  22. package/dist/core/internationalization.js +1 -1
  23. package/dist/core/legacy.js +5 -6
  24. package/dist/core/main.js +5 -6
  25. package/dist/core/p5.Graphics.js +4 -5
  26. package/dist/core/p5.Renderer.js +3 -4
  27. package/dist/core/p5.Renderer2D.js +5 -6
  28. package/dist/core/p5.Renderer3D.js +4 -5
  29. package/dist/core/rendering.js +4 -5
  30. package/dist/core/structure.js +13 -52
  31. package/dist/core/transform.js +32 -176
  32. package/dist/{creating_reading-CgHCHxqN.js → creating_reading-ZXzcZEsb.js} +3 -196
  33. package/dist/data/local_storage.js +4 -30
  34. package/dist/dom/dom.js +24 -159
  35. package/dist/dom/index.js +2 -2
  36. package/dist/dom/p5.Element.js +31 -208
  37. package/dist/dom/p5.File.js +1 -32
  38. package/dist/dom/p5.MediaElement.js +10 -113
  39. package/dist/events/acceleration.js +11 -64
  40. package/dist/events/keyboard.js +13 -81
  41. package/dist/events/pointer.js +18 -160
  42. package/dist/image/const.js +1 -1
  43. package/dist/image/filterRenderer2D.js +4 -5
  44. package/dist/image/image.js +4 -5
  45. package/dist/image/index.js +4 -5
  46. package/dist/image/loading_displaying.js +4 -5
  47. package/dist/image/p5.Image.js +3 -4
  48. package/dist/image/pixels.js +17 -100
  49. package/dist/io/files.js +4 -5
  50. package/dist/io/index.js +4 -5
  51. package/dist/io/p5.Table.js +66 -158
  52. package/dist/io/p5.TableRow.js +48 -71
  53. package/dist/io/p5.XML.js +6 -99
  54. package/dist/io/utilities.js +8 -3
  55. package/dist/{main-_RXV5Lx8.js → main-DvN69W3f.js} +13 -42
  56. package/dist/math/Matrices/Matrix.js +87 -126
  57. package/dist/math/Matrices/MatrixNumjs.js +1 -5
  58. package/dist/math/calculation.js +10 -112
  59. package/dist/math/index.js +1 -1
  60. package/dist/math/math.js +2 -12
  61. package/dist/math/noise.js +5 -32
  62. package/dist/math/p5.Matrix.js +3 -3
  63. package/dist/math/p5.Vector.js +104 -345
  64. package/dist/math/random.js +5 -32
  65. package/dist/math/trigonometry.js +15 -105
  66. package/dist/{p5.Renderer-QoFcvj3f.js → p5.Renderer-D-5LdCRz.js} +25 -178
  67. package/dist/{rendering-CsICjEXA.js → rendering-h9unX5K0.js} +254 -1156
  68. package/dist/shape/2d_primitives.js +33 -194
  69. package/dist/shape/attributes.js +12 -73
  70. package/dist/shape/curves.js +30 -95
  71. package/dist/shape/custom_shapes.js +63 -144
  72. package/dist/shape/index.js +2 -2
  73. package/dist/shape/vertex.js +21 -106
  74. package/dist/strands/p5.strands.js +248 -46
  75. package/dist/type/index.js +3 -4
  76. package/dist/type/p5.Font.js +4 -49
  77. package/dist/type/textCore.js +5 -158
  78. package/dist/utilities/conversion.js +17 -104
  79. package/dist/utilities/time_date.js +3 -40
  80. package/dist/utilities/utility_functions.js +6 -48
  81. package/dist/webgl/3d_primitives.js +4 -5
  82. package/dist/webgl/GeometryBuilder.js +1 -2
  83. package/dist/webgl/ShapeBuilder.js +22 -2
  84. package/dist/webgl/enums.js +1 -1
  85. package/dist/webgl/index.js +4 -5
  86. package/dist/webgl/interaction.js +6 -33
  87. package/dist/webgl/light.js +4 -5
  88. package/dist/webgl/loading.js +12 -46
  89. package/dist/webgl/material.js +4 -5
  90. package/dist/webgl/p5.Camera.js +4 -5
  91. package/dist/webgl/p5.DataArray.js +0 -4
  92. package/dist/webgl/p5.Framebuffer.js +4 -5
  93. package/dist/webgl/p5.Geometry.js +12 -106
  94. package/dist/webgl/p5.Quat.js +1 -1
  95. package/dist/webgl/p5.RendererGL.js +7 -18
  96. package/dist/webgl/p5.Shader.js +12 -36
  97. package/dist/webgl/p5.Texture.js +4 -5
  98. package/dist/webgl/text.js +4 -5
  99. package/dist/webgl/utils.js +4 -5
  100. package/dist/webgpu/index.js +1 -1
  101. package/dist/webgpu/p5.RendererWebGPU.js +529 -208
  102. package/dist/webgpu/shaders/color.js +32 -17
  103. package/dist/webgpu/shaders/filters/base.js +18 -7
  104. package/dist/webgpu/shaders/font.js +52 -40
  105. package/dist/webgpu/shaders/line.js +50 -36
  106. package/dist/webgpu/shaders/material.js +90 -83
  107. package/dist/webgpu/strands_wgslBackend.js +5 -2
  108. package/lib/p5.esm.js +5576 -7811
  109. package/lib/p5.esm.min.js +1 -1
  110. package/lib/p5.js +5576 -7811
  111. package/lib/p5.min.js +1 -1
  112. package/lib/p5.webgpu.esm.js +786 -453
  113. package/lib/p5.webgpu.js +786 -453
  114. package/lib/p5.webgpu.min.js +1 -1
  115. package/package.json +13 -13
  116. package/types/global.d.ts +16905 -16783
  117. package/types/p5.d.ts +11142 -11081
@@ -47,8 +47,6 @@ function random(p5, fn){
47
47
  * @param {Number} seed seed value.
48
48
  *
49
49
  * @example
50
- * <div>
51
- * <code>
52
50
  * function setup() {
53
51
  * createCanvas(100, 100);
54
52
  *
@@ -74,8 +72,6 @@ function random(p5, fn){
74
72
  *
75
73
  * describe('A white circle appears at a random position. A black circle appears at (27.4, 25.8).');
76
74
  * }
77
- * </code>
78
- * </div>
79
75
  */
80
76
  fn.randomSeed = function(seed) {
81
77
  this._lcgSetSeed(randomStateProp, seed);
@@ -116,8 +112,6 @@ function random(p5, fn){
116
112
  * @return {Number} random number.
117
113
  *
118
114
  * @example
119
- * <div>
120
- * <code>
121
115
  * function setup() {
122
116
  * createCanvas(100, 100);
123
117
  *
@@ -133,11 +127,8 @@ function random(p5, fn){
133
127
  *
134
128
  * describe('A black dot appears in a random position on a gray square.');
135
129
  * }
136
- * </code>
137
- * </div>
138
130
  *
139
- * <div>
140
- * <code>
131
+ * @example
141
132
  * function setup() {
142
133
  * createCanvas(100, 100);
143
134
  *
@@ -153,11 +144,8 @@ function random(p5, fn){
153
144
  *
154
145
  * describe('A black dot appears in a random position on a gray square.');
155
146
  * }
156
- * </code>
157
- * </div>
158
147
  *
159
- * <div>
160
- * <code>
148
+ * @example
161
149
  * function setup() {
162
150
  * createCanvas(100, 100);
163
151
  *
@@ -178,11 +166,8 @@ function random(p5, fn){
178
166
  *
179
167
  * describe('An animal face is displayed at random. Either a lion, tiger, or bear.');
180
168
  * }
181
- * </code>
182
- * </div>
183
169
  *
184
- * <div>
185
- * <code>
170
+ * @example
186
171
  * function setup() {
187
172
  * createCanvas(100, 100);
188
173
  *
@@ -203,11 +188,8 @@ function random(p5, fn){
203
188
  * strokeWeight(5);
204
189
  * point(x, y);
205
190
  * }
206
- * </code>
207
- * </div>
208
191
  *
209
- * <div>
210
- * <code>
192
+ * @example
211
193
  * function setup() {
212
194
  * createCanvas(100, 100);
213
195
  *
@@ -228,11 +210,8 @@ function random(p5, fn){
228
210
  * strokeWeight(5);
229
211
  * point(x, y);
230
212
  * }
231
- * </code>
232
- * </div>
233
213
  *
234
- * <div>
235
- * <code>
214
+ * @example
236
215
  * let x = 50;
237
216
  * let y = 50;
238
217
  *
@@ -252,8 +231,6 @@ function random(p5, fn){
252
231
  * // Draw the point.
253
232
  * point(x, y);
254
233
  * }
255
- * </code>
256
- * </div>
257
234
  */
258
235
  /**
259
236
  * @method random
@@ -317,8 +294,6 @@ function random(p5, fn){
317
294
  * @param {Number} [sd] standard deviation.
318
295
  * @return {Number} random number.
319
296
  * @example
320
- * <div>
321
- * <code>
322
297
  * function setup() {
323
298
  * createCanvas(100, 100);
324
299
  *
@@ -347,8 +322,6 @@ function random(p5, fn){
347
322
  * y = 75;
348
323
  * circle(x, y, 5);
349
324
  * }
350
- * </code>
351
- * </div>
352
325
  */
353
326
  fn.randomGaussian = function(mean, sd = 1) {
354
327
  let y1, x1, x2, w;
@@ -1,4 +1,4 @@
1
- import { a5 as RAD_TO_DEG, a6 as DEG_TO_RAD } from '../constants-DEJVKr9Z.js';
1
+ import { a5 as RAD_TO_DEG, a6 as DEG_TO_RAD } from '../constants-DQyACdzq.js';
2
2
 
3
3
  /**
4
4
  * @module Math
@@ -26,8 +26,6 @@ function trigonometry(p5, fn){
26
26
  * @final
27
27
  *
28
28
  * @example
29
- * <div>
30
- * <code>
31
29
  * function setup() {
32
30
  * createCanvas(100, 100);
33
31
  *
@@ -46,8 +44,6 @@ function trigonometry(p5, fn){
46
44
  *
47
45
  * describe('The bottom half of a circle drawn on a gray background. The bottom-right quarter is red. The bottom-left quarter is blue.');
48
46
  * }
49
- * </code>
50
- * </div>
51
47
  */
52
48
  const DEGREES = fn.DEGREES = 'degrees';
53
49
 
@@ -69,8 +65,6 @@ function trigonometry(p5, fn){
69
65
  * @final
70
66
  *
71
67
  * @example
72
- * <div>
73
- * <code>
74
68
  * function setup() {
75
69
  * createCanvas(100, 100);
76
70
  *
@@ -92,8 +86,6 @@ function trigonometry(p5, fn){
92
86
  *
93
87
  * describe('The bottom half of a circle drawn on a gray background. The bottom-right quarter is red. The bottom-left quarter is blue.');
94
88
  * }
95
- * </code>
96
- * </div>
97
89
  */
98
90
  const RADIANS = fn.RADIANS = 'radians';
99
91
 
@@ -117,8 +109,6 @@ function trigonometry(p5, fn){
117
109
  * @return {Number} arc cosine of the given value.
118
110
  *
119
111
  * @example
120
- * <div>
121
- * <code>
122
112
  * function setup() {
123
113
  * createCanvas(100, 100);
124
114
  *
@@ -136,11 +126,8 @@ function trigonometry(p5, fn){
136
126
  *
137
127
  * describe('The numbers 3.142, -1, and 3.142 written on separate rows.');
138
128
  * }
139
- * </code>
140
- * </div>
141
129
  *
142
- * <div>
143
- * <code>
130
+ * @example
144
131
  * function setup() {
145
132
  * createCanvas(100, 100);
146
133
  *
@@ -158,8 +145,6 @@ function trigonometry(p5, fn){
158
145
  *
159
146
  * describe('The numbers 3.927, -0.707, and 2.356 written on separate rows.');
160
147
  * }
161
- * </code>
162
- * </div>
163
148
  */
164
149
  fn.acos = function(ratio) {
165
150
  return this._fromRadians(Math.acos(ratio));
@@ -179,8 +164,6 @@ function trigonometry(p5, fn){
179
164
  * @return {Number} arc sine of the given value.
180
165
  *
181
166
  * @example
182
- * <div>
183
- * <code>
184
167
  * function setup() {
185
168
  * createCanvas(100, 100);
186
169
  *
@@ -198,11 +181,8 @@ function trigonometry(p5, fn){
198
181
  *
199
182
  * describe('The numbers 1.047, 0.866, and 1.047 written on separate rows.');
200
183
  * }
201
- * </code>
202
- * </div>
203
184
  *
204
- * <div>
205
- * <code>
185
+ * @example
206
186
  * function setup() {
207
187
  * createCanvas(100, 100);
208
188
  *
@@ -220,8 +200,6 @@ function trigonometry(p5, fn){
220
200
  *
221
201
  * describe('The numbers 4.189, -0.866, and -1.047 written on separate rows.');
222
202
  * }
223
- * </code>
224
- * </div>
225
203
  */
226
204
  fn.asin = function(ratio) {
227
205
  return this._fromRadians(Math.asin(ratio));
@@ -241,8 +219,6 @@ function trigonometry(p5, fn){
241
219
  * @return {Number} arc tangent of the given value.
242
220
  *
243
221
  * @example
244
- * <div>
245
- * <code>
246
222
  * function setup() {
247
223
  * createCanvas(100, 100);
248
224
  *
@@ -260,11 +236,8 @@ function trigonometry(p5, fn){
260
236
  *
261
237
  * describe('The numbers 1.047, 1.732, and 1.047 written on separate rows.');
262
238
  * }
263
- * </code>
264
- * </div>
265
239
  *
266
- * <div>
267
- * <code>
240
+ * @example
268
241
  * function setup() {
269
242
  * createCanvas(100, 100);
270
243
  *
@@ -282,8 +255,6 @@ function trigonometry(p5, fn){
282
255
  *
283
256
  * describe('The numbers 4.189, 1.732, and 1.047 written on separate rows.');
284
257
  * }
285
- * </code>
286
- * </div>
287
258
  */
288
259
  fn.atan = function(ratio) {
289
260
  return this._fromRadians(Math.atan(ratio));
@@ -308,8 +279,6 @@ function trigonometry(p5, fn){
308
279
  * @return {Number} arc tangent of the given point.
309
280
  *
310
281
  * @example
311
- * <div>
312
- * <code>
313
282
  * function setup() {
314
283
  * createCanvas(100, 100);
315
284
  *
@@ -329,11 +298,8 @@ function trigonometry(p5, fn){
329
298
  * // Draw the shape.
330
299
  * rect(0, 0, 60, 10);
331
300
  * }
332
- * </code>
333
- * </div>
334
301
  *
335
- * <div>
336
- * <code>
302
+ * @example
337
303
  * function setup() {
338
304
  * createCanvas(100, 100);
339
305
  *
@@ -359,8 +325,6 @@ function trigonometry(p5, fn){
359
325
  * // Draw the shape.
360
326
  * rect(-30, -5, 60, 10);
361
327
  * }
362
- * </code>
363
- * </div>
364
328
  */
365
329
  fn.atan2 = function(y, x) {
366
330
  return this._fromRadians(Math.atan2(y, x));
@@ -379,8 +343,6 @@ function trigonometry(p5, fn){
379
343
  * @return {Number} cosine of the angle.
380
344
  *
381
345
  * @example
382
- * <div>
383
- * <code>
384
346
  * function setup() {
385
347
  * createCanvas(100, 100);
386
348
  *
@@ -398,11 +360,8 @@ function trigonometry(p5, fn){
398
360
  * line(50, y, x, y);
399
361
  * circle(x, y, 20);
400
362
  * }
401
- * </code>
402
- * </div>
403
363
  *
404
- * <div>
405
- * <code>
364
+ * @example
406
365
  * function setup() {
407
366
  * createCanvas(100, 100);
408
367
  *
@@ -419,11 +378,8 @@ function trigonometry(p5, fn){
419
378
  * // Draw the point.
420
379
  * point(x, y);
421
380
  * }
422
- * </code>
423
- * </div>
424
381
  *
425
- * <div>
426
- * <code>
382
+ * @example
427
383
  * function setup() {
428
384
  * createCanvas(100, 100);
429
385
  *
@@ -440,8 +396,6 @@ function trigonometry(p5, fn){
440
396
  * // Draw the point.
441
397
  * point(x, y);
442
398
  * }
443
- * </code>
444
- * </div>
445
399
  */
446
400
  fn.cos = function(angle) {
447
401
  return Math.cos(this._toRadians(angle));
@@ -460,8 +414,6 @@ function trigonometry(p5, fn){
460
414
  * @return {Number} sine of the angle.
461
415
  *
462
416
  * @example
463
- * <div>
464
- * <code>
465
417
  * function setup() {
466
418
  * createCanvas(100, 100);
467
419
  *
@@ -479,11 +431,8 @@ function trigonometry(p5, fn){
479
431
  * line(50, y, x, y);
480
432
  * circle(x, y, 20);
481
433
  * }
482
- * </code>
483
- * </div>
484
434
  *
485
- * <div>
486
- * <code>
435
+ * @example
487
436
  * function setup() {
488
437
  * createCanvas(100, 100);
489
438
  *
@@ -500,11 +449,8 @@ function trigonometry(p5, fn){
500
449
  * // Draw the point.
501
450
  * point(x, y);
502
451
  * }
503
- * </code>
504
- * </div>
505
452
  *
506
- * <div>
507
- * <code>
453
+ * @example
508
454
  * function setup() {
509
455
  * createCanvas(100, 100);
510
456
  *
@@ -521,8 +467,6 @@ function trigonometry(p5, fn){
521
467
  * // Draw the point.
522
468
  * point(x, y);
523
469
  * }
524
- * </code>
525
- * </div>
526
470
  */
527
471
  fn.sin = function(angle) {
528
472
  return Math.sin(this._toRadians(angle));
@@ -542,8 +486,6 @@ function trigonometry(p5, fn){
542
486
  * @return {Number} tangent of the angle.
543
487
  *
544
488
  * @example
545
- * <div>
546
- * <code>
547
489
  * function setup() {
548
490
  * createCanvas(100, 100);
549
491
  *
@@ -560,8 +502,6 @@ function trigonometry(p5, fn){
560
502
  * // Draw the point.
561
503
  * point(x, y);
562
504
  * }
563
- * </code>
564
- * </div>
565
505
  */
566
506
  fn.tan = function(angle) {
567
507
  return Math.tan(this._toRadians(angle));
@@ -582,8 +522,6 @@ function trigonometry(p5, fn){
582
522
  * @return {Number} converted angle.
583
523
  *
584
524
  * @example
585
- * <div>
586
- * <code>
587
525
  * function setup() {
588
526
  * createCanvas(100, 100);
589
527
  *
@@ -598,8 +536,6 @@ function trigonometry(p5, fn){
598
536
  *
599
537
  * describe('The text "0.79 rad = 45˚".');
600
538
  * }
601
- * </code>
602
- * </div>
603
539
  */
604
540
  fn.degrees = angle => angle * RAD_TO_DEG;
605
541
 
@@ -618,8 +554,6 @@ function trigonometry(p5, fn){
618
554
  * @return {Number} converted angle.
619
555
  *
620
556
  * @example
621
- * <div>
622
- * <code>
623
557
  * function setup() {
624
558
  * createCanvas(100, 100);
625
559
  *
@@ -634,8 +568,6 @@ function trigonometry(p5, fn){
634
568
  *
635
569
  * describe('The text "45˚ = 0.785 rad".');
636
570
  * }
637
- * </code>
638
- * </div>
639
571
  */
640
572
  fn.radians = angle => angle * DEG_TO_RAD;
641
573
 
@@ -656,8 +588,6 @@ function trigonometry(p5, fn){
656
588
  * @method angleMode
657
589
  * @param {(RADIANS|DEGREES)} mode either RADIANS or DEGREES.
658
590
  * @example
659
- * <div>
660
- * <code>
661
591
  * function setup() {
662
592
  * createCanvas(100, 100);
663
593
  *
@@ -671,11 +601,8 @@ function trigonometry(p5, fn){
671
601
  *
672
602
  * describe('A diagonal line radiating from the top-left corner of a square.');
673
603
  * }
674
- * </code>
675
- * </div>
676
604
  *
677
- * <div>
678
- * <code>
605
+ * @example
679
606
  * function setup() {
680
607
  * createCanvas(100, 100);
681
608
  *
@@ -692,11 +619,8 @@ function trigonometry(p5, fn){
692
619
  *
693
620
  * describe('A diagonal line radiating from the top-left corner of a square.');
694
621
  * }
695
- * </code>
696
- * </div>
697
622
  *
698
- * <div>
699
- * <code>
623
+ * @example
700
624
  * function setup() {
701
625
  * createCanvas(100, 100);
702
626
  *
@@ -720,11 +644,8 @@ function trigonometry(p5, fn){
720
644
  *
721
645
  * describe('A translucent white flower on a dark background.');
722
646
  * }
723
- * </code>
724
- * </div>
725
647
  *
726
- * <div>
727
- * <code>
648
+ * @example
728
649
  * function setup() {
729
650
  * createCanvas(100, 100);
730
651
  *
@@ -751,11 +672,8 @@ function trigonometry(p5, fn){
751
672
  *
752
673
  * describe('A translucent white flower on a dark background.');
753
674
  * }
754
- * </code>
755
- * </div>
756
675
  *
757
- * <div>
758
- * <code>
676
+ * @example
759
677
  * function setup() {
760
678
  * createCanvas(100, 100);
761
679
  *
@@ -773,11 +691,8 @@ function trigonometry(p5, fn){
773
691
  * line(50, y, x, y);
774
692
  * circle(x, y, 20);
775
693
  * }
776
- * </code>
777
- * </div>
778
694
  *
779
- * <div>
780
- * <code>
695
+ * @example
781
696
  * function setup() {
782
697
  * createCanvas(100, 100);
783
698
  *
@@ -798,11 +713,8 @@ function trigonometry(p5, fn){
798
713
  * line(50, y, x, y);
799
714
  * circle(x, y, 20);
800
715
  * }
801
- * </code>
802
- * </div>
803
716
  *
804
- * <div>
805
- * <code>
717
+ * @example
806
718
  * function setup() {
807
719
  * createCanvas(100, 100);
808
720
  *
@@ -821,8 +733,6 @@ function trigonometry(p5, fn){
821
733
  *
822
734
  * describe('Two diagonal lines radiating from the top-left corner of a square. The lines are oriented 30 degrees from the edges of the square and 30 degrees apart from each other.');
823
735
  * }
824
- * </code>
825
- * </div>
826
736
  */
827
737
  /**
828
738
  * @method angleMode