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
|
@@ -40,8 +40,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
40
40
|
* @property {Number} accelerationX
|
|
41
41
|
* @readOnly
|
|
42
42
|
* @example
|
|
43
|
-
* <div>
|
|
44
|
-
* <code>
|
|
45
43
|
* // Move a touchscreen device to register
|
|
46
44
|
* // acceleration changes.
|
|
47
45
|
* function draw() {
|
|
@@ -50,8 +48,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
50
48
|
* ellipse(width / 2, height / 2, accelerationX);
|
|
51
49
|
* describe('Magnitude of device acceleration is displayed as ellipse size.');
|
|
52
50
|
* }
|
|
53
|
-
* </code>
|
|
54
|
-
* </div>
|
|
55
51
|
*/
|
|
56
52
|
fn.accelerationX = 0;
|
|
57
53
|
|
|
@@ -62,8 +58,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
62
58
|
* @property {Number} accelerationY
|
|
63
59
|
* @readOnly
|
|
64
60
|
* @example
|
|
65
|
-
* <div>
|
|
66
|
-
* <code>
|
|
67
61
|
* // Move a touchscreen device to register
|
|
68
62
|
* // acceleration changes.
|
|
69
63
|
* function draw() {
|
|
@@ -72,8 +66,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
72
66
|
* ellipse(width / 2, height / 2, accelerationY);
|
|
73
67
|
* describe('Magnitude of device acceleration is displayed as ellipse size');
|
|
74
68
|
* }
|
|
75
|
-
* </code>
|
|
76
|
-
* </div>
|
|
77
69
|
*/
|
|
78
70
|
fn.accelerationY = 0;
|
|
79
71
|
|
|
@@ -85,8 +77,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
85
77
|
* @readOnly
|
|
86
78
|
*
|
|
87
79
|
* @example
|
|
88
|
-
* <div>
|
|
89
|
-
* <code>
|
|
90
80
|
* // Move a touchscreen device to register
|
|
91
81
|
* // acceleration changes.
|
|
92
82
|
* function draw() {
|
|
@@ -95,8 +85,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
95
85
|
* ellipse(width / 2, height / 2, accelerationZ);
|
|
96
86
|
* describe('Magnitude of device acceleration is displayed as ellipse size');
|
|
97
87
|
* }
|
|
98
|
-
* </code>
|
|
99
|
-
* </div>
|
|
100
88
|
*/
|
|
101
89
|
fn.accelerationZ = 0;
|
|
102
90
|
|
|
@@ -154,8 +142,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
154
142
|
* @property {Number} rotationX
|
|
155
143
|
* @readOnly
|
|
156
144
|
* @example
|
|
157
|
-
* <div>
|
|
158
|
-
* <code>
|
|
159
145
|
* let rotationX = 0; // Angle in degrees
|
|
160
146
|
*
|
|
161
147
|
* function setup() {
|
|
@@ -169,8 +155,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
169
155
|
* box(60); // Draw 3D cube (60 units wide)
|
|
170
156
|
* rotationX = (rotationX + 2) % 360; // Increment rotation (2° per frame)
|
|
171
157
|
* }
|
|
172
|
-
* </code>
|
|
173
|
-
* </div>
|
|
174
158
|
*/
|
|
175
159
|
fn.rotationX = 0;
|
|
176
160
|
|
|
@@ -187,8 +171,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
187
171
|
* @property {Number} rotationY
|
|
188
172
|
* @readOnly
|
|
189
173
|
* @example
|
|
190
|
-
* <div>
|
|
191
|
-
* <code>
|
|
192
174
|
* let rotationY = 0; // Angle in degrees
|
|
193
175
|
*
|
|
194
176
|
* function setup() {
|
|
@@ -202,8 +184,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
202
184
|
* box(60); // Draw 3D cube (60 units wide)
|
|
203
185
|
* rotationY = (rotationY + 2) % 360; // Increment rotation (2° per frame)
|
|
204
186
|
* }
|
|
205
|
-
* </code>
|
|
206
|
-
* </div>
|
|
207
187
|
*/
|
|
208
188
|
fn.rotationY = 0;
|
|
209
189
|
|
|
@@ -221,8 +201,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
221
201
|
* unexpected behaviour.
|
|
222
202
|
*
|
|
223
203
|
* @example
|
|
224
|
-
* <div>
|
|
225
|
-
* <code>
|
|
226
204
|
* let rotationZ = 0; // Angle in degrees
|
|
227
205
|
*
|
|
228
206
|
* function setup() {
|
|
@@ -236,8 +214,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
236
214
|
* box(60); // Draw 3D cube
|
|
237
215
|
* rotationZ = (rotationZ + 2) % 360; // Increment rotation angle
|
|
238
216
|
* }
|
|
239
|
-
* </code>
|
|
240
|
-
* </div>
|
|
241
217
|
*
|
|
242
218
|
* @property {Number} rotationZ
|
|
243
219
|
* @readOnly
|
|
@@ -254,8 +230,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
254
230
|
* pRotationX can also be used with rotationX to determine the rotate
|
|
255
231
|
* direction of the device along the X-axis.
|
|
256
232
|
* @example
|
|
257
|
-
*
|
|
258
|
-
* <code>
|
|
233
|
+
* // META:norender
|
|
259
234
|
* // A simple if statement looking at whether
|
|
260
235
|
* // rotationX - pRotationX < 0 is true or not will be
|
|
261
236
|
* // sufficient for determining the rotate direction
|
|
@@ -280,8 +255,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
280
255
|
*
|
|
281
256
|
* print(rotateDirection);
|
|
282
257
|
* describe('no image to display.');
|
|
283
|
-
* </code>
|
|
284
|
-
* </div>
|
|
285
258
|
*
|
|
286
259
|
* @property {Number} pRotationX
|
|
287
260
|
* @readOnly
|
|
@@ -298,8 +271,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
298
271
|
* pRotationY can also be used with rotationY to determine the rotate
|
|
299
272
|
* direction of the device along the Y-axis.
|
|
300
273
|
* @example
|
|
301
|
-
*
|
|
302
|
-
* <code>
|
|
274
|
+
* // META:norender
|
|
303
275
|
* // A simple if statement looking at whether
|
|
304
276
|
* // rotationY - pRotationY < 0 is true or not will be
|
|
305
277
|
* // sufficient for determining the rotate direction
|
|
@@ -323,8 +295,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
323
295
|
* }
|
|
324
296
|
* print(rotateDirection);
|
|
325
297
|
* describe('no image to display.');
|
|
326
|
-
* </code>
|
|
327
|
-
* </div>
|
|
328
298
|
*
|
|
329
299
|
* @property {Number} pRotationY
|
|
330
300
|
* @readOnly
|
|
@@ -341,8 +311,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
341
311
|
* pRotationZ can also be used with rotationZ to determine the rotate
|
|
342
312
|
* direction of the device along the Z-axis.
|
|
343
313
|
* @example
|
|
344
|
-
*
|
|
345
|
-
* <code>
|
|
314
|
+
* // META:norender
|
|
346
315
|
* // A simple if statement looking at whether
|
|
347
316
|
* // rotationZ - pRotationZ < 0 is true or not will be
|
|
348
317
|
* // sufficient for determining the rotate direction
|
|
@@ -362,8 +331,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
362
331
|
* }
|
|
363
332
|
* print(rotateDirection);
|
|
364
333
|
* describe('no image to display.');
|
|
365
|
-
* </code>
|
|
366
|
-
* </div>
|
|
367
334
|
*
|
|
368
335
|
* @property {Number} pRotationZ
|
|
369
336
|
* @readOnly
|
|
@@ -395,8 +362,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
395
362
|
* @property {String} turnAxis
|
|
396
363
|
* @readOnly
|
|
397
364
|
* @example
|
|
398
|
-
* <div>
|
|
399
|
-
* <code>
|
|
400
365
|
* // Run this example on a mobile device
|
|
401
366
|
* // Rotate the device by 90 degrees in the
|
|
402
367
|
* // X-axis to change the value.
|
|
@@ -419,8 +384,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
419
384
|
* }
|
|
420
385
|
* }
|
|
421
386
|
* }
|
|
422
|
-
* </code>
|
|
423
|
-
* </div>
|
|
424
387
|
*/
|
|
425
388
|
fn.turnAxis = undefined;
|
|
426
389
|
|
|
@@ -434,8 +397,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
434
397
|
* @method setMoveThreshold
|
|
435
398
|
* @param {Number} value The threshold value
|
|
436
399
|
* @example
|
|
437
|
-
*
|
|
438
|
-
* <code>
|
|
400
|
+
* // META:norender
|
|
439
401
|
* // Run this example on a mobile device
|
|
440
402
|
* // You will need to move the device incrementally further
|
|
441
403
|
* // the closer the square's color gets to white in order to change the value.
|
|
@@ -460,8 +422,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
460
422
|
* }
|
|
461
423
|
* setMoveThreshold(threshold);
|
|
462
424
|
* }
|
|
463
|
-
* </code>
|
|
464
|
-
* </div>
|
|
465
425
|
*/
|
|
466
426
|
fn.setMoveThreshold = function (val) {
|
|
467
427
|
move_threshold = val;
|
|
@@ -474,8 +434,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
474
434
|
* @method setShakeThreshold
|
|
475
435
|
* @param {Number} value The threshold value
|
|
476
436
|
* @example
|
|
477
|
-
*
|
|
478
|
-
* <code>
|
|
437
|
+
* // META:norender
|
|
479
438
|
* // Run this example on a mobile device
|
|
480
439
|
* // You will need to shake the device more firmly
|
|
481
440
|
* // the closer the box's fill gets to white in order to change the value.
|
|
@@ -500,8 +459,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
500
459
|
* }
|
|
501
460
|
* setShakeThreshold(threshold);
|
|
502
461
|
* }
|
|
503
|
-
* </code>
|
|
504
|
-
* </div>
|
|
505
462
|
*/
|
|
506
463
|
fn.setShakeThreshold = function (val) {
|
|
507
464
|
shake_threshold = val;
|
|
@@ -514,8 +471,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
514
471
|
*
|
|
515
472
|
* @method deviceMoved
|
|
516
473
|
* @example
|
|
517
|
-
*
|
|
518
|
-
* <code>
|
|
474
|
+
* // META:norender
|
|
519
475
|
* // Run this example on a mobile device
|
|
520
476
|
* // Move the device around
|
|
521
477
|
* // to change the value.
|
|
@@ -533,8 +489,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
533
489
|
* value = 0;
|
|
534
490
|
* }
|
|
535
491
|
* }
|
|
536
|
-
* </code>
|
|
537
|
-
* </div>
|
|
538
492
|
*/
|
|
539
493
|
|
|
540
494
|
/**
|
|
@@ -547,8 +501,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
547
501
|
*
|
|
548
502
|
* @method deviceTurned
|
|
549
503
|
* @example
|
|
550
|
-
*
|
|
551
|
-
* <code>
|
|
504
|
+
* // META:norender
|
|
552
505
|
* // Run this example on a mobile device
|
|
553
506
|
* // Rotate the device by 90 degrees
|
|
554
507
|
* // to change the value.
|
|
@@ -567,10 +520,8 @@ function acceleration(p5, fn, lifecycles){
|
|
|
567
520
|
* value = 0;
|
|
568
521
|
* }
|
|
569
522
|
* }
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
* <div>
|
|
573
|
-
* <code>
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
574
525
|
* // Run this example on a mobile device
|
|
575
526
|
* // Rotate the device by 90 degrees in the
|
|
576
527
|
* // X-axis to change the value.
|
|
@@ -591,8 +542,6 @@ function acceleration(p5, fn, lifecycles){
|
|
|
591
542
|
* }
|
|
592
543
|
* }
|
|
593
544
|
* }
|
|
594
|
-
* </code>
|
|
595
|
-
* </div>
|
|
596
545
|
*/
|
|
597
546
|
|
|
598
547
|
/**
|
|
@@ -603,8 +552,7 @@ function acceleration(p5, fn, lifecycles){
|
|
|
603
552
|
*
|
|
604
553
|
* @method deviceShaken
|
|
605
554
|
* @example
|
|
606
|
-
*
|
|
607
|
-
* <code>
|
|
555
|
+
* // META:norender
|
|
608
556
|
* // Run this example on a mobile device
|
|
609
557
|
* // Shake the device to change the value.
|
|
610
558
|
*
|
|
@@ -615,14 +563,13 @@ function acceleration(p5, fn, lifecycles){
|
|
|
615
563
|
* describe(`50-by-50 black rect in center of canvas.
|
|
616
564
|
* turns white on mobile when device shakes`);
|
|
617
565
|
* }
|
|
566
|
+
*
|
|
618
567
|
* function deviceShaken() {
|
|
619
568
|
* value = value + 5;
|
|
620
569
|
* if (value > 255) {
|
|
621
570
|
* value = 0;
|
|
622
571
|
* }
|
|
623
572
|
* }
|
|
624
|
-
* </code>
|
|
625
|
-
* </div>
|
|
626
573
|
*/
|
|
627
574
|
fn._ondeviceorientation = function (e) {
|
|
628
575
|
this._updatePRotations();
|
package/dist/events/keyboard.js
CHANGED
|
@@ -45,8 +45,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
45
45
|
* @readOnly
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
|
-
* <div>
|
|
49
|
-
* <code>
|
|
50
48
|
* // Click on the canvas to begin detecting key presses.
|
|
51
49
|
*
|
|
52
50
|
* function setup() {
|
|
@@ -70,11 +68,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
70
68
|
* // Draw the square.
|
|
71
69
|
* square(25, 25, 50);
|
|
72
70
|
* }
|
|
73
|
-
* </code>
|
|
74
|
-
* </div>
|
|
75
71
|
*
|
|
76
|
-
*
|
|
77
|
-
* <code>
|
|
72
|
+
* @example
|
|
78
73
|
* // Click on the canvas to begin detecting key presses.
|
|
79
74
|
*
|
|
80
75
|
* function setup() {
|
|
@@ -98,11 +93,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
98
93
|
* // Draw the square.
|
|
99
94
|
* square(25, 25, 50);
|
|
100
95
|
* }
|
|
101
|
-
* </code>
|
|
102
|
-
* </div>
|
|
103
96
|
*
|
|
104
|
-
*
|
|
105
|
-
* <code>
|
|
97
|
+
* @example
|
|
106
98
|
* // Click on the canvas to begin detecting key presses.
|
|
107
99
|
*
|
|
108
100
|
* function setup() {
|
|
@@ -123,8 +115,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
123
115
|
* // Display the value of keyIsPressed.
|
|
124
116
|
* text(keyIsPressed, 50, 50);
|
|
125
117
|
* }
|
|
126
|
-
* </code>
|
|
127
|
-
* </div>
|
|
128
118
|
*/
|
|
129
119
|
fn.keyIsPressed = false;
|
|
130
120
|
|
|
@@ -143,8 +133,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
143
133
|
* @readOnly
|
|
144
134
|
*
|
|
145
135
|
* @example
|
|
146
|
-
* <div>
|
|
147
|
-
* <code>
|
|
148
136
|
* // Click on the canvas to begin detecting key presses.
|
|
149
137
|
*
|
|
150
138
|
* function setup() {
|
|
@@ -165,11 +153,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
165
153
|
* // Display the last key pressed.
|
|
166
154
|
* text(key, 50, 50);
|
|
167
155
|
* }
|
|
168
|
-
* </code>
|
|
169
|
-
* </div>
|
|
170
156
|
*
|
|
171
|
-
*
|
|
172
|
-
* <code>
|
|
157
|
+
* @example
|
|
173
158
|
* // Click on the canvas to begin detecting key presses.
|
|
174
159
|
*
|
|
175
160
|
* let x = 50;
|
|
@@ -205,8 +190,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
205
190
|
* // Draw the circle at (x, y).
|
|
206
191
|
* circle(x, y, 5);
|
|
207
192
|
* }
|
|
208
|
-
* </code>
|
|
209
|
-
* </div>
|
|
210
193
|
*/
|
|
211
194
|
fn.key = '';
|
|
212
195
|
|
|
@@ -295,8 +278,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
295
278
|
* @readOnly
|
|
296
279
|
*
|
|
297
280
|
* @example
|
|
298
|
-
* <div>
|
|
299
|
-
* <code>
|
|
300
281
|
* // Click on the canvas to begin detecting key presses.
|
|
301
282
|
*
|
|
302
283
|
* function setup() {
|
|
@@ -317,11 +298,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
317
298
|
* // Display the last key pressed.
|
|
318
299
|
* text(code, 50, 50);
|
|
319
300
|
* }
|
|
320
|
-
* </code>
|
|
321
|
-
* </div>
|
|
322
|
-
* <div>
|
|
323
|
-
* <code>
|
|
324
301
|
*
|
|
302
|
+
* @example
|
|
325
303
|
* function setup() {
|
|
326
304
|
* createCanvas(100, 100);
|
|
327
305
|
* }
|
|
@@ -344,10 +322,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
344
322
|
* text(keyCode, 7, 25);
|
|
345
323
|
* text(code || " ", 30, 50);
|
|
346
324
|
* }
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* <div>
|
|
350
|
-
* <code>
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
351
327
|
* // Click on the canvas to begin detecting key presses.
|
|
352
328
|
*
|
|
353
329
|
* let x = 50;
|
|
@@ -389,9 +365,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
389
365
|
* // Draw the circle.
|
|
390
366
|
* circle(x, y, 5);
|
|
391
367
|
* }
|
|
392
|
-
*
|
|
393
|
-
* </code>
|
|
394
|
-
* </div>
|
|
395
368
|
*/
|
|
396
369
|
fn.code = '';
|
|
397
370
|
|
|
@@ -432,8 +405,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
432
405
|
* @readOnly
|
|
433
406
|
*
|
|
434
407
|
* @example
|
|
435
|
-
* <div>
|
|
436
|
-
* <code>
|
|
437
408
|
* // Click on the canvas to begin detecting key presses.
|
|
438
409
|
*
|
|
439
410
|
* function setup() {
|
|
@@ -454,11 +425,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
454
425
|
* // Display the last key pressed and its code.
|
|
455
426
|
* text(`${key} : ${keyCode}`, 50, 50);
|
|
456
427
|
* }
|
|
457
|
-
* </code>
|
|
458
|
-
* </div>
|
|
459
428
|
*
|
|
460
|
-
*
|
|
461
|
-
* <code>
|
|
429
|
+
* @example
|
|
462
430
|
* // Click on the canvas to begin detecting key presses.
|
|
463
431
|
*
|
|
464
432
|
* let x = 50;
|
|
@@ -494,8 +462,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
494
462
|
* // Draw the circle at (x, y).
|
|
495
463
|
* circle(x, y, 5);
|
|
496
464
|
* }
|
|
497
|
-
* </code>
|
|
498
|
-
* </div>
|
|
499
465
|
*/
|
|
500
466
|
fn.keyCode = 0;
|
|
501
467
|
|
|
@@ -547,8 +513,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
547
513
|
* @param {KeyboardEvent} [event] optional `KeyboardEvent` callback argument.
|
|
548
514
|
*
|
|
549
515
|
* @example
|
|
550
|
-
* <div>
|
|
551
|
-
* <code>
|
|
552
516
|
* // Click on the canvas to begin detecting key presses.
|
|
553
517
|
*
|
|
554
518
|
* let value = 0;
|
|
@@ -581,11 +545,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
581
545
|
* // Uncomment to prevent any default behavior.
|
|
582
546
|
* // return false;
|
|
583
547
|
* }
|
|
584
|
-
* </code>
|
|
585
|
-
* </div>
|
|
586
548
|
*
|
|
587
|
-
*
|
|
588
|
-
* <code>
|
|
549
|
+
* @example
|
|
589
550
|
* // Click on the canvas to begin detecting key presses.
|
|
590
551
|
*
|
|
591
552
|
* let value = 0;
|
|
@@ -618,11 +579,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
618
579
|
* // Uncomment to prevent any default behavior.
|
|
619
580
|
* // return false;
|
|
620
581
|
* }
|
|
621
|
-
* </code>
|
|
622
|
-
* </div>
|
|
623
582
|
*
|
|
624
|
-
*
|
|
625
|
-
* <code>
|
|
583
|
+
* @example
|
|
626
584
|
* // Click on the canvas to begin detecting key presses.
|
|
627
585
|
*
|
|
628
586
|
* let value = 0;
|
|
@@ -655,8 +613,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
655
613
|
* // Uncomment to prevent any default behavior.
|
|
656
614
|
* // return false;
|
|
657
615
|
* }
|
|
658
|
-
* </code>
|
|
659
|
-
* </div>
|
|
660
616
|
*/
|
|
661
617
|
fn._onkeydown = function(e) {
|
|
662
618
|
if (this._downKeys[e.code]) {
|
|
@@ -725,8 +681,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
725
681
|
* @param {KeyboardEvent} [event] optional `KeyboardEvent` callback argument.
|
|
726
682
|
*
|
|
727
683
|
* @example
|
|
728
|
-
* <div>
|
|
729
|
-
* <code>
|
|
730
684
|
* // Click on the canvas to begin detecting key presses.
|
|
731
685
|
*
|
|
732
686
|
* let value = 0;
|
|
@@ -759,11 +713,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
759
713
|
* // Uncomment to prevent any default behavior.
|
|
760
714
|
* // return false;
|
|
761
715
|
* }
|
|
762
|
-
* </code>
|
|
763
|
-
* </div>
|
|
764
716
|
*
|
|
765
|
-
*
|
|
766
|
-
* <code>
|
|
717
|
+
* @example
|
|
767
718
|
* // Click on the canvas to begin detecting key presses.
|
|
768
719
|
*
|
|
769
720
|
* let value = 0;
|
|
@@ -794,11 +745,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
794
745
|
* // Uncomment to prevent any default behavior.
|
|
795
746
|
* // return false;
|
|
796
747
|
* }
|
|
797
|
-
* </code>
|
|
798
|
-
* </div>
|
|
799
748
|
*
|
|
800
|
-
*
|
|
801
|
-
* <code>
|
|
749
|
+
* @example
|
|
802
750
|
* // Click on the canvas to begin detecting key presses.
|
|
803
751
|
*
|
|
804
752
|
* let value = 0;
|
|
@@ -831,8 +779,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
831
779
|
* // Uncomment to prevent any default behavior.
|
|
832
780
|
* // return false;
|
|
833
781
|
* }
|
|
834
|
-
* </code>
|
|
835
|
-
* </div>
|
|
836
782
|
*/
|
|
837
783
|
fn._onkeyup = function(e) {
|
|
838
784
|
if (typeof this._customActions.keyReleased === 'function') {
|
|
@@ -915,8 +861,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
915
861
|
* @param {KeyboardEvent} [event] optional `KeyboardEvent` callback argument.
|
|
916
862
|
*
|
|
917
863
|
* @example
|
|
918
|
-
* <div>
|
|
919
|
-
* <code>
|
|
920
864
|
* // Click on the canvas to begin detecting key presses.
|
|
921
865
|
* // Note: Pressing special keys such as SPACE have no effect.
|
|
922
866
|
*
|
|
@@ -950,11 +894,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
950
894
|
* // Uncomment to prevent any default behavior.
|
|
951
895
|
* // return false;
|
|
952
896
|
* }
|
|
953
|
-
* </code>
|
|
954
|
-
* </div>
|
|
955
897
|
*
|
|
956
|
-
*
|
|
957
|
-
* <code>
|
|
898
|
+
* @example
|
|
958
899
|
* // Click on the canvas to begin detecting key presses.
|
|
959
900
|
*
|
|
960
901
|
* let value = 0;
|
|
@@ -987,8 +928,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
987
928
|
* // Uncomment to prevent any default behavior.
|
|
988
929
|
* // return false;
|
|
989
930
|
* }
|
|
990
|
-
* </code>
|
|
991
|
-
* </div>
|
|
992
931
|
*/
|
|
993
932
|
fn._onkeypress = function(e) {
|
|
994
933
|
if (e.which === this._lastKeyCodeTyped && e.repeat) {
|
|
@@ -1045,8 +984,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
1045
984
|
* @return {Boolean} whether the key is down or not.
|
|
1046
985
|
*
|
|
1047
986
|
* @example
|
|
1048
|
-
* <div>
|
|
1049
|
-
* <code>
|
|
1050
987
|
* // Click on the canvas to begin detecting key presses.
|
|
1051
988
|
*
|
|
1052
989
|
* let x = 50;
|
|
@@ -1086,11 +1023,8 @@ function keyboard(p5, fn, lifecycles){
|
|
|
1086
1023
|
* // Draw the circle.
|
|
1087
1024
|
* circle(x, y, 5);
|
|
1088
1025
|
* }
|
|
1089
|
-
* </code>
|
|
1090
|
-
* </div>
|
|
1091
1026
|
*
|
|
1092
|
-
*
|
|
1093
|
-
* <code>
|
|
1027
|
+
* @example
|
|
1094
1028
|
* // Click on the canvas to begin detecting key presses.
|
|
1095
1029
|
*
|
|
1096
1030
|
* let x = 50;
|
|
@@ -1130,8 +1064,6 @@ function keyboard(p5, fn, lifecycles){
|
|
|
1130
1064
|
* // Draw the circle.
|
|
1131
1065
|
* circle(x, y, 5);
|
|
1132
1066
|
* }
|
|
1133
|
-
* </code>
|
|
1134
|
-
* </div>
|
|
1135
1067
|
*/
|
|
1136
1068
|
fn.keyIsDown = function(input) {
|
|
1137
1069
|
if (isCode(input)) {
|