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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import nj from '@d4c/numjs/build/module/numjs.min.js';
|
|
2
2
|
import { Vector } from '../p5.Vector.js';
|
|
3
3
|
import { MatrixInterface } from './MatrixInterface.js';
|
|
4
|
-
import '../../constants-
|
|
4
|
+
import '../../constants-DQyACdzq.js';
|
|
5
5
|
|
|
6
6
|
let isMatrixArray = x => Array.isArray(x);
|
|
7
7
|
if (typeof Float32Array !== 'undefined') {
|
|
@@ -21,8 +21,6 @@ if (typeof Float32Array !== 'undefined') {
|
|
|
21
21
|
* @param {Array} [mat4] column-major array literal of our 4×4 matrix
|
|
22
22
|
* @param {Array} [mat3] column-major array literal of our 3×3 matrix
|
|
23
23
|
* @example
|
|
24
|
-
* <div>
|
|
25
|
-
* <code>
|
|
26
24
|
* function setup() {
|
|
27
25
|
* createCanvas(100, 100);
|
|
28
26
|
*
|
|
@@ -32,8 +30,6 @@ if (typeof Float32Array !== 'undefined') {
|
|
|
32
30
|
* let p1 = createMatrix(1,1,1,1,1,1,1,1,1);
|
|
33
31
|
* console.log(p1);
|
|
34
32
|
* }
|
|
35
|
-
* </code>
|
|
36
|
-
* </div>
|
|
37
33
|
*/
|
|
38
34
|
// const matrixEngine = "numjs";
|
|
39
35
|
class MatrixNumjs extends MatrixInterface{
|
package/dist/math/calculation.js
CHANGED
|
@@ -18,8 +18,6 @@ function calculation(p5, fn){
|
|
|
18
18
|
* @return {Number} absolute value of given number.
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
|
-
* <div>
|
|
22
|
-
* <code>
|
|
23
21
|
* function setup() {
|
|
24
22
|
* createCanvas(100, 100);
|
|
25
23
|
*
|
|
@@ -39,8 +37,6 @@ function calculation(p5, fn){
|
|
|
39
37
|
* // from the middle.
|
|
40
38
|
* rect(0, 100 - h, 100, h);
|
|
41
39
|
* }
|
|
42
|
-
* </code>
|
|
43
|
-
* </div>
|
|
44
40
|
*/
|
|
45
41
|
fn.abs = Math.abs;
|
|
46
42
|
|
|
@@ -56,8 +52,6 @@ function calculation(p5, fn){
|
|
|
56
52
|
* @return {Integer} rounded up number.
|
|
57
53
|
*
|
|
58
54
|
* @example
|
|
59
|
-
* <div>
|
|
60
|
-
* <code>
|
|
61
55
|
* function setup() {
|
|
62
56
|
* createCanvas(100, 100);
|
|
63
57
|
*
|
|
@@ -82,8 +76,6 @@ function calculation(p5, fn){
|
|
|
82
76
|
*
|
|
83
77
|
* describe('Two rectangles. The one on the left is dark red and the one on the right is bright red.');
|
|
84
78
|
* }
|
|
85
|
-
* </code>
|
|
86
|
-
* </div>
|
|
87
79
|
*/
|
|
88
80
|
fn.ceil = Math.ceil;
|
|
89
81
|
|
|
@@ -97,8 +89,6 @@ function calculation(p5, fn){
|
|
|
97
89
|
* @return {Number} constrained number.
|
|
98
90
|
*
|
|
99
91
|
* @example
|
|
100
|
-
* <div>
|
|
101
|
-
* <code>
|
|
102
92
|
* function setup() {
|
|
103
93
|
* createCanvas(100, 100);
|
|
104
94
|
*
|
|
@@ -114,11 +104,8 @@ function calculation(p5, fn){
|
|
|
114
104
|
* strokeWeight(5);
|
|
115
105
|
* point(x, y);
|
|
116
106
|
* }
|
|
117
|
-
* </code>
|
|
118
|
-
* </div>
|
|
119
107
|
*
|
|
120
|
-
*
|
|
121
|
-
* <code>
|
|
108
|
+
* @example
|
|
122
109
|
* function setup() {
|
|
123
110
|
* createCanvas(100, 100);
|
|
124
111
|
*
|
|
@@ -143,8 +130,6 @@ function calculation(p5, fn){
|
|
|
143
130
|
* fill(0);
|
|
144
131
|
* circle(xc, 67, 9);
|
|
145
132
|
* }
|
|
146
|
-
* </code>
|
|
147
|
-
* </div>
|
|
148
133
|
*/
|
|
149
134
|
fn.constrain = function(n, low, high) {
|
|
150
135
|
// p5._validateParameters('constrain', arguments);
|
|
@@ -171,8 +156,6 @@ function calculation(p5, fn){
|
|
|
171
156
|
* @return {Number} distance between the two points.
|
|
172
157
|
*
|
|
173
158
|
* @example
|
|
174
|
-
* <div>
|
|
175
|
-
* <code>
|
|
176
159
|
* function setup() {
|
|
177
160
|
* createCanvas(100, 100);
|
|
178
161
|
*
|
|
@@ -202,8 +185,6 @@ function calculation(p5, fn){
|
|
|
202
185
|
*
|
|
203
186
|
* describe('Two dots connected by a horizontal line. The number 80 is written above the center of the line.');
|
|
204
187
|
* }
|
|
205
|
-
* </code>
|
|
206
|
-
* </div>
|
|
207
188
|
*/
|
|
208
189
|
/**
|
|
209
190
|
* @method dist
|
|
@@ -237,8 +218,6 @@ function calculation(p5, fn){
|
|
|
237
218
|
* @return {Number} e^n
|
|
238
219
|
*
|
|
239
220
|
* @example
|
|
240
|
-
* <div>
|
|
241
|
-
* <code>
|
|
242
221
|
* function setup() {
|
|
243
222
|
* createCanvas(100, 100);
|
|
244
223
|
*
|
|
@@ -262,11 +241,8 @@ function calculation(p5, fn){
|
|
|
262
241
|
*
|
|
263
242
|
* describe('A series of circles that grow exponentially from top left to bottom right.');
|
|
264
243
|
* }
|
|
265
|
-
* </code>
|
|
266
|
-
* </div>
|
|
267
244
|
*
|
|
268
|
-
*
|
|
269
|
-
* <code>
|
|
245
|
+
* @example
|
|
270
246
|
* function setup() {
|
|
271
247
|
* createCanvas(100, 100);
|
|
272
248
|
*
|
|
@@ -287,8 +263,6 @@ function calculation(p5, fn){
|
|
|
287
263
|
* // Draw a point.
|
|
288
264
|
* point(x, y);
|
|
289
265
|
* }
|
|
290
|
-
* </code>
|
|
291
|
-
* </div>
|
|
292
266
|
*/
|
|
293
267
|
fn.exp = Math.exp;
|
|
294
268
|
|
|
@@ -301,8 +275,6 @@ function calculation(p5, fn){
|
|
|
301
275
|
* @return {Integer} rounded down number.
|
|
302
276
|
*
|
|
303
277
|
* @example
|
|
304
|
-
* <div>
|
|
305
|
-
* <code>
|
|
306
278
|
* function setup() {
|
|
307
279
|
* createCanvas(100, 100);
|
|
308
280
|
*
|
|
@@ -325,8 +297,6 @@ function calculation(p5, fn){
|
|
|
325
297
|
*
|
|
326
298
|
* describe('Two rectangles. The one on the left is bright red and the one on the right is black.');
|
|
327
299
|
* }
|
|
328
|
-
* </code>
|
|
329
|
-
* </div>
|
|
330
300
|
*/
|
|
331
301
|
fn.floor = Math.floor;
|
|
332
302
|
|
|
@@ -350,8 +320,6 @@ function calculation(p5, fn){
|
|
|
350
320
|
* @return {Number} lerped value.
|
|
351
321
|
*
|
|
352
322
|
* @example
|
|
353
|
-
* <div>
|
|
354
|
-
* <code>
|
|
355
323
|
* function setup() {
|
|
356
324
|
* createCanvas(100, 100);
|
|
357
325
|
*
|
|
@@ -379,11 +347,8 @@ function calculation(p5, fn){
|
|
|
379
347
|
*
|
|
380
348
|
* describe('Five points in a horizontal line. The outer points are black and the inner points are gray.');
|
|
381
349
|
* }
|
|
382
|
-
* </code>
|
|
383
|
-
* </div>
|
|
384
350
|
*
|
|
385
|
-
*
|
|
386
|
-
* <code>
|
|
351
|
+
* @example
|
|
387
352
|
* let x = 50;
|
|
388
353
|
* let y = 50;
|
|
389
354
|
* let targetX = 50;
|
|
@@ -413,8 +378,6 @@ function calculation(p5, fn){
|
|
|
413
378
|
* x = mouseX;
|
|
414
379
|
* y = mouseY;
|
|
415
380
|
* }
|
|
416
|
-
* </code>
|
|
417
|
-
* </div>
|
|
418
381
|
*/
|
|
419
382
|
fn.lerp = function(start, stop, amt) {
|
|
420
383
|
// p5._validateParameters('lerp', arguments);
|
|
@@ -432,8 +395,6 @@ function calculation(p5, fn){
|
|
|
432
395
|
* @return {Number} natural logarithm of n.
|
|
433
396
|
*
|
|
434
397
|
* @example
|
|
435
|
-
* <div>
|
|
436
|
-
* <code>
|
|
437
398
|
* function setup() {
|
|
438
399
|
* createCanvas(100, 100);
|
|
439
400
|
*
|
|
@@ -449,11 +410,8 @@ function calculation(p5, fn){
|
|
|
449
410
|
*
|
|
450
411
|
* describe('Two white circles. The circle at the top-left is small. The circle at the bottom-right is about five times larger.');
|
|
451
412
|
* }
|
|
452
|
-
* </code>
|
|
453
|
-
* </div>
|
|
454
413
|
*
|
|
455
|
-
*
|
|
456
|
-
* <code>
|
|
414
|
+
* @example
|
|
457
415
|
* function setup() {
|
|
458
416
|
* createCanvas(100, 100);
|
|
459
417
|
*
|
|
@@ -474,8 +432,6 @@ function calculation(p5, fn){
|
|
|
474
432
|
* // Draw a point.
|
|
475
433
|
* point(x, y);
|
|
476
434
|
* }
|
|
477
|
-
* </code>
|
|
478
|
-
* </div>
|
|
479
435
|
*/
|
|
480
436
|
fn.log = Math.log;
|
|
481
437
|
|
|
@@ -501,8 +457,6 @@ function calculation(p5, fn){
|
|
|
501
457
|
* @return {Number} magnitude of vector.
|
|
502
458
|
*
|
|
503
459
|
* @example
|
|
504
|
-
* <div>
|
|
505
|
-
* <code>
|
|
506
460
|
* function setup() {
|
|
507
461
|
* createCanvas(100, 100);
|
|
508
462
|
*
|
|
@@ -524,8 +478,6 @@ function calculation(p5, fn){
|
|
|
524
478
|
*
|
|
525
479
|
* describe('A diagonal line is drawn from the top left of the canvas. The number 50 is written at the end of the line.');
|
|
526
480
|
* }
|
|
527
|
-
* </code>
|
|
528
|
-
* </div>
|
|
529
481
|
*/
|
|
530
482
|
fn.mag = function(x, y) {
|
|
531
483
|
// p5._validateParameters('mag', arguments);
|
|
@@ -557,8 +509,6 @@ function calculation(p5, fn){
|
|
|
557
509
|
* @return {Number} remapped number.
|
|
558
510
|
*
|
|
559
511
|
* @example
|
|
560
|
-
* <div>
|
|
561
|
-
* <code>
|
|
562
512
|
* function setup() {
|
|
563
513
|
* createCanvas(100, 100);
|
|
564
514
|
*
|
|
@@ -577,11 +527,8 @@ function calculation(p5, fn){
|
|
|
577
527
|
* // Draw the bottom line.
|
|
578
528
|
* line(0, 75, 0, x);
|
|
579
529
|
* }
|
|
580
|
-
* </code>
|
|
581
|
-
* </div>
|
|
582
530
|
*
|
|
583
|
-
*
|
|
584
|
-
* <code>
|
|
531
|
+
* @example
|
|
585
532
|
* function setup() {
|
|
586
533
|
* createCanvas(100, 100);
|
|
587
534
|
*
|
|
@@ -600,8 +547,6 @@ function calculation(p5, fn){
|
|
|
600
547
|
* // Draw the circle.
|
|
601
548
|
* circle(50, 50, 20);
|
|
602
549
|
* }
|
|
603
|
-
* </code>
|
|
604
|
-
* </div>
|
|
605
550
|
*/
|
|
606
551
|
fn.map = function(n, start1, stop1, start2, stop2, withinBounds) {
|
|
607
552
|
// p5._validateParameters('map', arguments);
|
|
@@ -631,8 +576,6 @@ function calculation(p5, fn){
|
|
|
631
576
|
* @return {Number} maximum number.
|
|
632
577
|
*
|
|
633
578
|
* @example
|
|
634
|
-
* <div>
|
|
635
|
-
* <code>
|
|
636
579
|
* function setup() {
|
|
637
580
|
* createCanvas(100, 100);
|
|
638
581
|
*
|
|
@@ -650,11 +593,8 @@ function calculation(p5, fn){
|
|
|
650
593
|
*
|
|
651
594
|
* describe('The number 20 written in the middle of a gray square.');
|
|
652
595
|
* }
|
|
653
|
-
* </code>
|
|
654
|
-
* </div>
|
|
655
596
|
*
|
|
656
|
-
*
|
|
657
|
-
* <code>
|
|
597
|
+
* @example
|
|
658
598
|
* function setup() {
|
|
659
599
|
* createCanvas(100, 100);
|
|
660
600
|
*
|
|
@@ -675,8 +615,6 @@ function calculation(p5, fn){
|
|
|
675
615
|
*
|
|
676
616
|
* describe('The number 20 written in the middle of a gray square.');
|
|
677
617
|
* }
|
|
678
|
-
* </code>
|
|
679
|
-
* </div>
|
|
680
618
|
*/
|
|
681
619
|
/**
|
|
682
620
|
* @method max
|
|
@@ -714,8 +652,6 @@ function calculation(p5, fn){
|
|
|
714
652
|
* @return {Number} minimum number.
|
|
715
653
|
*
|
|
716
654
|
* @example
|
|
717
|
-
* <div>
|
|
718
|
-
* <code>
|
|
719
655
|
* function setup() {
|
|
720
656
|
* createCanvas(100, 100);
|
|
721
657
|
*
|
|
@@ -733,11 +669,8 @@ function calculation(p5, fn){
|
|
|
733
669
|
*
|
|
734
670
|
* describe('The number 5 written in the middle of a gray square.');
|
|
735
671
|
* }
|
|
736
|
-
* </code>
|
|
737
|
-
* </div>
|
|
738
672
|
*
|
|
739
|
-
*
|
|
740
|
-
* <code>
|
|
673
|
+
* @example
|
|
741
674
|
* function setup() {
|
|
742
675
|
* createCanvas(100, 100);
|
|
743
676
|
*
|
|
@@ -758,8 +691,6 @@ function calculation(p5, fn){
|
|
|
758
691
|
*
|
|
759
692
|
* describe('The number 5 written in the middle of a gray square.');
|
|
760
693
|
* }
|
|
761
|
-
* </code>
|
|
762
|
-
* </div>
|
|
763
694
|
*/
|
|
764
695
|
/**
|
|
765
696
|
* @method min
|
|
@@ -799,8 +730,6 @@ function calculation(p5, fn){
|
|
|
799
730
|
* @return {Number} normalized number.
|
|
800
731
|
*
|
|
801
732
|
* @example
|
|
802
|
-
* <div>
|
|
803
|
-
* <code>
|
|
804
733
|
* function setup() {
|
|
805
734
|
* createCanvas(100, 100);
|
|
806
735
|
*
|
|
@@ -817,8 +746,6 @@ function calculation(p5, fn){
|
|
|
817
746
|
* // Paint the background.
|
|
818
747
|
* background(redValue, 0, 0);
|
|
819
748
|
* }
|
|
820
|
-
* </code>
|
|
821
|
-
* </div>
|
|
822
749
|
*/
|
|
823
750
|
fn.norm = function(n, start, stop) {
|
|
824
751
|
// p5._validateParameters('norm', arguments);
|
|
@@ -838,8 +765,6 @@ function calculation(p5, fn){
|
|
|
838
765
|
* @return {Number} n^e.
|
|
839
766
|
*
|
|
840
767
|
* @example
|
|
841
|
-
* <div>
|
|
842
|
-
* <code>
|
|
843
768
|
* function setup() {
|
|
844
769
|
* createCanvas(100, 100);
|
|
845
770
|
*
|
|
@@ -866,8 +791,6 @@ function calculation(p5, fn){
|
|
|
866
791
|
*
|
|
867
792
|
* describe('A series of circles that grow exponentially from top left to bottom right.');
|
|
868
793
|
* }
|
|
869
|
-
* </code>
|
|
870
|
-
* </div>
|
|
871
794
|
*/
|
|
872
795
|
fn.pow = Math.pow;
|
|
873
796
|
|
|
@@ -886,8 +809,6 @@ function calculation(p5, fn){
|
|
|
886
809
|
* @return {Integer} rounded number.
|
|
887
810
|
*
|
|
888
811
|
* @example
|
|
889
|
-
* <div>
|
|
890
|
-
* <code>
|
|
891
812
|
* function setup() {
|
|
892
813
|
* createCanvas(100, 100);
|
|
893
814
|
*
|
|
@@ -905,11 +826,8 @@ function calculation(p5, fn){
|
|
|
905
826
|
*
|
|
906
827
|
* describe('The number 4 written in middle of the canvas.');
|
|
907
828
|
* }
|
|
908
|
-
* </code>
|
|
909
|
-
* </div>
|
|
910
829
|
*
|
|
911
|
-
*
|
|
912
|
-
* <code>
|
|
830
|
+
* @example
|
|
913
831
|
* function setup() {
|
|
914
832
|
* createCanvas(100, 100);
|
|
915
833
|
*
|
|
@@ -927,8 +845,6 @@ function calculation(p5, fn){
|
|
|
927
845
|
*
|
|
928
846
|
* describe('The number 12.78 written in middle of canvas.');
|
|
929
847
|
* }
|
|
930
|
-
* </code>
|
|
931
|
-
* </div>
|
|
932
848
|
*/
|
|
933
849
|
fn.round = function(n, decimals) {
|
|
934
850
|
if (!decimals) {
|
|
@@ -951,8 +867,6 @@ function calculation(p5, fn){
|
|
|
951
867
|
* @return {Number} squared number.
|
|
952
868
|
*
|
|
953
869
|
* @example
|
|
954
|
-
* <div>
|
|
955
|
-
* <code>
|
|
956
870
|
* function setup() {
|
|
957
871
|
* createCanvas(100, 100);
|
|
958
872
|
*
|
|
@@ -968,11 +882,8 @@ function calculation(p5, fn){
|
|
|
968
882
|
*
|
|
969
883
|
* describe('Two white circles. The circle at the top-left is small. The circle at the bottom-right is four times larger.');
|
|
970
884
|
* }
|
|
971
|
-
* </code>
|
|
972
|
-
* </div>
|
|
973
885
|
*
|
|
974
|
-
*
|
|
975
|
-
* <code>
|
|
886
|
+
* @example
|
|
976
887
|
* function setup() {
|
|
977
888
|
* createCanvas(100, 100);
|
|
978
889
|
*
|
|
@@ -993,8 +904,6 @@ function calculation(p5, fn){
|
|
|
993
904
|
* // Draw the point.
|
|
994
905
|
* point(x, y);
|
|
995
906
|
* }
|
|
996
|
-
* </code>
|
|
997
|
-
* </div>
|
|
998
907
|
*/
|
|
999
908
|
fn.sq = n => n * n;
|
|
1000
909
|
|
|
@@ -1011,8 +920,6 @@ function calculation(p5, fn){
|
|
|
1011
920
|
* @return {Number} square root of number.
|
|
1012
921
|
*
|
|
1013
922
|
* @example
|
|
1014
|
-
* <div>
|
|
1015
|
-
* <code>
|
|
1016
923
|
* function setup() {
|
|
1017
924
|
* createCanvas(100, 100);
|
|
1018
925
|
*
|
|
@@ -1028,11 +935,8 @@ function calculation(p5, fn){
|
|
|
1028
935
|
*
|
|
1029
936
|
* describe('Two white circles. The circle at the top-left is small. The circle at the bottom-right is ten times larger.');
|
|
1030
937
|
* }
|
|
1031
|
-
* </code>
|
|
1032
|
-
* </div>
|
|
1033
938
|
*
|
|
1034
|
-
*
|
|
1035
|
-
* <code>
|
|
939
|
+
* @example
|
|
1036
940
|
* function setup() {
|
|
1037
941
|
* createCanvas(100, 100);
|
|
1038
942
|
*
|
|
@@ -1053,8 +957,6 @@ function calculation(p5, fn){
|
|
|
1053
957
|
* // Draw the point.
|
|
1054
958
|
* point(x, y);
|
|
1055
959
|
* }
|
|
1056
|
-
* </code>
|
|
1057
|
-
* </div>
|
|
1058
960
|
*/
|
|
1059
961
|
fn.sqrt = Math.sqrt;
|
|
1060
962
|
|
|
@@ -1069,8 +971,6 @@ function calculation(p5, fn){
|
|
|
1069
971
|
* @returns {Number} fractional part of n.
|
|
1070
972
|
*
|
|
1071
973
|
* @example
|
|
1072
|
-
* <div>
|
|
1073
|
-
* <code>
|
|
1074
974
|
* function setup() {
|
|
1075
975
|
* createCanvas(100, 100);
|
|
1076
976
|
*
|
|
@@ -1090,8 +990,6 @@ function calculation(p5, fn){
|
|
|
1090
990
|
*
|
|
1091
991
|
* describe('The number 56.78 written above the number 0.78.');
|
|
1092
992
|
* }
|
|
1093
|
-
* </code>
|
|
1094
|
-
* </div>
|
|
1095
993
|
*/
|
|
1096
994
|
fn.fract = function(toConvert) {
|
|
1097
995
|
// p5._validateParameters('fract', arguments);
|
package/dist/math/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import random from './random.js';
|
|
|
4
4
|
import trigonometry from './trigonometry.js';
|
|
5
5
|
import math$1 from './math.js';
|
|
6
6
|
import vector from './p5.Vector.js';
|
|
7
|
-
import '../constants-
|
|
7
|
+
import '../constants-DQyACdzq.js';
|
|
8
8
|
|
|
9
9
|
function math(p5){
|
|
10
10
|
p5.registerAddon(calculation);
|
package/dist/math/math.js
CHANGED
|
@@ -42,8 +42,6 @@ function math(p5, fn) {
|
|
|
42
42
|
* @return {p5.Vector} new <a href="#/p5.Vector">p5.Vector</a> object.
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
|
-
* <div>
|
|
46
|
-
* <code>
|
|
47
45
|
* function setup() {
|
|
48
46
|
* createCanvas(100, 100);
|
|
49
47
|
*
|
|
@@ -62,11 +60,8 @@ function math(p5, fn) {
|
|
|
62
60
|
*
|
|
63
61
|
* describe('Three black dots form a diagonal line from top left to bottom right.');
|
|
64
62
|
* }
|
|
65
|
-
* </code>
|
|
66
|
-
* </div>
|
|
67
63
|
*
|
|
68
|
-
*
|
|
69
|
-
* <code>
|
|
64
|
+
* @example
|
|
70
65
|
* let pos;
|
|
71
66
|
* let vel;
|
|
72
67
|
*
|
|
@@ -96,8 +91,6 @@ function math(p5, fn) {
|
|
|
96
91
|
* strokeWeight(5);
|
|
97
92
|
* point(pos);
|
|
98
93
|
* }
|
|
99
|
-
* </code>
|
|
100
|
-
* </div>
|
|
101
94
|
*/
|
|
102
95
|
fn.createVector = function (x, y, z) {
|
|
103
96
|
if (arguments.length === 0) {
|
|
@@ -131,13 +124,10 @@ function math(p5, fn) {
|
|
|
131
124
|
* @return {p5.Matrix} new <a href="#/p5.Matrix">p5.Matrix</a> object.
|
|
132
125
|
*
|
|
133
126
|
* @example
|
|
134
|
-
*
|
|
135
|
-
* <code>
|
|
127
|
+
* // META:norender
|
|
136
128
|
* function setup() {
|
|
137
129
|
* let matrix = createMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
138
130
|
* }
|
|
139
|
-
* </code>
|
|
140
|
-
* </div>
|
|
141
131
|
*/
|
|
142
132
|
fn.createMatrix = function (...args) {
|
|
143
133
|
return new p5.Matrix(...args);
|
package/dist/math/noise.js
CHANGED
|
@@ -73,8 +73,6 @@ function noise(p5, fn){
|
|
|
73
73
|
* @return {Number} Perlin noise value at specified coordinates.
|
|
74
74
|
*
|
|
75
75
|
* @example
|
|
76
|
-
* <div>
|
|
77
|
-
* <code>
|
|
78
76
|
* function setup() {
|
|
79
77
|
* createCanvas(100, 100);
|
|
80
78
|
*
|
|
@@ -92,11 +90,8 @@ function noise(p5, fn){
|
|
|
92
90
|
* strokeWeight(5);
|
|
93
91
|
* point(x, y);
|
|
94
92
|
* }
|
|
95
|
-
* </code>
|
|
96
|
-
* </div>
|
|
97
93
|
*
|
|
98
|
-
*
|
|
99
|
-
* <code>
|
|
94
|
+
* @example
|
|
100
95
|
* function setup() {
|
|
101
96
|
* createCanvas(100, 100);
|
|
102
97
|
*
|
|
@@ -121,11 +116,8 @@ function noise(p5, fn){
|
|
|
121
116
|
* strokeWeight(5);
|
|
122
117
|
* point(x, y);
|
|
123
118
|
* }
|
|
124
|
-
* </code>
|
|
125
|
-
* </div>
|
|
126
119
|
*
|
|
127
|
-
*
|
|
128
|
-
* <code>
|
|
120
|
+
* @example
|
|
129
121
|
* function setup() {
|
|
130
122
|
* createCanvas(100, 100);
|
|
131
123
|
*
|
|
@@ -147,11 +139,8 @@ function noise(p5, fn){
|
|
|
147
139
|
* // Draw the line.
|
|
148
140
|
* line(x, 0, x, y);
|
|
149
141
|
* }
|
|
150
|
-
* </code>
|
|
151
|
-
* </div>
|
|
152
142
|
*
|
|
153
|
-
*
|
|
154
|
-
* <code>
|
|
143
|
+
* @example
|
|
155
144
|
* function setup() {
|
|
156
145
|
* createCanvas(100, 100);
|
|
157
146
|
*
|
|
@@ -178,11 +167,8 @@ function noise(p5, fn){
|
|
|
178
167
|
* line(x, 0, x, y);
|
|
179
168
|
* }
|
|
180
169
|
* }
|
|
181
|
-
* </code>
|
|
182
|
-
* </div>
|
|
183
170
|
*
|
|
184
|
-
*
|
|
185
|
-
* <code>
|
|
171
|
+
* @example
|
|
186
172
|
* function setup() {
|
|
187
173
|
* createCanvas(100, 100);
|
|
188
174
|
*
|
|
@@ -211,11 +197,8 @@ function noise(p5, fn){
|
|
|
211
197
|
*
|
|
212
198
|
* describe('A gray cloudy pattern.');
|
|
213
199
|
* }
|
|
214
|
-
* </code>
|
|
215
|
-
* </div>
|
|
216
200
|
*
|
|
217
|
-
*
|
|
218
|
-
* <code>
|
|
201
|
+
* @example
|
|
219
202
|
* function setup() {
|
|
220
203
|
* createCanvas(100, 100);
|
|
221
204
|
*
|
|
@@ -245,8 +228,6 @@ function noise(p5, fn){
|
|
|
245
228
|
* }
|
|
246
229
|
* }
|
|
247
230
|
* }
|
|
248
|
-
* </code>
|
|
249
|
-
* </div>
|
|
250
231
|
*/
|
|
251
232
|
fn.noise = function(x, y = 0, z = 0) {
|
|
252
233
|
if (perlin == null) {
|
|
@@ -346,8 +327,6 @@ function noise(p5, fn){
|
|
|
346
327
|
* @param {Number} [falloff=0.5] falloff factor for each octave.
|
|
347
328
|
*
|
|
348
329
|
* @example
|
|
349
|
-
* <div>
|
|
350
|
-
* <code>
|
|
351
330
|
* function setup() {
|
|
352
331
|
* createCanvas(100, 100);
|
|
353
332
|
*
|
|
@@ -385,8 +364,6 @@ function noise(p5, fn){
|
|
|
385
364
|
*
|
|
386
365
|
* describe('Two gray cloudy patterns. The pattern on the right is cloudier than the pattern on the left.');
|
|
387
366
|
* }
|
|
388
|
-
* </code>
|
|
389
|
-
* </div>
|
|
390
367
|
*/
|
|
391
368
|
fn.noiseDetail = function(lod, falloff=0.5) {
|
|
392
369
|
if (lod > 0) {
|
|
@@ -425,8 +402,6 @@ function noise(p5, fn){
|
|
|
425
402
|
* @param {Number} seed seed value.
|
|
426
403
|
*
|
|
427
404
|
* @example
|
|
428
|
-
* <div>
|
|
429
|
-
* <code>
|
|
430
405
|
* function setup() {
|
|
431
406
|
* createCanvas(100, 100);
|
|
432
407
|
*
|
|
@@ -452,8 +427,6 @@ function noise(p5, fn){
|
|
|
452
427
|
* // Draw the line.
|
|
453
428
|
* line(x, 0, x, height);
|
|
454
429
|
* }
|
|
455
|
-
* </code>
|
|
456
|
-
* </div>
|
|
457
430
|
*/
|
|
458
431
|
fn.noiseSeed = function(seed) {
|
|
459
432
|
// Linear Congruential Generator
|
package/dist/math/p5.Matrix.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Matrix } from './Matrices/Matrix.js';
|
|
2
2
|
import './p5.Vector.js';
|
|
3
|
-
import '../constants-
|
|
3
|
+
import '../constants-DQyACdzq.js';
|
|
4
4
|
import './Matrices/MatrixInterface.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -72,8 +72,9 @@ function matrix(p5, fn) {
|
|
|
72
72
|
* const vector = new Vector(1, 2, 3);
|
|
73
73
|
* const result = matrix.multiplyPoint(vector);
|
|
74
74
|
*
|
|
75
|
+
* @example
|
|
76
|
+
* // META:norender
|
|
75
77
|
* // p5.js script example
|
|
76
|
-
* <div class="norender"><code>
|
|
77
78
|
* function setup() {
|
|
78
79
|
*
|
|
79
80
|
* // Create a 4x4 identity matrix
|
|
@@ -107,7 +108,6 @@ function matrix(p5, fn) {
|
|
|
107
108
|
* const transformedVector = matrix.multiplyPoint(vector);
|
|
108
109
|
* console.log("Transformed Vector:", transformedVector.toString());
|
|
109
110
|
* }
|
|
110
|
-
* </code></div>
|
|
111
111
|
*/
|
|
112
112
|
p5.Matrix = Matrix;
|
|
113
113
|
}
|