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
package/dist/core/environment.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as ARROW, k as CROSS, l as HAND, m as MOVE, n as TEXT, o as WAIT, P as P2D } from '../constants-
|
|
1
|
+
import { j as ARROW, k as CROSS, l as HAND, m as MOVE, n as TEXT, o as WAIT, P as P2D } from '../constants-DQyACdzq.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module Environment
|
|
@@ -45,24 +45,19 @@ function environment(p5, fn, lifecycles){
|
|
|
45
45
|
* @method print
|
|
46
46
|
* @param {Any} contents content to print to the console.
|
|
47
47
|
* @example
|
|
48
|
-
*
|
|
49
|
-
* <code>
|
|
48
|
+
* // META:norender
|
|
50
49
|
* function setup() {
|
|
51
50
|
* // Prints "hello, world" to the console.
|
|
52
51
|
* print('hello, world');
|
|
53
52
|
* }
|
|
54
|
-
* </code>
|
|
55
|
-
* </div>
|
|
56
53
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
54
|
+
* @example
|
|
55
|
+
* // META:norender
|
|
59
56
|
* function setup() {
|
|
60
57
|
* let name = 'ada';
|
|
61
58
|
* // Prints "hello, ada" to the console.
|
|
62
59
|
* print(`hello, ${name}`);
|
|
63
60
|
* }
|
|
64
|
-
* </code>
|
|
65
|
-
* </div>
|
|
66
61
|
*/
|
|
67
62
|
fn.print = function(...args) {
|
|
68
63
|
if (!args.length) {
|
|
@@ -92,8 +87,6 @@ function environment(p5, fn, lifecycles){
|
|
|
92
87
|
* @property {Integer} frameCount
|
|
93
88
|
* @readOnly
|
|
94
89
|
* @example
|
|
95
|
-
* <div>
|
|
96
|
-
* <code>
|
|
97
90
|
* function setup() {
|
|
98
91
|
* createCanvas(100, 100);
|
|
99
92
|
*
|
|
@@ -107,11 +100,8 @@ function environment(p5, fn, lifecycles){
|
|
|
107
100
|
*
|
|
108
101
|
* describe('The number 0 written in black in the middle of a gray square.');
|
|
109
102
|
* }
|
|
110
|
-
* </code>
|
|
111
|
-
* </div>
|
|
112
103
|
*
|
|
113
|
-
*
|
|
114
|
-
* <code>
|
|
104
|
+
* @example
|
|
115
105
|
* function setup() {
|
|
116
106
|
* createCanvas(100, 100);
|
|
117
107
|
*
|
|
@@ -131,8 +121,6 @@ function environment(p5, fn, lifecycles){
|
|
|
131
121
|
* // frameCount.
|
|
132
122
|
* text(frameCount, 50, 50);
|
|
133
123
|
* }
|
|
134
|
-
* </code>
|
|
135
|
-
* </div>
|
|
136
124
|
*/
|
|
137
125
|
fn.frameCount = 0;
|
|
138
126
|
|
|
@@ -147,8 +135,6 @@ function environment(p5, fn, lifecycles){
|
|
|
147
135
|
* @property {Integer} deltaTime
|
|
148
136
|
* @readOnly
|
|
149
137
|
* @example
|
|
150
|
-
* <div>
|
|
151
|
-
* <code>
|
|
152
138
|
* let x = 0;
|
|
153
139
|
* let speed = 0.05;
|
|
154
140
|
*
|
|
@@ -181,8 +167,6 @@ function environment(p5, fn, lifecycles){
|
|
|
181
167
|
* // position.
|
|
182
168
|
* circle(x, 50, 20);
|
|
183
169
|
* }
|
|
184
|
-
* </code>
|
|
185
|
-
* </div>
|
|
186
170
|
*/
|
|
187
171
|
fn.deltaTime = 0;
|
|
188
172
|
|
|
@@ -195,8 +179,6 @@ function environment(p5, fn, lifecycles){
|
|
|
195
179
|
* @property {Boolean} focused
|
|
196
180
|
* @readOnly
|
|
197
181
|
* @example
|
|
198
|
-
* <div>
|
|
199
|
-
* <code>
|
|
200
182
|
* // Open this example in two separate browser
|
|
201
183
|
* // windows placed side-by-side to demonstrate.
|
|
202
184
|
*
|
|
@@ -216,8 +198,6 @@ function environment(p5, fn, lifecycles){
|
|
|
216
198
|
* background(255, 0, 0);
|
|
217
199
|
* }
|
|
218
200
|
* }
|
|
219
|
-
* </code>
|
|
220
|
-
* </div>
|
|
221
201
|
*/
|
|
222
202
|
fn.focused = document.hasFocus();
|
|
223
203
|
|
|
@@ -244,8 +224,6 @@ function environment(p5, fn, lifecycles){
|
|
|
244
224
|
* @param {Number} [x] horizontal active spot of the cursor.
|
|
245
225
|
* @param {Number} [y] vertical active spot of the cursor.
|
|
246
226
|
* @example
|
|
247
|
-
* <div>
|
|
248
|
-
* <code>
|
|
249
227
|
* function setup() {
|
|
250
228
|
* createCanvas(100, 100);
|
|
251
229
|
*
|
|
@@ -258,11 +236,8 @@ function environment(p5, fn, lifecycles){
|
|
|
258
236
|
* // Set the cursor to crosshairs: +
|
|
259
237
|
* cursor(CROSS);
|
|
260
238
|
* }
|
|
261
|
-
* </code>
|
|
262
|
-
* </div>
|
|
263
239
|
*
|
|
264
|
-
*
|
|
265
|
-
* <code>
|
|
240
|
+
* @example
|
|
266
241
|
* function setup() {
|
|
267
242
|
* createCanvas(100, 100);
|
|
268
243
|
*
|
|
@@ -287,11 +262,8 @@ function environment(p5, fn, lifecycles){
|
|
|
287
262
|
* cursor('grab');
|
|
288
263
|
* }
|
|
289
264
|
* }
|
|
290
|
-
* </code>
|
|
291
|
-
* </div>
|
|
292
265
|
*
|
|
293
|
-
*
|
|
294
|
-
* <code>
|
|
266
|
+
* @example
|
|
295
267
|
* function setup() {
|
|
296
268
|
* createCanvas(100, 100);
|
|
297
269
|
*
|
|
@@ -309,8 +281,6 @@ function environment(p5, fn, lifecycles){
|
|
|
309
281
|
* cursor('https://avatars0.githubusercontent.com/u/1617169?s=16');
|
|
310
282
|
* }
|
|
311
283
|
* }
|
|
312
|
-
* </code>
|
|
313
|
-
* </div>
|
|
314
284
|
*/
|
|
315
285
|
fn.cursor = function(type, x, y) {
|
|
316
286
|
let cursor = 'auto';
|
|
@@ -360,8 +330,6 @@ function environment(p5, fn, lifecycles){
|
|
|
360
330
|
* @chainable
|
|
361
331
|
*
|
|
362
332
|
* @example
|
|
363
|
-
* <div>
|
|
364
|
-
* <code>
|
|
365
333
|
* function setup() {
|
|
366
334
|
* createCanvas(100, 100);
|
|
367
335
|
*
|
|
@@ -387,11 +355,8 @@ function environment(p5, fn, lifecycles){
|
|
|
387
355
|
* // position.
|
|
388
356
|
* circle(x, 50, 20);
|
|
389
357
|
* }
|
|
390
|
-
* </code>
|
|
391
|
-
* </div>
|
|
392
358
|
*
|
|
393
|
-
*
|
|
394
|
-
* <code>
|
|
359
|
+
* @example
|
|
395
360
|
* function setup() {
|
|
396
361
|
* createCanvas(100, 100);
|
|
397
362
|
*
|
|
@@ -414,8 +379,6 @@ function environment(p5, fn, lifecycles){
|
|
|
414
379
|
* let fps = frameRate();
|
|
415
380
|
* text(fps, 50, 50);
|
|
416
381
|
* }
|
|
417
|
-
* </code>
|
|
418
|
-
* </div>
|
|
419
382
|
*/
|
|
420
383
|
/**
|
|
421
384
|
* @method frameRate
|
|
@@ -469,8 +432,6 @@ function environment(p5, fn, lifecycles){
|
|
|
469
432
|
* @method getTargetFrameRate
|
|
470
433
|
* @return {Number} _targetFrameRate
|
|
471
434
|
* @example
|
|
472
|
-
* <div>
|
|
473
|
-
* <code>
|
|
474
435
|
* function setup() {
|
|
475
436
|
* createCanvas(100, 100);
|
|
476
437
|
*
|
|
@@ -488,8 +449,6 @@ function environment(p5, fn, lifecycles){
|
|
|
488
449
|
* let fps = getTargetFrameRate();
|
|
489
450
|
* text(fps, 43, 54);
|
|
490
451
|
* }
|
|
491
|
-
* </code>
|
|
492
|
-
* </div>
|
|
493
452
|
*/
|
|
494
453
|
fn.getTargetFrameRate = function() {
|
|
495
454
|
return this._targetFrameRate;
|
|
@@ -500,8 +459,6 @@ function environment(p5, fn, lifecycles){
|
|
|
500
459
|
*
|
|
501
460
|
* @method noCursor
|
|
502
461
|
* @example
|
|
503
|
-
* <div>
|
|
504
|
-
* <code>
|
|
505
462
|
* function setup() {
|
|
506
463
|
* // Hide the cursor.
|
|
507
464
|
* noCursor();
|
|
@@ -514,8 +471,6 @@ function environment(p5, fn, lifecycles){
|
|
|
514
471
|
*
|
|
515
472
|
* describe('A white circle on a gray background. The circle follows the mouse as it moves. The cursor is hidden.');
|
|
516
473
|
* }
|
|
517
|
-
* </code>
|
|
518
|
-
* </div>
|
|
519
474
|
*/
|
|
520
475
|
fn.noCursor = function() {
|
|
521
476
|
this._curElement.elt.style.cursor = 'none';
|
|
@@ -537,8 +492,6 @@ function environment(p5, fn, lifecycles){
|
|
|
537
492
|
* @property {(WEBGL|WEBGL2)} webglVersion
|
|
538
493
|
* @readOnly
|
|
539
494
|
* @example
|
|
540
|
-
* <div>
|
|
541
|
-
* <code>
|
|
542
495
|
* function setup() {
|
|
543
496
|
* background(200);
|
|
544
497
|
*
|
|
@@ -547,11 +500,8 @@ function environment(p5, fn, lifecycles){
|
|
|
547
500
|
*
|
|
548
501
|
* describe('The text "p2d" written in black on a gray background.');
|
|
549
502
|
* }
|
|
550
|
-
* </code>
|
|
551
|
-
* </div>
|
|
552
503
|
*
|
|
553
|
-
*
|
|
554
|
-
* <code>
|
|
504
|
+
* @example
|
|
555
505
|
* let font;
|
|
556
506
|
*
|
|
557
507
|
* async function setup() {
|
|
@@ -569,11 +519,8 @@ function environment(p5, fn, lifecycles){
|
|
|
569
519
|
*
|
|
570
520
|
* describe('The text "webgl2" written in black on a gray background.');
|
|
571
521
|
* }
|
|
572
|
-
* </code>
|
|
573
|
-
* </div>
|
|
574
522
|
*
|
|
575
|
-
*
|
|
576
|
-
* <code>
|
|
523
|
+
* @example
|
|
577
524
|
* let font;
|
|
578
525
|
*
|
|
579
526
|
* async function setup() {
|
|
@@ -595,8 +542,6 @@ function environment(p5, fn, lifecycles){
|
|
|
595
542
|
*
|
|
596
543
|
* describe('The text "webgl" written in black on a gray background.');
|
|
597
544
|
* }
|
|
598
|
-
* </code>
|
|
599
|
-
* </div>
|
|
600
545
|
*/
|
|
601
546
|
fn.webglVersion = P2D;
|
|
602
547
|
|
|
@@ -612,8 +557,7 @@ function environment(p5, fn, lifecycles){
|
|
|
612
557
|
* @property {Number} displayWidth
|
|
613
558
|
* @readOnly
|
|
614
559
|
* @example
|
|
615
|
-
*
|
|
616
|
-
* <code>
|
|
560
|
+
* // META:norender
|
|
617
561
|
* function setup() {
|
|
618
562
|
* // Set the canvas' width and height
|
|
619
563
|
* // using the display's dimensions.
|
|
@@ -623,8 +567,6 @@ function environment(p5, fn, lifecycles){
|
|
|
623
567
|
*
|
|
624
568
|
* describe('A gray canvas that is the same size as the display.');
|
|
625
569
|
* }
|
|
626
|
-
* </code>
|
|
627
|
-
* </div>
|
|
628
570
|
*
|
|
629
571
|
* @alt
|
|
630
572
|
* This example does not render anything.
|
|
@@ -643,8 +585,7 @@ function environment(p5, fn, lifecycles){
|
|
|
643
585
|
* @property {Number} displayHeight
|
|
644
586
|
* @readOnly
|
|
645
587
|
* @example
|
|
646
|
-
*
|
|
647
|
-
* <code>
|
|
588
|
+
* // META:norender
|
|
648
589
|
* function setup() {
|
|
649
590
|
* // Set the canvas' width and height
|
|
650
591
|
* // using the display's dimensions.
|
|
@@ -654,8 +595,6 @@ function environment(p5, fn, lifecycles){
|
|
|
654
595
|
*
|
|
655
596
|
* describe('A gray canvas that is the same size as the display.');
|
|
656
597
|
* }
|
|
657
|
-
* </code>
|
|
658
|
-
* </div>
|
|
659
598
|
*
|
|
660
599
|
* @alt
|
|
661
600
|
* This example does not render anything.
|
|
@@ -671,8 +610,7 @@ function environment(p5, fn, lifecycles){
|
|
|
671
610
|
* @property {Number} windowWidth
|
|
672
611
|
* @readOnly
|
|
673
612
|
* @example
|
|
674
|
-
*
|
|
675
|
-
* <code>
|
|
613
|
+
* // META:norender
|
|
676
614
|
* function setup() {
|
|
677
615
|
* // Set the canvas' width and height
|
|
678
616
|
* // using the browser's dimensions.
|
|
@@ -682,8 +620,6 @@ function environment(p5, fn, lifecycles){
|
|
|
682
620
|
*
|
|
683
621
|
* describe('A gray canvas that takes up the entire browser window.');
|
|
684
622
|
* }
|
|
685
|
-
* </code>
|
|
686
|
-
* </div>
|
|
687
623
|
*
|
|
688
624
|
* @alt
|
|
689
625
|
* This example does not render anything.
|
|
@@ -699,8 +635,7 @@ function environment(p5, fn, lifecycles){
|
|
|
699
635
|
* @property {Number} windowHeight
|
|
700
636
|
* @readOnly
|
|
701
637
|
* @example
|
|
702
|
-
*
|
|
703
|
-
* <code>
|
|
638
|
+
* // META:norender
|
|
704
639
|
* function setup() {
|
|
705
640
|
* // Set the canvas' width and height
|
|
706
641
|
* // using the browser's dimensions.
|
|
@@ -710,8 +645,6 @@ function environment(p5, fn, lifecycles){
|
|
|
710
645
|
*
|
|
711
646
|
* describe('A gray canvas that takes up the entire browser window.');
|
|
712
647
|
* }
|
|
713
|
-
* </code>
|
|
714
|
-
* </div>
|
|
715
648
|
*
|
|
716
649
|
* @alt
|
|
717
650
|
* This example does not render anything.
|
|
@@ -732,8 +665,7 @@ function environment(p5, fn, lifecycles){
|
|
|
732
665
|
* @method windowResized
|
|
733
666
|
* @param {Event} [event] optional resize Event.
|
|
734
667
|
* @example
|
|
735
|
-
*
|
|
736
|
-
* <code>
|
|
668
|
+
* // META:norender
|
|
737
669
|
* function setup() {
|
|
738
670
|
* createCanvas(windowWidth, windowHeight);
|
|
739
671
|
*
|
|
@@ -752,13 +684,12 @@ function environment(p5, fn, lifecycles){
|
|
|
752
684
|
* function windowResized() {
|
|
753
685
|
* resizeCanvas(windowWidth, windowHeight);
|
|
754
686
|
* }
|
|
755
|
-
*
|
|
756
|
-
* </div>
|
|
687
|
+
*
|
|
757
688
|
* @alt
|
|
758
689
|
* This example does not render anything.
|
|
759
690
|
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
691
|
+
* @example
|
|
692
|
+
* // META:norender
|
|
762
693
|
* function setup() {
|
|
763
694
|
* createCanvas(windowWidth, windowHeight);
|
|
764
695
|
* }
|
|
@@ -777,8 +708,7 @@ function environment(p5, fn, lifecycles){
|
|
|
777
708
|
* // Print the resize event to the console for debugging.
|
|
778
709
|
* print(event);
|
|
779
710
|
* }
|
|
780
|
-
*
|
|
781
|
-
* </div>
|
|
711
|
+
*
|
|
782
712
|
* @alt
|
|
783
713
|
* This example does not render anything.
|
|
784
714
|
*/
|
|
@@ -849,8 +779,6 @@ function environment(p5, fn, lifecycles){
|
|
|
849
779
|
* @param {Boolean} [val] whether the sketch should be in fullscreen mode.
|
|
850
780
|
* @return {Boolean} current fullscreen state.
|
|
851
781
|
* @example
|
|
852
|
-
* <div>
|
|
853
|
-
* <code>
|
|
854
782
|
* function setup() {
|
|
855
783
|
* background(200);
|
|
856
784
|
*
|
|
@@ -865,8 +793,6 @@ function environment(p5, fn, lifecycles){
|
|
|
865
793
|
* fullscreen(!fs);
|
|
866
794
|
* }
|
|
867
795
|
* }
|
|
868
|
-
* </code>
|
|
869
|
-
* </div>
|
|
870
796
|
*/
|
|
871
797
|
fn.fullscreen = function(val) {
|
|
872
798
|
// p5._validateParameters('fullscreen', arguments);
|
|
@@ -907,8 +833,6 @@ function environment(p5, fn, lifecycles){
|
|
|
907
833
|
* @param {Number} [val] desired pixel density.
|
|
908
834
|
* @chainable
|
|
909
835
|
* @example
|
|
910
|
-
* <div>
|
|
911
|
-
* <code>
|
|
912
836
|
* function setup() {
|
|
913
837
|
* // Set the pixel density to 1.
|
|
914
838
|
* pixelDensity(1);
|
|
@@ -921,11 +845,8 @@ function environment(p5, fn, lifecycles){
|
|
|
921
845
|
*
|
|
922
846
|
* describe('A fuzzy white circle on a gray canvas.');
|
|
923
847
|
* }
|
|
924
|
-
* </code>
|
|
925
|
-
* </div>
|
|
926
848
|
*
|
|
927
|
-
*
|
|
928
|
-
* <code>
|
|
849
|
+
* @example
|
|
929
850
|
* function setup() {
|
|
930
851
|
* // Set the pixel density to 3.
|
|
931
852
|
* pixelDensity(3);
|
|
@@ -939,8 +860,6 @@ function environment(p5, fn, lifecycles){
|
|
|
939
860
|
*
|
|
940
861
|
* describe('A sharp white circle on a gray canvas.');
|
|
941
862
|
* }
|
|
942
|
-
* </code>
|
|
943
|
-
* </div>
|
|
944
863
|
*/
|
|
945
864
|
/**
|
|
946
865
|
* @method pixelDensity
|
|
@@ -967,8 +886,6 @@ function environment(p5, fn, lifecycles){
|
|
|
967
886
|
* @method displayDensity
|
|
968
887
|
* @returns {Number} current pixel density of the display.
|
|
969
888
|
* @example
|
|
970
|
-
* <div>
|
|
971
|
-
* <code>
|
|
972
889
|
* function setup() {
|
|
973
890
|
* // Set the pixel density to 1.
|
|
974
891
|
* pixelDensity(1);
|
|
@@ -995,8 +912,6 @@ function environment(p5, fn, lifecycles){
|
|
|
995
912
|
* background(200);
|
|
996
913
|
* circle(50, 50, 70);
|
|
997
914
|
* }
|
|
998
|
-
* </code>
|
|
999
|
-
* </div>
|
|
1000
915
|
*/
|
|
1001
916
|
fn.displayDensity = () => window.devicePixelRatio;
|
|
1002
917
|
|
|
@@ -1040,8 +955,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1040
955
|
* @method getURL
|
|
1041
956
|
* @return {String} url
|
|
1042
957
|
* @example
|
|
1043
|
-
* <div>
|
|
1044
|
-
* <code>
|
|
1045
958
|
* function setup() {
|
|
1046
959
|
* background(200);
|
|
1047
960
|
*
|
|
@@ -1053,8 +966,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1053
966
|
*
|
|
1054
967
|
* describe('The URL "https://p5js.org/reference/p5/getURL" written in black on a gray background.');
|
|
1055
968
|
* }
|
|
1056
|
-
* </code>
|
|
1057
|
-
* </div>
|
|
1058
969
|
*/
|
|
1059
970
|
fn.getURL = () => location.href;
|
|
1060
971
|
|
|
@@ -1072,8 +983,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1072
983
|
* @method getURLPath
|
|
1073
984
|
* @return {String[]} path components.
|
|
1074
985
|
* @example
|
|
1075
|
-
* <div>
|
|
1076
|
-
* <code>
|
|
1077
986
|
* function setup() {
|
|
1078
987
|
* background(200);
|
|
1079
988
|
*
|
|
@@ -1085,8 +994,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1085
994
|
*
|
|
1086
995
|
* describe('The word "reference" written in black on a gray background.');
|
|
1087
996
|
* }
|
|
1088
|
-
* </code>
|
|
1089
|
-
* </div>
|
|
1090
997
|
*/
|
|
1091
998
|
fn.getURLPath = () =>
|
|
1092
999
|
location.pathname.split('/').filter(v => v !== '');
|
|
@@ -1103,8 +1010,7 @@ function environment(p5, fn, lifecycles){
|
|
|
1103
1010
|
* @method getURLParams
|
|
1104
1011
|
* @return {Object} URL params
|
|
1105
1012
|
* @example
|
|
1106
|
-
*
|
|
1107
|
-
* <code>
|
|
1013
|
+
* // META:norender
|
|
1108
1014
|
* // Imagine this sketch is hosted at the following URL:
|
|
1109
1015
|
* // https://p5js.org?year=2014&month=May&day=15
|
|
1110
1016
|
*
|
|
@@ -1121,8 +1027,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1121
1027
|
*
|
|
1122
1028
|
* describe('The text "15", "May", and "2014" written in black on separate lines.');
|
|
1123
1029
|
* }
|
|
1124
|
-
* </code>
|
|
1125
|
-
* </div>
|
|
1126
1030
|
*
|
|
1127
1031
|
* @alt
|
|
1128
1032
|
* This example does not render anything.
|
|
@@ -1154,9 +1058,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1154
1058
|
* @param {Number} [z] The z coordinate in world space.
|
|
1155
1059
|
* @return {p5.Vector} A vector containing the 2D screen coordinates.
|
|
1156
1060
|
* @example
|
|
1157
|
-
* <div>
|
|
1158
|
-
* <code>
|
|
1159
|
-
*
|
|
1160
1061
|
* function setup() {
|
|
1161
1062
|
* createCanvas(150, 150);
|
|
1162
1063
|
* let vertices = [
|
|
@@ -1207,12 +1108,8 @@ function environment(p5, fn, lifecycles){
|
|
|
1207
1108
|
* describe('A rotating square is transformed and drawn using screen coordinates.');
|
|
1208
1109
|
*
|
|
1209
1110
|
* }
|
|
1210
|
-
* </code>
|
|
1211
|
-
* </div>
|
|
1212
1111
|
*
|
|
1213
1112
|
* @example
|
|
1214
|
-
* <div>
|
|
1215
|
-
* <code>
|
|
1216
1113
|
* let vertices;
|
|
1217
1114
|
*
|
|
1218
1115
|
* function setup() {
|
|
@@ -1258,9 +1155,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1258
1155
|
* ellipse(screenX, screenY, 3, 3);
|
|
1259
1156
|
* });
|
|
1260
1157
|
* }
|
|
1261
|
-
* </code>
|
|
1262
|
-
* </div>
|
|
1263
|
-
*
|
|
1264
1158
|
*/
|
|
1265
1159
|
fn.worldToScreen = function(worldPosition) {
|
|
1266
1160
|
if (typeof worldPosition === 'number') {
|
|
@@ -1272,6 +1166,7 @@ function environment(p5, fn, lifecycles){
|
|
|
1272
1166
|
const screenPosition = matrix.multiplyAndNormalizePoint(worldPosition);
|
|
1273
1167
|
return screenPosition;
|
|
1274
1168
|
};
|
|
1169
|
+
|
|
1275
1170
|
/**
|
|
1276
1171
|
* Converts 2D screen coordinates to 3D world coordinates.
|
|
1277
1172
|
*
|
|
@@ -1288,9 +1183,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1288
1183
|
* @param {Number} [z] The z coordinate in screen space.
|
|
1289
1184
|
* @return {p5.Vector} A vector containing the 3D world space coordinates.
|
|
1290
1185
|
* @example
|
|
1291
|
-
* <div>
|
|
1292
|
-
* <code>
|
|
1293
|
-
*
|
|
1294
1186
|
* function setup() {
|
|
1295
1187
|
* createCanvas(100, 100);
|
|
1296
1188
|
* describe('A rotating square with a line passing through the mouse drawn across it.');
|
|
@@ -1310,10 +1202,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1310
1202
|
* // Draw a line parallel to the local Y axis, passing through the mouse
|
|
1311
1203
|
* line(localMouse.x, -30, localMouse.x, 30);
|
|
1312
1204
|
* }
|
|
1313
|
-
*
|
|
1314
|
-
* </code>
|
|
1315
|
-
* </div>
|
|
1316
|
-
*
|
|
1317
1205
|
*/
|
|
1318
1206
|
fn.screenToWorld = function(screenPosition) {
|
|
1319
1207
|
if (typeof screenPosition === 'number') {
|
|
@@ -1347,8 +1235,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1347
1235
|
* 0.
|
|
1348
1236
|
*
|
|
1349
1237
|
* @example
|
|
1350
|
-
* <div>
|
|
1351
|
-
* <code>
|
|
1352
1238
|
* function setup() {
|
|
1353
1239
|
* background(200);
|
|
1354
1240
|
*
|
|
@@ -1357,11 +1243,8 @@ function environment(p5, fn, lifecycles){
|
|
|
1357
1243
|
*
|
|
1358
1244
|
* describe('The number 100 written in black on a gray square.');
|
|
1359
1245
|
* }
|
|
1360
|
-
* </code>
|
|
1361
|
-
* </div>
|
|
1362
1246
|
*
|
|
1363
|
-
*
|
|
1364
|
-
* <code>
|
|
1247
|
+
* @example
|
|
1365
1248
|
* function setup() {
|
|
1366
1249
|
* createCanvas(50, 100);
|
|
1367
1250
|
*
|
|
@@ -1372,11 +1255,8 @@ function environment(p5, fn, lifecycles){
|
|
|
1372
1255
|
*
|
|
1373
1256
|
* describe('The number 50 written in black on a gray rectangle.');
|
|
1374
1257
|
* }
|
|
1375
|
-
* </code>
|
|
1376
|
-
* </div>
|
|
1377
1258
|
*
|
|
1378
|
-
*
|
|
1379
|
-
* <code>
|
|
1259
|
+
* @example
|
|
1380
1260
|
* function setup() {
|
|
1381
1261
|
* createCanvas(100, 100);
|
|
1382
1262
|
*
|
|
@@ -1398,8 +1278,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1398
1278
|
* text(width, 21, 54);
|
|
1399
1279
|
* }
|
|
1400
1280
|
* }
|
|
1401
|
-
* </code>
|
|
1402
|
-
* </div>
|
|
1403
1281
|
*
|
|
1404
1282
|
* @property {Number} width
|
|
1405
1283
|
* @readOnly
|
|
@@ -1415,8 +1293,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1415
1293
|
* 0.
|
|
1416
1294
|
*
|
|
1417
1295
|
* @example
|
|
1418
|
-
* <div>
|
|
1419
|
-
* <code>
|
|
1420
1296
|
* function setup() {
|
|
1421
1297
|
* background(200);
|
|
1422
1298
|
*
|
|
@@ -1425,11 +1301,8 @@ function environment(p5, fn, lifecycles){
|
|
|
1425
1301
|
*
|
|
1426
1302
|
* describe('The number 100 written in black on a gray square.');
|
|
1427
1303
|
* }
|
|
1428
|
-
* </code>
|
|
1429
|
-
* </div>
|
|
1430
1304
|
*
|
|
1431
|
-
*
|
|
1432
|
-
* <code>
|
|
1305
|
+
* @example
|
|
1433
1306
|
* function setup() {
|
|
1434
1307
|
* createCanvas(100, 50);
|
|
1435
1308
|
*
|
|
@@ -1440,11 +1313,8 @@ function environment(p5, fn, lifecycles){
|
|
|
1440
1313
|
*
|
|
1441
1314
|
* describe('The number 50 written in black on a gray rectangle.');
|
|
1442
1315
|
* }
|
|
1443
|
-
* </code>
|
|
1444
|
-
* </div>
|
|
1445
1316
|
*
|
|
1446
|
-
*
|
|
1447
|
-
* <code>
|
|
1317
|
+
* @example
|
|
1448
1318
|
* function setup() {
|
|
1449
1319
|
* createCanvas(100, 100);
|
|
1450
1320
|
*
|
|
@@ -1466,8 +1336,6 @@ function environment(p5, fn, lifecycles){
|
|
|
1466
1336
|
* text(height, 42, 27);
|
|
1467
1337
|
* }
|
|
1468
1338
|
* }
|
|
1469
|
-
* </code>
|
|
1470
|
-
* </div>
|
|
1471
1339
|
*
|
|
1472
1340
|
* @property {Number} height
|
|
1473
1341
|
* @readOnly
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ag as OPAQUE, ah as DILATE, ai as ERODE, ab as BLUR, af as POSTERIZE, ae as THRESHOLD, aj as INVERT, ak as GRAY } from '../constants-
|
|
1
|
+
import { ag as OPAQUE, ah as DILATE, ai as ERODE, ab as BLUR, af as POSTERIZE, ae as THRESHOLD, aj as INVERT, ak as GRAY } from '../constants-DQyACdzq.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Creates p5.strands filter shaders for cross-platform compatibility.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { translator } from '../internationalization.js';
|
|
2
2
|
import strings from './browser_errors.js';
|
|
3
|
-
import { a3 as constants } from '../../constants-
|
|
3
|
+
import { a3 as constants } from '../../constants-DQyACdzq.js';
|
|
4
4
|
import 'i18next';
|
|
5
5
|
import 'i18next-browser-languagedetector';
|
|
6
6
|
|
|
@@ -6,7 +6,7 @@ import fileErrors from './file_errors.js';
|
|
|
6
6
|
import '../internationalization.js';
|
|
7
7
|
import 'i18next';
|
|
8
8
|
import 'i18next-browser-languagedetector';
|
|
9
|
-
import '../../constants-
|
|
9
|
+
import '../../constants-DQyACdzq.js';
|
|
10
10
|
import './browser_errors.js';
|
|
11
11
|
import 'zod/v4';
|
|
12
12
|
import 'acorn';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse } from 'acorn';
|
|
2
2
|
import { simple } from 'acorn-walk';
|
|
3
|
-
import { a3 as constants } from '../../constants-
|
|
3
|
+
import { a3 as constants } from '../../constants-DQyACdzq.js';
|
|
4
4
|
|
|
5
5
|
// List of functions to ignore as they either are meant to be re-defined or
|
|
6
6
|
// generate false positive outputs.
|
package/dist/core/helpers.js
CHANGED
package/dist/core/init.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { p as p5 } from '../main-
|
|
1
|
+
import { p as p5 } from '../main-DvN69W3f.js';
|
|
2
2
|
import { initialize } from './internationalization.js';
|
|
3
|
-
import '../constants-
|
|
3
|
+
import '../constants-DQyACdzq.js';
|
|
4
4
|
import './transform.js';
|
|
5
5
|
import './structure.js';
|
|
6
6
|
import './environment.js';
|
|
7
|
-
import '../rendering-
|
|
8
|
-
import '../creating_reading-
|
|
7
|
+
import '../rendering-h9unX5K0.js';
|
|
8
|
+
import '../creating_reading-ZXzcZEsb.js';
|
|
9
9
|
import 'colorjs.io/fn';
|
|
10
10
|
import '../color/color_spaces/hsb.js';
|
|
11
11
|
import '../dom/p5.Element.js';
|
|
12
12
|
import '../dom/p5.File.js';
|
|
13
13
|
import '../io/p5.XML.js';
|
|
14
|
-
import '../p5.Renderer-
|
|
14
|
+
import '../p5.Renderer-D-5LdCRz.js';
|
|
15
15
|
import '../image/filters.js';
|
|
16
16
|
import '../math/p5.Vector.js';
|
|
17
17
|
import '../shape/custom_shapes.js';
|
|
18
18
|
import './States.js';
|
|
19
19
|
import '../io/utilities.js';
|
|
20
|
-
import 'file-saver';
|
|
21
20
|
import '../dom/p5.MediaElement.js';
|
|
22
21
|
import '../shape/2d_primitives.js';
|
|
23
22
|
import './helpers.js';
|