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.
- package/dist/accessibility/color_namer.js +5 -6
- package/dist/accessibility/describe.js +4 -26
- package/dist/accessibility/index.js +5 -6
- package/dist/accessibility/outputs.js +6 -38
- package/dist/app.js +5 -6
- package/dist/color/color_conversion.js +5 -6
- package/dist/color/creating_reading.js +1 -1
- package/dist/color/index.js +2 -2
- package/dist/color/p5.Color.js +1 -1
- package/dist/color/setting.js +59 -357
- package/dist/{constants-DEJVKr9Z.js → constants-DQyACdzq.js} +11 -61
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +26 -158
- package/dist/core/filterShaders.js +1 -1
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/file_errors.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +1 -1
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -6
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +5 -6
- package/dist/core/main.js +5 -6
- package/dist/core/p5.Graphics.js +4 -5
- package/dist/core/p5.Renderer.js +3 -4
- package/dist/core/p5.Renderer2D.js +5 -6
- package/dist/core/p5.Renderer3D.js +4 -5
- package/dist/core/rendering.js +4 -5
- package/dist/core/structure.js +13 -52
- package/dist/core/transform.js +32 -176
- package/dist/{creating_reading-CgHCHxqN.js → creating_reading-ZXzcZEsb.js} +3 -196
- package/dist/data/local_storage.js +4 -30
- package/dist/dom/dom.js +24 -159
- package/dist/dom/index.js +2 -2
- package/dist/dom/p5.Element.js +31 -208
- package/dist/dom/p5.File.js +1 -32
- package/dist/dom/p5.MediaElement.js +10 -113
- package/dist/events/acceleration.js +11 -64
- package/dist/events/keyboard.js +13 -81
- package/dist/events/pointer.js +18 -160
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -5
- package/dist/image/image.js +4 -5
- package/dist/image/index.js +4 -5
- package/dist/image/loading_displaying.js +4 -5
- package/dist/image/p5.Image.js +3 -4
- package/dist/image/pixels.js +17 -100
- package/dist/io/files.js +4 -5
- package/dist/io/index.js +4 -5
- package/dist/io/p5.Table.js +66 -158
- package/dist/io/p5.TableRow.js +48 -71
- package/dist/io/p5.XML.js +6 -99
- package/dist/io/utilities.js +8 -3
- package/dist/{main-_RXV5Lx8.js → main-DvN69W3f.js} +13 -42
- package/dist/math/Matrices/Matrix.js +87 -126
- package/dist/math/Matrices/MatrixNumjs.js +1 -5
- package/dist/math/calculation.js +10 -112
- package/dist/math/index.js +1 -1
- package/dist/math/math.js +2 -12
- package/dist/math/noise.js +5 -32
- package/dist/math/p5.Matrix.js +3 -3
- package/dist/math/p5.Vector.js +104 -345
- package/dist/math/random.js +5 -32
- package/dist/math/trigonometry.js +15 -105
- package/dist/{p5.Renderer-QoFcvj3f.js → p5.Renderer-D-5LdCRz.js} +25 -178
- package/dist/{rendering-CsICjEXA.js → rendering-h9unX5K0.js} +254 -1156
- package/dist/shape/2d_primitives.js +33 -194
- package/dist/shape/attributes.js +12 -73
- package/dist/shape/curves.js +30 -95
- package/dist/shape/custom_shapes.js +63 -144
- package/dist/shape/index.js +2 -2
- package/dist/shape/vertex.js +21 -106
- package/dist/strands/p5.strands.js +248 -46
- package/dist/type/index.js +3 -4
- package/dist/type/p5.Font.js +4 -49
- package/dist/type/textCore.js +5 -158
- package/dist/utilities/conversion.js +17 -104
- package/dist/utilities/time_date.js +3 -40
- package/dist/utilities/utility_functions.js +6 -48
- package/dist/webgl/3d_primitives.js +4 -5
- package/dist/webgl/GeometryBuilder.js +1 -2
- package/dist/webgl/ShapeBuilder.js +22 -2
- package/dist/webgl/enums.js +1 -1
- package/dist/webgl/index.js +4 -5
- package/dist/webgl/interaction.js +6 -33
- package/dist/webgl/light.js +4 -5
- package/dist/webgl/loading.js +12 -46
- package/dist/webgl/material.js +4 -5
- package/dist/webgl/p5.Camera.js +4 -5
- package/dist/webgl/p5.DataArray.js +0 -4
- package/dist/webgl/p5.Framebuffer.js +4 -5
- package/dist/webgl/p5.Geometry.js +12 -106
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +7 -18
- package/dist/webgl/p5.Shader.js +12 -36
- package/dist/webgl/p5.Texture.js +4 -5
- package/dist/webgl/text.js +4 -5
- package/dist/webgl/utils.js +4 -5
- package/dist/webgpu/index.js +1 -1
- package/dist/webgpu/p5.RendererWebGPU.js +529 -208
- package/dist/webgpu/shaders/color.js +32 -17
- package/dist/webgpu/shaders/filters/base.js +18 -7
- package/dist/webgpu/shaders/font.js +52 -40
- package/dist/webgpu/shaders/line.js +50 -36
- package/dist/webgpu/shaders/material.js +90 -83
- package/dist/webgpu/strands_wgslBackend.js +5 -2
- package/lib/p5.esm.js +5576 -7811
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +5576 -7811
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +786 -453
- package/lib/p5.webgpu.js +786 -453
- package/lib/p5.webgpu.min.js +1 -1
- package/package.json +13 -13
- package/types/global.d.ts +16905 -16783
- package/types/p5.d.ts +11142 -11081
|
@@ -25,8 +25,6 @@ function conversion(p5, fn){
|
|
|
25
25
|
* @return {Number} converted number.
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
|
-
* <div>
|
|
29
|
-
* <code>
|
|
30
28
|
* function setup() {
|
|
31
29
|
* createCanvas(100, 100);
|
|
32
30
|
*
|
|
@@ -50,11 +48,8 @@ function conversion(p5, fn){
|
|
|
50
48
|
*
|
|
51
49
|
* describe('The text "12.3 × 2 = 24.6" written in black on a gray background.');
|
|
52
50
|
* }
|
|
53
|
-
* </code>
|
|
54
|
-
* </div>
|
|
55
51
|
*
|
|
56
|
-
*
|
|
57
|
-
* <code>
|
|
52
|
+
* @example
|
|
58
53
|
* function setup() {
|
|
59
54
|
* createCanvas(100, 100);
|
|
60
55
|
*
|
|
@@ -73,8 +68,6 @@ function conversion(p5, fn){
|
|
|
73
68
|
*
|
|
74
69
|
* describe('Three white, concentric circles on a gray background.');
|
|
75
70
|
* }
|
|
76
|
-
* </code>
|
|
77
|
-
* </div>
|
|
78
71
|
*/
|
|
79
72
|
/**
|
|
80
73
|
* @method float
|
|
@@ -109,8 +102,6 @@ function conversion(p5, fn){
|
|
|
109
102
|
* @return {Number} converted number.
|
|
110
103
|
*
|
|
111
104
|
* @example
|
|
112
|
-
* <div>
|
|
113
|
-
* <code>
|
|
114
105
|
* function setup() {
|
|
115
106
|
* createCanvas(100, 100);
|
|
116
107
|
*
|
|
@@ -131,11 +122,8 @@ function conversion(p5, fn){
|
|
|
131
122
|
*
|
|
132
123
|
* describe('The text "false : 0" written in black on a gray background.');
|
|
133
124
|
* }
|
|
134
|
-
* </code>
|
|
135
|
-
* </div>
|
|
136
125
|
*
|
|
137
|
-
*
|
|
138
|
-
* <code>
|
|
126
|
+
* @example
|
|
139
127
|
* function setup() {
|
|
140
128
|
* createCanvas(100, 100);
|
|
141
129
|
*
|
|
@@ -156,11 +144,8 @@ function conversion(p5, fn){
|
|
|
156
144
|
*
|
|
157
145
|
* describe('The text "12.34 ≈ 12" written in black on a gray background.');
|
|
158
146
|
* }
|
|
159
|
-
* </code>
|
|
160
|
-
* </div>
|
|
161
147
|
*
|
|
162
|
-
*
|
|
163
|
-
* <code>
|
|
148
|
+
* @example
|
|
164
149
|
* function setup() {
|
|
165
150
|
* createCanvas(100, 100);
|
|
166
151
|
*
|
|
@@ -181,11 +166,8 @@ function conversion(p5, fn){
|
|
|
181
166
|
*
|
|
182
167
|
* describe('The text "12.34 ≈ 12" written in black on a gray background.');
|
|
183
168
|
* }
|
|
184
|
-
* </code>
|
|
185
|
-
* </div>
|
|
186
169
|
*
|
|
187
|
-
*
|
|
188
|
-
* <code>
|
|
170
|
+
* @example
|
|
189
171
|
* function setup() {
|
|
190
172
|
* createCanvas(100, 100);
|
|
191
173
|
*
|
|
@@ -204,8 +186,6 @@ function conversion(p5, fn){
|
|
|
204
186
|
*
|
|
205
187
|
* describe('Three white, concentric circles on a gray background.');
|
|
206
188
|
* }
|
|
207
|
-
* </code>
|
|
208
|
-
* </div>
|
|
209
189
|
*/
|
|
210
190
|
/**
|
|
211
191
|
* @method int
|
|
@@ -246,8 +226,6 @@ function conversion(p5, fn){
|
|
|
246
226
|
* @return {String} converted string.
|
|
247
227
|
*
|
|
248
228
|
* @example
|
|
249
|
-
* <div>
|
|
250
|
-
* <code>
|
|
251
229
|
* function setup() {
|
|
252
230
|
* createCanvas(100, 100);
|
|
253
231
|
*
|
|
@@ -268,11 +246,8 @@ function conversion(p5, fn){
|
|
|
268
246
|
*
|
|
269
247
|
* describe('The text "false : false" written in black on a gray background.');
|
|
270
248
|
* }
|
|
271
|
-
* </code>
|
|
272
|
-
* </div>
|
|
273
249
|
*
|
|
274
|
-
*
|
|
275
|
-
* <code>
|
|
250
|
+
* @example
|
|
276
251
|
* function setup() {
|
|
277
252
|
* createCanvas(100, 100);
|
|
278
253
|
*
|
|
@@ -293,11 +268,8 @@ function conversion(p5, fn){
|
|
|
293
268
|
*
|
|
294
269
|
* describe('The text "123 = 123" written in black on a gray background.');
|
|
295
270
|
* }
|
|
296
|
-
* </code>
|
|
297
|
-
* </div>
|
|
298
271
|
*
|
|
299
|
-
*
|
|
300
|
-
* <code>
|
|
272
|
+
* @example
|
|
301
273
|
* function setup() {
|
|
302
274
|
* createCanvas(100, 100);
|
|
303
275
|
*
|
|
@@ -326,8 +298,6 @@ function conversion(p5, fn){
|
|
|
326
298
|
*
|
|
327
299
|
* describe('The text "123456" written in black on a gray background.');
|
|
328
300
|
* }
|
|
329
|
-
* </code>
|
|
330
|
-
* </div>
|
|
331
301
|
*/
|
|
332
302
|
fn.str = function(n) {
|
|
333
303
|
if (n instanceof Array) {
|
|
@@ -354,8 +324,6 @@ function conversion(p5, fn){
|
|
|
354
324
|
* @return {Boolean} converted Boolean value.
|
|
355
325
|
*
|
|
356
326
|
* @example
|
|
357
|
-
* <div>
|
|
358
|
-
* <code>
|
|
359
327
|
* function setup() {
|
|
360
328
|
* createCanvas(100, 100);
|
|
361
329
|
*
|
|
@@ -379,11 +347,8 @@ function conversion(p5, fn){
|
|
|
379
347
|
*
|
|
380
348
|
* describe('A red circle on a gray background.');
|
|
381
349
|
* }
|
|
382
|
-
* </code>
|
|
383
|
-
* </div>
|
|
384
350
|
*
|
|
385
|
-
*
|
|
386
|
-
* <code>
|
|
351
|
+
* @example
|
|
387
352
|
* function setup() {
|
|
388
353
|
* createCanvas(100, 100);
|
|
389
354
|
*
|
|
@@ -407,11 +372,8 @@ function conversion(p5, fn){
|
|
|
407
372
|
*
|
|
408
373
|
* describe('A blue circle on a gray background.');
|
|
409
374
|
* }
|
|
410
|
-
* </code>
|
|
411
|
-
* </div>
|
|
412
375
|
*
|
|
413
|
-
*
|
|
414
|
-
* <code>
|
|
376
|
+
* @example
|
|
415
377
|
* function setup() {
|
|
416
378
|
* createCanvas(100, 100);
|
|
417
379
|
*
|
|
@@ -444,8 +406,6 @@ function conversion(p5, fn){
|
|
|
444
406
|
* 'A row of circles on a gray background. The two circles on the left are red and the two on the right are blue.'
|
|
445
407
|
* );
|
|
446
408
|
* }
|
|
447
|
-
* </code>
|
|
448
|
-
* </div>
|
|
449
409
|
*/
|
|
450
410
|
/**
|
|
451
411
|
* @method boolean
|
|
@@ -486,8 +446,6 @@ function conversion(p5, fn){
|
|
|
486
446
|
* @return {Number} converted byte value.
|
|
487
447
|
*
|
|
488
448
|
* @example
|
|
489
|
-
* <div>
|
|
490
|
-
* <code>
|
|
491
449
|
* function setup() {
|
|
492
450
|
* createCanvas(100, 100);
|
|
493
451
|
*
|
|
@@ -508,11 +466,8 @@ function conversion(p5, fn){
|
|
|
508
466
|
*
|
|
509
467
|
* describe('The text "true : 1" written in black on a gray background.');
|
|
510
468
|
* }
|
|
511
|
-
* </code>
|
|
512
|
-
* </div>
|
|
513
469
|
*
|
|
514
|
-
*
|
|
515
|
-
* <code>
|
|
470
|
+
* @example
|
|
516
471
|
* function setup() {
|
|
517
472
|
* createCanvas(100, 100);
|
|
518
473
|
*
|
|
@@ -533,11 +488,8 @@ function conversion(p5, fn){
|
|
|
533
488
|
*
|
|
534
489
|
* describe('The text "256 : 0" written in black on a gray background.');
|
|
535
490
|
* }
|
|
536
|
-
* </code>
|
|
537
|
-
* </div>
|
|
538
491
|
*
|
|
539
|
-
*
|
|
540
|
-
* <code>
|
|
492
|
+
* @example
|
|
541
493
|
* function setup() {
|
|
542
494
|
* createCanvas(100, 100);
|
|
543
495
|
*
|
|
@@ -558,11 +510,8 @@ function conversion(p5, fn){
|
|
|
558
510
|
*
|
|
559
511
|
* describe('The text "256 : 0" written in black on a gray background.');
|
|
560
512
|
* }
|
|
561
|
-
* </code>
|
|
562
|
-
* </div>
|
|
563
513
|
*
|
|
564
|
-
*
|
|
565
|
-
* <code>
|
|
514
|
+
* @example
|
|
566
515
|
* function setup() {
|
|
567
516
|
* createCanvas(100, 100);
|
|
568
517
|
*
|
|
@@ -591,8 +540,6 @@ function conversion(p5, fn){
|
|
|
591
540
|
* 'Three gray circles on a gray background. The circles get lighter from left to right.'
|
|
592
541
|
* );
|
|
593
542
|
* }
|
|
594
|
-
* </code>
|
|
595
|
-
* </div>
|
|
596
543
|
*/
|
|
597
544
|
/**
|
|
598
545
|
* @method byte
|
|
@@ -628,8 +575,6 @@ function conversion(p5, fn){
|
|
|
628
575
|
* @return {String} converted single-character string.
|
|
629
576
|
*
|
|
630
577
|
* @example
|
|
631
|
-
* <div>
|
|
632
|
-
* <code>
|
|
633
578
|
* function setup() {
|
|
634
579
|
* createCanvas(100, 100);
|
|
635
580
|
*
|
|
@@ -650,11 +595,8 @@ function conversion(p5, fn){
|
|
|
650
595
|
*
|
|
651
596
|
* describe('The text "65 : A" written in black on a gray background.');
|
|
652
597
|
* }
|
|
653
|
-
* </code>
|
|
654
|
-
* </div>
|
|
655
598
|
*
|
|
656
|
-
*
|
|
657
|
-
* <code>
|
|
599
|
+
* @example
|
|
658
600
|
* function setup() {
|
|
659
601
|
* createCanvas(100, 100);
|
|
660
602
|
*
|
|
@@ -675,11 +617,8 @@ function conversion(p5, fn){
|
|
|
675
617
|
*
|
|
676
618
|
* describe('The text "65 : A" written in black on a gray background.');
|
|
677
619
|
* }
|
|
678
|
-
* </code>
|
|
679
|
-
* </div>
|
|
680
620
|
*
|
|
681
|
-
*
|
|
682
|
-
* <code>
|
|
621
|
+
* @example
|
|
683
622
|
* function setup() {
|
|
684
623
|
* createCanvas(100, 100);
|
|
685
624
|
*
|
|
@@ -709,8 +648,6 @@ function conversion(p5, fn){
|
|
|
709
648
|
* 'The text "65 : A", "66 : B", and "67 : C" written on three separate lines. The text is in black on a gray background.'
|
|
710
649
|
* );
|
|
711
650
|
* }
|
|
712
|
-
* </code>
|
|
713
|
-
* </div>
|
|
714
651
|
*/
|
|
715
652
|
/**
|
|
716
653
|
* @method char
|
|
@@ -742,8 +679,6 @@ function conversion(p5, fn){
|
|
|
742
679
|
* @return {Number} converted number.
|
|
743
680
|
*
|
|
744
681
|
* @example
|
|
745
|
-
* <div>
|
|
746
|
-
* <code>
|
|
747
682
|
* function setup() {
|
|
748
683
|
* createCanvas(100, 100);
|
|
749
684
|
*
|
|
@@ -764,11 +699,8 @@ function conversion(p5, fn){
|
|
|
764
699
|
*
|
|
765
700
|
* describe('The text "A : 65" written in black on a gray background.');
|
|
766
701
|
* }
|
|
767
|
-
* </code>
|
|
768
|
-
* </div>
|
|
769
702
|
*
|
|
770
|
-
*
|
|
771
|
-
* <code>
|
|
703
|
+
* @example
|
|
772
704
|
* function setup() {
|
|
773
705
|
* createCanvas(100, 100);
|
|
774
706
|
*
|
|
@@ -798,8 +730,6 @@ function conversion(p5, fn){
|
|
|
798
730
|
* 'The text "A : 65", "B : 66", and "C :67" written on three separate lines. The text is in black on a gray background.'
|
|
799
731
|
* );
|
|
800
732
|
* }
|
|
801
|
-
* </code>
|
|
802
|
-
* </div>
|
|
803
733
|
*/
|
|
804
734
|
/**
|
|
805
735
|
* @method unchar
|
|
@@ -836,8 +766,6 @@ function conversion(p5, fn){
|
|
|
836
766
|
* @return {String} converted hexadecimal value.
|
|
837
767
|
*
|
|
838
768
|
* @example
|
|
839
|
-
* <div>
|
|
840
|
-
* <code>
|
|
841
769
|
* function setup() {
|
|
842
770
|
* createCanvas(100, 100);
|
|
843
771
|
*
|
|
@@ -858,11 +786,8 @@ function conversion(p5, fn){
|
|
|
858
786
|
*
|
|
859
787
|
* describe('The text "20 = 00000014" written in black on a gray background.');
|
|
860
788
|
* }
|
|
861
|
-
* </code>
|
|
862
|
-
* </div>
|
|
863
789
|
*
|
|
864
|
-
*
|
|
865
|
-
* <code>
|
|
790
|
+
* @example
|
|
866
791
|
* function setup() {
|
|
867
792
|
* createCanvas(100, 100);
|
|
868
793
|
*
|
|
@@ -884,11 +809,8 @@ function conversion(p5, fn){
|
|
|
884
809
|
*
|
|
885
810
|
* describe('The text "20 = 14" written in black on a gray background.');
|
|
886
811
|
* }
|
|
887
|
-
* </code>
|
|
888
|
-
* </div>
|
|
889
812
|
*
|
|
890
|
-
*
|
|
891
|
-
* <code>
|
|
813
|
+
* @example
|
|
892
814
|
* function setup() {
|
|
893
815
|
* createCanvas(100, 100);
|
|
894
816
|
*
|
|
@@ -919,8 +841,6 @@ function conversion(p5, fn){
|
|
|
919
841
|
* 'The text "1 = 01", "10 = 0A", and "100 = 64" written on three separate lines. The text is in black on a gray background.'
|
|
920
842
|
* );
|
|
921
843
|
* }
|
|
922
|
-
* </code>
|
|
923
|
-
* </div>
|
|
924
844
|
*/
|
|
925
845
|
/**
|
|
926
846
|
* @method hex
|
|
@@ -969,8 +889,6 @@ function conversion(p5, fn){
|
|
|
969
889
|
* @return {Number} converted number.
|
|
970
890
|
*
|
|
971
891
|
* @example
|
|
972
|
-
* <div>
|
|
973
|
-
* <code>
|
|
974
892
|
* function setup() {
|
|
975
893
|
* createCanvas(100, 100);
|
|
976
894
|
*
|
|
@@ -991,11 +909,8 @@ function conversion(p5, fn){
|
|
|
991
909
|
*
|
|
992
910
|
* describe('The text "FF = 255" written in black on a gray background.');
|
|
993
911
|
* }
|
|
994
|
-
* </code>
|
|
995
|
-
* </div>
|
|
996
912
|
*
|
|
997
|
-
*
|
|
998
|
-
* <code>
|
|
913
|
+
* @example
|
|
999
914
|
* function setup() {
|
|
1000
915
|
* createCanvas(100, 100);
|
|
1001
916
|
*
|
|
@@ -1026,8 +941,6 @@ function conversion(p5, fn){
|
|
|
1026
941
|
* 'The text "00 = 0", "80 = 128", and "FF = 255" written on three separate lines. The text is in black on a gray background.'
|
|
1027
942
|
* );
|
|
1028
943
|
* }
|
|
1029
|
-
* </code>
|
|
1030
|
-
* </div>
|
|
1031
944
|
*/
|
|
1032
945
|
/**
|
|
1033
946
|
* @method unhex
|
|
@@ -13,8 +13,6 @@ function timeDate(p5, fn){
|
|
|
13
13
|
* @return {Integer} current day between 1 and 31.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* <div>
|
|
17
|
-
* <code>
|
|
18
16
|
* function setup() {
|
|
19
17
|
* createCanvas(100, 100);
|
|
20
18
|
*
|
|
@@ -33,8 +31,6 @@ function timeDate(p5, fn){
|
|
|
33
31
|
*
|
|
34
32
|
* describe(`The text 'Current day: ${d}' written in black on a gray background.`);
|
|
35
33
|
* }
|
|
36
|
-
* </code>
|
|
37
|
-
* </div>
|
|
38
34
|
*/
|
|
39
35
|
fn.day = function() {
|
|
40
36
|
return new Date().getDate();
|
|
@@ -47,8 +43,6 @@ function timeDate(p5, fn){
|
|
|
47
43
|
* @return {Integer} current hour between 0 and 23.
|
|
48
44
|
*
|
|
49
45
|
* @example
|
|
50
|
-
* <div>
|
|
51
|
-
* <code>
|
|
52
46
|
* function setup() {
|
|
53
47
|
* createCanvas(100, 100);
|
|
54
48
|
*
|
|
@@ -67,8 +61,6 @@ function timeDate(p5, fn){
|
|
|
67
61
|
*
|
|
68
62
|
* describe(`The text 'Current hour: ${h}' written in black on a gray background.`);
|
|
69
63
|
* }
|
|
70
|
-
* </code>
|
|
71
|
-
* </div>
|
|
72
64
|
*/
|
|
73
65
|
fn.hour = function() {
|
|
74
66
|
return new Date().getHours();
|
|
@@ -81,8 +73,6 @@ function timeDate(p5, fn){
|
|
|
81
73
|
* @return {Integer} current minute between 0 and 59.
|
|
82
74
|
*
|
|
83
75
|
* @example
|
|
84
|
-
* <div>
|
|
85
|
-
* <code>
|
|
86
76
|
* function setup() {
|
|
87
77
|
* createCanvas(100, 100);
|
|
88
78
|
*
|
|
@@ -101,8 +91,6 @@ function timeDate(p5, fn){
|
|
|
101
91
|
*
|
|
102
92
|
* describe(`The text 'Current minute: ${m}' written in black on a gray background.`);
|
|
103
93
|
* }
|
|
104
|
-
* </code>
|
|
105
|
-
* </div>
|
|
106
94
|
*/
|
|
107
95
|
fn.minute = function() {
|
|
108
96
|
return new Date().getMinutes();
|
|
@@ -125,8 +113,6 @@ function timeDate(p5, fn){
|
|
|
125
113
|
* @return {Number} number of milliseconds since starting the sketch.
|
|
126
114
|
*
|
|
127
115
|
* @example
|
|
128
|
-
* <div>
|
|
129
|
-
* <code>
|
|
130
116
|
* function setup() {
|
|
131
117
|
* createCanvas(100, 100);
|
|
132
118
|
*
|
|
@@ -147,11 +133,8 @@ function timeDate(p5, fn){
|
|
|
147
133
|
* `The text 'Startup time: ${round(ms, 2)} ms' written in black on a gray background.`
|
|
148
134
|
* );
|
|
149
135
|
* }
|
|
150
|
-
* </code>
|
|
151
|
-
* </div>
|
|
152
136
|
*
|
|
153
|
-
*
|
|
154
|
-
* <code>
|
|
137
|
+
* @example
|
|
155
138
|
* function setup() {
|
|
156
139
|
* createCanvas(100, 100);
|
|
157
140
|
*
|
|
@@ -172,11 +155,8 @@ function timeDate(p5, fn){
|
|
|
172
155
|
* // Display how long the sketch has run.
|
|
173
156
|
* text(`Running time: ${nf(s, 1, 1)} sec`, 5, 50, 90);
|
|
174
157
|
* }
|
|
175
|
-
* </code>
|
|
176
|
-
* </div>
|
|
177
158
|
*
|
|
178
|
-
*
|
|
179
|
-
* <code>
|
|
159
|
+
* @example
|
|
180
160
|
* function setup() {
|
|
181
161
|
* createCanvas(100, 100);
|
|
182
162
|
*
|
|
@@ -195,11 +175,8 @@ function timeDate(p5, fn){
|
|
|
195
175
|
* // Draw the circle.
|
|
196
176
|
* circle(x, 50, 30);
|
|
197
177
|
* }
|
|
198
|
-
* </code>
|
|
199
|
-
* </div>
|
|
200
178
|
*
|
|
201
|
-
*
|
|
202
|
-
* <code>
|
|
179
|
+
* @example
|
|
203
180
|
* async function setup() {
|
|
204
181
|
* // Load the GeoJSON.
|
|
205
182
|
* await loadJSON('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson');
|
|
@@ -222,8 +199,6 @@ function timeDate(p5, fn){
|
|
|
222
199
|
* `The text "It took ${round(ms, 2)} ms to load the data" written in black on a gray background.`
|
|
223
200
|
* );
|
|
224
201
|
* }
|
|
225
|
-
* </code>
|
|
226
|
-
* </div>
|
|
227
202
|
*/
|
|
228
203
|
fn.millis = function() {
|
|
229
204
|
if (this._millisStart === -1) {
|
|
@@ -241,8 +216,6 @@ function timeDate(p5, fn){
|
|
|
241
216
|
* @return {Integer} current month between 1 and 12.
|
|
242
217
|
*
|
|
243
218
|
* @example
|
|
244
|
-
* <div>
|
|
245
|
-
* <code>
|
|
246
219
|
* function setup() {
|
|
247
220
|
* createCanvas(100, 100);
|
|
248
221
|
*
|
|
@@ -261,8 +234,6 @@ function timeDate(p5, fn){
|
|
|
261
234
|
*
|
|
262
235
|
* describe(`The text 'Current month: ${m}' written in black on a gray background.`);
|
|
263
236
|
* }
|
|
264
|
-
* </code>
|
|
265
|
-
* </div>
|
|
266
237
|
*/
|
|
267
238
|
fn.month = function() {
|
|
268
239
|
//January is 0!
|
|
@@ -276,8 +247,6 @@ function timeDate(p5, fn){
|
|
|
276
247
|
* @return {Integer} current second between 0 and 59.
|
|
277
248
|
*
|
|
278
249
|
* @example
|
|
279
|
-
* <div>
|
|
280
|
-
* <code>
|
|
281
250
|
* function setup() {
|
|
282
251
|
* createCanvas(100, 100);
|
|
283
252
|
*
|
|
@@ -296,8 +265,6 @@ function timeDate(p5, fn){
|
|
|
296
265
|
*
|
|
297
266
|
* describe(`The text 'Current second: ${s}' written in black on a gray background.`);
|
|
298
267
|
* }
|
|
299
|
-
* </code>
|
|
300
|
-
* </div>
|
|
301
268
|
*/
|
|
302
269
|
fn.second = function() {
|
|
303
270
|
return new Date().getSeconds();
|
|
@@ -310,8 +277,6 @@ function timeDate(p5, fn){
|
|
|
310
277
|
* @return {Integer} current year.
|
|
311
278
|
*
|
|
312
279
|
* @example
|
|
313
|
-
* <div>
|
|
314
|
-
* <code>
|
|
315
280
|
* function setup() {
|
|
316
281
|
* createCanvas(100, 100);
|
|
317
282
|
*
|
|
@@ -330,8 +295,6 @@ function timeDate(p5, fn){
|
|
|
330
295
|
*
|
|
331
296
|
* describe(`The text 'Current year: ${y}' written in black on a gray background.`);
|
|
332
297
|
* }
|
|
333
|
-
* </code>
|
|
334
|
-
* </div>
|
|
335
298
|
*/
|
|
336
299
|
fn.year = function() {
|
|
337
300
|
return new Date().getFullYear();
|
|
@@ -44,8 +44,6 @@ function utilityFunctions(p5, fn){
|
|
|
44
44
|
* @return {String} formatted string.
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
|
-
* <div>
|
|
48
|
-
* <code>
|
|
49
47
|
* function setup() {
|
|
50
48
|
* createCanvas(100, 100);
|
|
51
49
|
*
|
|
@@ -80,8 +78,6 @@ function utilityFunctions(p5, fn){
|
|
|
80
78
|
* 'The numbers "123.45", "-0123.45", "0123.45", and "0123.5" written on four separate lines. The text is in black on a gray background.'
|
|
81
79
|
* );
|
|
82
80
|
* }
|
|
83
|
-
* </code>
|
|
84
|
-
* </div>
|
|
85
81
|
*/
|
|
86
82
|
/**
|
|
87
83
|
* @method nf
|
|
@@ -153,8 +149,6 @@ function utilityFunctions(p5, fn){
|
|
|
153
149
|
* @return {String} formatted string.
|
|
154
150
|
*
|
|
155
151
|
* @example
|
|
156
|
-
* <div>
|
|
157
|
-
* <code>
|
|
158
152
|
* function setup() {
|
|
159
153
|
* createCanvas(100, 100);
|
|
160
154
|
*
|
|
@@ -180,11 +174,8 @@ function utilityFunctions(p5, fn){
|
|
|
180
174
|
* 'The numbers "12,345" and "12,345.00" written on separate lines. The text is in black on a gray background.'
|
|
181
175
|
* );
|
|
182
176
|
* }
|
|
183
|
-
* </code>
|
|
184
|
-
* </div>
|
|
185
177
|
*
|
|
186
|
-
*
|
|
187
|
-
* <code>
|
|
178
|
+
* @example
|
|
188
179
|
* function setup() {
|
|
189
180
|
* createCanvas(100, 100);
|
|
190
181
|
*
|
|
@@ -214,8 +205,6 @@ function utilityFunctions(p5, fn){
|
|
|
214
205
|
* 'The text "12345 : 12,345" and "6789 : 6,789" written on two separate lines. The text is in black on a gray background.'
|
|
215
206
|
* );
|
|
216
207
|
* }
|
|
217
|
-
* </code>
|
|
218
|
-
* </div>
|
|
219
208
|
*/
|
|
220
209
|
/**
|
|
221
210
|
* @method nfc
|
|
@@ -288,8 +277,6 @@ function utilityFunctions(p5, fn){
|
|
|
288
277
|
* @return {String} formatted string.
|
|
289
278
|
*
|
|
290
279
|
* @example
|
|
291
|
-
* <div>
|
|
292
|
-
* <code>
|
|
293
280
|
* function setup() {
|
|
294
281
|
* createCanvas(100, 100);
|
|
295
282
|
*
|
|
@@ -319,11 +306,8 @@ function utilityFunctions(p5, fn){
|
|
|
319
306
|
* 'The text "123 : +123" and "-123 : -123.00" written on separate lines. The text is in black on a gray background.'
|
|
320
307
|
* );
|
|
321
308
|
* }
|
|
322
|
-
* </code>
|
|
323
|
-
* </div>
|
|
324
309
|
*
|
|
325
|
-
*
|
|
326
|
-
* <code>
|
|
310
|
+
* @example
|
|
327
311
|
* function setup() {
|
|
328
312
|
* createCanvas(100, 100);
|
|
329
313
|
*
|
|
@@ -355,8 +339,6 @@ function utilityFunctions(p5, fn){
|
|
|
355
339
|
* 'The text "123 : +0123.0" and "-4.56 : 00-4.6" written on separate lines. The text is in black on a gray background.'
|
|
356
340
|
* );
|
|
357
341
|
* }
|
|
358
|
-
* </code>
|
|
359
|
-
* </div>
|
|
360
342
|
*/
|
|
361
343
|
/**
|
|
362
344
|
* @method nfp
|
|
@@ -413,8 +395,6 @@ function utilityFunctions(p5, fn){
|
|
|
413
395
|
* @return {String} formatted string.
|
|
414
396
|
*
|
|
415
397
|
* @example
|
|
416
|
-
* <div>
|
|
417
|
-
* <code>
|
|
418
398
|
* function setup() {
|
|
419
399
|
* createCanvas(100, 100);
|
|
420
400
|
*
|
|
@@ -440,11 +420,8 @@ function utilityFunctions(p5, fn){
|
|
|
440
420
|
* 'The numbers -123 and 123 written on separate lines. The numbers align vertically. The text is in black on a gray background.'
|
|
441
421
|
* );
|
|
442
422
|
* }
|
|
443
|
-
* </code>
|
|
444
|
-
* </div>
|
|
445
423
|
*
|
|
446
|
-
*
|
|
447
|
-
* <code>
|
|
424
|
+
* @example
|
|
448
425
|
* function setup() {
|
|
449
426
|
* createCanvas(100, 100);
|
|
450
427
|
*
|
|
@@ -472,8 +449,6 @@ function utilityFunctions(p5, fn){
|
|
|
472
449
|
* 'The numbers "-0123.5" and "0123.5" written on separate lines. The numbers align vertically. The text is in black on a gray background.'
|
|
473
450
|
* );
|
|
474
451
|
* }
|
|
475
|
-
* </code>
|
|
476
|
-
* </div>
|
|
477
452
|
*/
|
|
478
453
|
/**
|
|
479
454
|
* @method nfs
|
|
@@ -521,8 +496,6 @@ function utilityFunctions(p5, fn){
|
|
|
521
496
|
* @return {String[]} separated strings.
|
|
522
497
|
*
|
|
523
498
|
* @example
|
|
524
|
-
* <div>
|
|
525
|
-
* <code>
|
|
526
499
|
* function setup() {
|
|
527
500
|
* createCanvas(100, 100);
|
|
528
501
|
*
|
|
@@ -556,11 +529,8 @@ function utilityFunctions(p5, fn){
|
|
|
556
529
|
* 'The words "rock", "paper", "scissors", and "shoot" written on separate lines. The text is black on a gray background.'
|
|
557
530
|
* );
|
|
558
531
|
* }
|
|
559
|
-
* </code>
|
|
560
|
-
* </div>
|
|
561
532
|
*
|
|
562
|
-
*
|
|
563
|
-
* <code>
|
|
533
|
+
* @example
|
|
564
534
|
* function setup() {
|
|
565
535
|
* createCanvas(100, 100);
|
|
566
536
|
*
|
|
@@ -594,11 +564,8 @@ function utilityFunctions(p5, fn){
|
|
|
594
564
|
* 'The words "rock", "paper", "scissors", and "shoot" written on separate lines. The text is black on a gray background.'
|
|
595
565
|
* );
|
|
596
566
|
* }
|
|
597
|
-
* </code>
|
|
598
|
-
* </div>
|
|
599
567
|
*
|
|
600
|
-
*
|
|
601
|
-
* <code>
|
|
568
|
+
* @example
|
|
602
569
|
* function setup() {
|
|
603
570
|
* createCanvas(100, 100);
|
|
604
571
|
*
|
|
@@ -632,8 +599,6 @@ function utilityFunctions(p5, fn){
|
|
|
632
599
|
* 'The words "rock", "paper", "scissors", and "shoot" written on separate lines. The text is black on a gray background.'
|
|
633
600
|
* );
|
|
634
601
|
* }
|
|
635
|
-
* </code>
|
|
636
|
-
* </div>
|
|
637
602
|
*/
|
|
638
603
|
fn.splitTokens = function(value, delims) {
|
|
639
604
|
// p5._validateParameters('splitTokens', arguments);
|
|
@@ -680,8 +645,6 @@ function utilityFunctions(p5, fn){
|
|
|
680
645
|
* @return {Array} shuffled array.
|
|
681
646
|
*
|
|
682
647
|
* @example
|
|
683
|
-
* <div>
|
|
684
|
-
* <code>
|
|
685
648
|
* function setup() {
|
|
686
649
|
* createCanvas(100, 100);
|
|
687
650
|
*
|
|
@@ -723,11 +686,8 @@ function utilityFunctions(p5, fn){
|
|
|
723
686
|
* 'Two rows of circles on a gray background. The top row follows the color sequence ROYGBIV. The bottom row has all the same colors but they are shuffled.'
|
|
724
687
|
* );
|
|
725
688
|
* }
|
|
726
|
-
* </code>
|
|
727
|
-
* </div>
|
|
728
689
|
*
|
|
729
|
-
*
|
|
730
|
-
* <code>
|
|
690
|
+
* @example
|
|
731
691
|
* function setup() {
|
|
732
692
|
* createCanvas(100, 100);
|
|
733
693
|
*
|
|
@@ -756,8 +716,6 @@ function utilityFunctions(p5, fn){
|
|
|
756
716
|
* 'A row of colorful circles on a gray background. Their sequence changes each time the sketch runs.'
|
|
757
717
|
* );
|
|
758
718
|
* }
|
|
759
|
-
* </code>
|
|
760
|
-
* </div>
|
|
761
719
|
*/
|
|
762
720
|
fn.shuffle = function (arr, modify) {
|
|
763
721
|
const isView = ArrayBuffer && ArrayBuffer.isView && ArrayBuffer.isView(arr);
|