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/dom/p5.File.js
CHANGED
|
@@ -72,8 +72,6 @@ function file(p5, fn){
|
|
|
72
72
|
* @param {File} file wrapped file.
|
|
73
73
|
*
|
|
74
74
|
* @example
|
|
75
|
-
* <div>
|
|
76
|
-
* <code>
|
|
77
75
|
* // Use the file input to load a
|
|
78
76
|
* // file and display its info.
|
|
79
77
|
*
|
|
@@ -103,11 +101,8 @@ function file(p5, fn){
|
|
|
103
101
|
* // Display the p5.File's size in bytes.
|
|
104
102
|
* text(file.size, 10, 90);
|
|
105
103
|
* }
|
|
106
|
-
* </code>
|
|
107
|
-
* </div>
|
|
108
104
|
*
|
|
109
|
-
*
|
|
110
|
-
* <code>
|
|
105
|
+
* @example
|
|
111
106
|
* // Use the file input to select an image to
|
|
112
107
|
* // load and display.
|
|
113
108
|
* let img;
|
|
@@ -145,8 +140,6 @@ function file(p5, fn){
|
|
|
145
140
|
* img = null;
|
|
146
141
|
* }
|
|
147
142
|
* }
|
|
148
|
-
* </code>
|
|
149
|
-
* </div>
|
|
150
143
|
*/
|
|
151
144
|
p5.File = File;
|
|
152
145
|
|
|
@@ -158,8 +151,6 @@ function file(p5, fn){
|
|
|
158
151
|
* @for p5.File
|
|
159
152
|
* @property {File} file
|
|
160
153
|
* @example
|
|
161
|
-
* <div>
|
|
162
|
-
* <code>
|
|
163
154
|
* // Use the file input to load a
|
|
164
155
|
* // file and display its info.
|
|
165
156
|
*
|
|
@@ -189,8 +180,6 @@ function file(p5, fn){
|
|
|
189
180
|
* // Display the p5.File's size in bytes.
|
|
190
181
|
* text(file.size, 10, 90);
|
|
191
182
|
* }
|
|
192
|
-
* </code>
|
|
193
|
-
* </div>
|
|
194
183
|
*/
|
|
195
184
|
|
|
196
185
|
/**
|
|
@@ -203,8 +192,6 @@ function file(p5, fn){
|
|
|
203
192
|
* @for p5.File
|
|
204
193
|
* @property {String} type
|
|
205
194
|
* @example
|
|
206
|
-
* <div>
|
|
207
|
-
* <code>
|
|
208
195
|
* // Use the file input to load a file and display its info.
|
|
209
196
|
*
|
|
210
197
|
* function setup() {
|
|
@@ -227,8 +214,6 @@ function file(p5, fn){
|
|
|
227
214
|
* // Display the p5.File's type.
|
|
228
215
|
* text(`This is file's type is: ${file.type}`, 10, 10, 80, 80);
|
|
229
216
|
* }
|
|
230
|
-
* </code>
|
|
231
|
-
* </div>
|
|
232
217
|
*/
|
|
233
218
|
|
|
234
219
|
/**
|
|
@@ -242,8 +227,6 @@ function file(p5, fn){
|
|
|
242
227
|
* @for p5.File
|
|
243
228
|
*
|
|
244
229
|
* @example
|
|
245
|
-
* <div>
|
|
246
|
-
* <code>
|
|
247
230
|
* // Use the file input to load a
|
|
248
231
|
* // file and display its info.
|
|
249
232
|
*
|
|
@@ -267,8 +250,6 @@ function file(p5, fn){
|
|
|
267
250
|
* // Display the p5.File's subtype.
|
|
268
251
|
* text(`This is file's subtype is: ${file.subtype}`, 10, 10, 80, 80);
|
|
269
252
|
* }
|
|
270
|
-
* </code>
|
|
271
|
-
* </div>
|
|
272
253
|
*/
|
|
273
254
|
|
|
274
255
|
/**
|
|
@@ -278,8 +259,6 @@ function file(p5, fn){
|
|
|
278
259
|
* @for p5.File
|
|
279
260
|
*
|
|
280
261
|
* @example
|
|
281
|
-
* <div>
|
|
282
|
-
* <code>
|
|
283
262
|
* // Use the file input to load a
|
|
284
263
|
* // file and display its info.
|
|
285
264
|
*
|
|
@@ -303,8 +282,6 @@ function file(p5, fn){
|
|
|
303
282
|
* // Display the p5.File's name.
|
|
304
283
|
* text(`This is file's name is: ${file.name}`, 10, 10, 80, 80);
|
|
305
284
|
* }
|
|
306
|
-
* </code>
|
|
307
|
-
* </div>
|
|
308
285
|
*/
|
|
309
286
|
|
|
310
287
|
/**
|
|
@@ -314,8 +291,6 @@ function file(p5, fn){
|
|
|
314
291
|
* @for p5.File
|
|
315
292
|
*
|
|
316
293
|
* @example
|
|
317
|
-
* <div>
|
|
318
|
-
* <code>
|
|
319
294
|
* // Use the file input to load a file and display its info.
|
|
320
295
|
*
|
|
321
296
|
* function setup() {
|
|
@@ -338,8 +313,6 @@ function file(p5, fn){
|
|
|
338
313
|
* // Display the p5.File's size.
|
|
339
314
|
* text(`This is file has ${file.size} bytes.`, 10, 10, 80, 80);
|
|
340
315
|
* }
|
|
341
|
-
* </code>
|
|
342
|
-
* </div>
|
|
343
316
|
*/
|
|
344
317
|
|
|
345
318
|
/**
|
|
@@ -352,8 +325,6 @@ function file(p5, fn){
|
|
|
352
325
|
* @for p5.File
|
|
353
326
|
*
|
|
354
327
|
* @example
|
|
355
|
-
* <div>
|
|
356
|
-
* <code>
|
|
357
328
|
* // Use the file input to load a file and display its info.
|
|
358
329
|
*
|
|
359
330
|
* function setup() {
|
|
@@ -376,8 +347,6 @@ function file(p5, fn){
|
|
|
376
347
|
* // Display the p5.File's data, which looks like a random string of characters.
|
|
377
348
|
* text(file.data, 10, 10, 80, 80);
|
|
378
349
|
* }
|
|
379
|
-
* </code>
|
|
380
|
-
* </div>
|
|
381
350
|
*/
|
|
382
351
|
}
|
|
383
352
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Element } from './p5.Element.js';
|
|
2
2
|
import './p5.File.js';
|
|
3
3
|
import '../io/p5.XML.js';
|
|
4
|
-
import '../creating_reading-
|
|
4
|
+
import '../creating_reading-ZXzcZEsb.js';
|
|
5
5
|
import 'colorjs.io/fn';
|
|
6
6
|
import '../color/color_spaces/hsb.js';
|
|
7
|
-
import '../constants-
|
|
7
|
+
import '../constants-DQyACdzq.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @module DOM
|
|
@@ -91,8 +91,6 @@ class MediaElement extends Element {
|
|
|
91
91
|
* @chainable
|
|
92
92
|
*
|
|
93
93
|
* @example
|
|
94
|
-
* <div>
|
|
95
|
-
* <code>
|
|
96
94
|
* let beat;
|
|
97
95
|
*
|
|
98
96
|
* function setup() {
|
|
@@ -117,8 +115,6 @@ class MediaElement extends Element {
|
|
|
117
115
|
* function mousePressed() {
|
|
118
116
|
* beat.play();
|
|
119
117
|
* }
|
|
120
|
-
* </code>
|
|
121
|
-
* </div>
|
|
122
118
|
*/
|
|
123
119
|
play() {
|
|
124
120
|
if (this.elt.currentTime === this.elt.duration) {
|
|
@@ -158,8 +154,6 @@ class MediaElement extends Element {
|
|
|
158
154
|
* @chainable
|
|
159
155
|
*
|
|
160
156
|
* @example
|
|
161
|
-
* <div>
|
|
162
|
-
* <code>
|
|
163
157
|
* let beat;
|
|
164
158
|
* let isStopped = true;
|
|
165
159
|
*
|
|
@@ -199,8 +193,6 @@ class MediaElement extends Element {
|
|
|
199
193
|
* isStopped = true;
|
|
200
194
|
* }
|
|
201
195
|
* }
|
|
202
|
-
* </code>
|
|
203
|
-
* </div>
|
|
204
196
|
*/
|
|
205
197
|
stop() {
|
|
206
198
|
this.elt.pause();
|
|
@@ -216,8 +208,6 @@ class MediaElement extends Element {
|
|
|
216
208
|
* @chainable
|
|
217
209
|
*
|
|
218
210
|
* @example
|
|
219
|
-
* <div>
|
|
220
|
-
* <code>
|
|
221
211
|
* let beat;
|
|
222
212
|
* let isPaused = true;
|
|
223
213
|
*
|
|
@@ -259,8 +249,6 @@ class MediaElement extends Element {
|
|
|
259
249
|
* isPaused = true;
|
|
260
250
|
* }
|
|
261
251
|
* }
|
|
262
|
-
* </code>
|
|
263
|
-
* </div>
|
|
264
252
|
*/
|
|
265
253
|
pause() {
|
|
266
254
|
this.elt.pause();
|
|
@@ -273,8 +261,6 @@ class MediaElement extends Element {
|
|
|
273
261
|
* @chainable
|
|
274
262
|
*
|
|
275
263
|
* @example
|
|
276
|
-
* <div>
|
|
277
|
-
* <code>
|
|
278
264
|
* let beat;
|
|
279
265
|
* let isLooping = false;
|
|
280
266
|
*
|
|
@@ -316,8 +302,6 @@ class MediaElement extends Element {
|
|
|
316
302
|
* isLooping = true;
|
|
317
303
|
* }
|
|
318
304
|
* }
|
|
319
|
-
* </code>
|
|
320
|
-
* </div>
|
|
321
305
|
*/
|
|
322
306
|
loop() {
|
|
323
307
|
this.elt.setAttribute('loop', true);
|
|
@@ -332,8 +316,6 @@ class MediaElement extends Element {
|
|
|
332
316
|
* @chainable
|
|
333
317
|
*
|
|
334
318
|
* @example
|
|
335
|
-
* <div>
|
|
336
|
-
* <code>
|
|
337
319
|
* let beat;
|
|
338
320
|
* let isPlaying = false;
|
|
339
321
|
*
|
|
@@ -375,8 +357,6 @@ class MediaElement extends Element {
|
|
|
375
357
|
* isPlaying = true;
|
|
376
358
|
* }
|
|
377
359
|
* }
|
|
378
|
-
* </code>
|
|
379
|
-
* </div>
|
|
380
360
|
*/
|
|
381
361
|
noLoop() {
|
|
382
362
|
this.elt.removeAttribute('loop');
|
|
@@ -415,8 +395,6 @@ class MediaElement extends Element {
|
|
|
415
395
|
* @chainable
|
|
416
396
|
*
|
|
417
397
|
* @example
|
|
418
|
-
* <div class='notest'>
|
|
419
|
-
* <code>
|
|
420
398
|
* let video;
|
|
421
399
|
*
|
|
422
400
|
* function setup() {
|
|
@@ -433,11 +411,8 @@ class MediaElement extends Element {
|
|
|
433
411
|
* video.size(100, 100);
|
|
434
412
|
* video.autoplay();
|
|
435
413
|
* }
|
|
436
|
-
* </code>
|
|
437
|
-
* </div>
|
|
438
414
|
*
|
|
439
|
-
*
|
|
440
|
-
* <code>
|
|
415
|
+
* @example
|
|
441
416
|
* function setup() {
|
|
442
417
|
* noCanvas();
|
|
443
418
|
*
|
|
@@ -449,8 +424,6 @@ class MediaElement extends Element {
|
|
|
449
424
|
*
|
|
450
425
|
* describe('An image of fingers on a treadmill. They start walking when the user double-clicks on them.');
|
|
451
426
|
* }
|
|
452
|
-
* </code>
|
|
453
|
-
* </div>
|
|
454
427
|
*
|
|
455
428
|
* // Set the video's size and playback mode.
|
|
456
429
|
* function handleVideo() {
|
|
@@ -499,8 +472,6 @@ class MediaElement extends Element {
|
|
|
499
472
|
* @return {Number} current volume.
|
|
500
473
|
*
|
|
501
474
|
* @example
|
|
502
|
-
* <div>
|
|
503
|
-
* <code>
|
|
504
475
|
* let dragon;
|
|
505
476
|
*
|
|
506
477
|
* function setup() {
|
|
@@ -537,8 +508,6 @@ class MediaElement extends Element {
|
|
|
537
508
|
* // Display the volume.
|
|
538
509
|
* text(`Volume: ${v}`, 50, 50);
|
|
539
510
|
* }
|
|
540
|
-
* </code>
|
|
541
|
-
* </div>
|
|
542
511
|
*/
|
|
543
512
|
/**
|
|
544
513
|
* @param {Number} val volume between 0.0 and 1.0.
|
|
@@ -568,8 +537,6 @@ class MediaElement extends Element {
|
|
|
568
537
|
* @return {Number} current playback speed.
|
|
569
538
|
*
|
|
570
539
|
* @example
|
|
571
|
-
* <div>
|
|
572
|
-
* <code>
|
|
573
540
|
* let dragon;
|
|
574
541
|
*
|
|
575
542
|
* function setup() {
|
|
@@ -606,7 +573,6 @@ class MediaElement extends Element {
|
|
|
606
573
|
* // Display the speed.
|
|
607
574
|
* text(`Speed: ${s}`, 50, 50);
|
|
608
575
|
* }
|
|
609
|
-
* </code>
|
|
610
576
|
*/
|
|
611
577
|
/**
|
|
612
578
|
* @param {Number} speed speed multiplier for playback.
|
|
@@ -639,8 +605,6 @@ class MediaElement extends Element {
|
|
|
639
605
|
* @return {Number} current time (in seconds).
|
|
640
606
|
*
|
|
641
607
|
* @example
|
|
642
|
-
* <div>
|
|
643
|
-
* <code>
|
|
644
608
|
* let dragon;
|
|
645
609
|
*
|
|
646
610
|
* function setup() {
|
|
@@ -671,11 +635,8 @@ class MediaElement extends Element {
|
|
|
671
635
|
* // Display the playback time.
|
|
672
636
|
* text(`${s} seconds`, 50, 50);
|
|
673
637
|
* }
|
|
674
|
-
* </code>
|
|
675
|
-
* </div>
|
|
676
638
|
*
|
|
677
|
-
*
|
|
678
|
-
* <code>
|
|
639
|
+
* @example
|
|
679
640
|
* let dragon;
|
|
680
641
|
*
|
|
681
642
|
* function setup() {
|
|
@@ -709,8 +670,6 @@ class MediaElement extends Element {
|
|
|
709
670
|
* // Display the playback time.
|
|
710
671
|
* text(`${s} seconds`, 50, 50);
|
|
711
672
|
* }
|
|
712
|
-
* </code>
|
|
713
|
-
* </div>
|
|
714
673
|
*/
|
|
715
674
|
time(val) {
|
|
716
675
|
if (typeof val !== 'undefined') {
|
|
@@ -725,8 +684,6 @@ class MediaElement extends Element {
|
|
|
725
684
|
* @return {Number} duration (in seconds).
|
|
726
685
|
*
|
|
727
686
|
* @example
|
|
728
|
-
* <div>
|
|
729
|
-
* <code>
|
|
730
687
|
* let dragon;
|
|
731
688
|
*
|
|
732
689
|
* function setup() {
|
|
@@ -759,8 +716,6 @@ class MediaElement extends Element {
|
|
|
759
716
|
* // Display the time remaining.
|
|
760
717
|
* text(`${s} seconds left`, 50, 50);
|
|
761
718
|
* }
|
|
762
|
-
* </code>
|
|
763
|
-
* </div>
|
|
764
719
|
*/
|
|
765
720
|
duration() {
|
|
766
721
|
return this.elt.duration;
|
|
@@ -885,8 +840,6 @@ class MediaElement extends Element {
|
|
|
885
840
|
* @chainable
|
|
886
841
|
*
|
|
887
842
|
* @example
|
|
888
|
-
* <div>
|
|
889
|
-
* <code>
|
|
890
843
|
* let beat;
|
|
891
844
|
* let isPlaying = false;
|
|
892
845
|
* let isDone = false;
|
|
@@ -932,8 +885,6 @@ class MediaElement extends Element {
|
|
|
932
885
|
* function handleEnd() {
|
|
933
886
|
* isDone = false;
|
|
934
887
|
* }
|
|
935
|
-
* </code>
|
|
936
|
-
* </div>
|
|
937
888
|
*/
|
|
938
889
|
onended(callback) {
|
|
939
890
|
this._onended = callback;
|
|
@@ -1026,8 +977,6 @@ class MediaElement extends Element {
|
|
|
1026
977
|
* Note: The controls vary between web browsers.
|
|
1027
978
|
*
|
|
1028
979
|
* @example
|
|
1029
|
-
* <div>
|
|
1030
|
-
* <code>
|
|
1031
980
|
* function setup() {
|
|
1032
981
|
* createCanvas(100, 100);
|
|
1033
982
|
*
|
|
@@ -1048,8 +997,6 @@ class MediaElement extends Element {
|
|
|
1048
997
|
*
|
|
1049
998
|
* describe('A dragon emoji, 🐉, drawn in the center of a blue square. A song plays in the background. Audio controls are displayed beneath the canvas.');
|
|
1050
999
|
* }
|
|
1051
|
-
* </code>
|
|
1052
|
-
* </div>
|
|
1053
1000
|
*/
|
|
1054
1001
|
showControls() {
|
|
1055
1002
|
// must set style for the element to show on the page
|
|
@@ -1063,8 +1010,6 @@ class MediaElement extends Element {
|
|
|
1063
1010
|
* controls.
|
|
1064
1011
|
*
|
|
1065
1012
|
* @example
|
|
1066
|
-
* <div>
|
|
1067
|
-
* <code>
|
|
1068
1013
|
* let dragon;
|
|
1069
1014
|
* let isHidden = false;
|
|
1070
1015
|
*
|
|
@@ -1104,8 +1049,6 @@ class MediaElement extends Element {
|
|
|
1104
1049
|
* isHidden = true;
|
|
1105
1050
|
* }
|
|
1106
1051
|
* }
|
|
1107
|
-
* </code>
|
|
1108
|
-
* </div>
|
|
1109
1052
|
*/
|
|
1110
1053
|
hideControls() {
|
|
1111
1054
|
this.elt.controls = false;
|
|
@@ -1135,8 +1078,6 @@ class MediaElement extends Element {
|
|
|
1135
1078
|
* useful for `media.removeCue(id)`.
|
|
1136
1079
|
*
|
|
1137
1080
|
* @example
|
|
1138
|
-
* <div>
|
|
1139
|
-
* <code>
|
|
1140
1081
|
* function setup() {
|
|
1141
1082
|
* createCanvas(100, 100);
|
|
1142
1083
|
*
|
|
@@ -1159,8 +1100,6 @@ class MediaElement extends Element {
|
|
|
1159
1100
|
* function changeBackground(c) {
|
|
1160
1101
|
* background(c);
|
|
1161
1102
|
* }
|
|
1162
|
-
* </code>
|
|
1163
|
-
* </div>
|
|
1164
1103
|
*/
|
|
1165
1104
|
addCue(time, callback, val) {
|
|
1166
1105
|
const id = this._cueIDCounter++;
|
|
@@ -1181,8 +1120,6 @@ class MediaElement extends Element {
|
|
|
1181
1120
|
* @param {Number} id ID of the cue, created by `media.addCue()`.
|
|
1182
1121
|
*
|
|
1183
1122
|
* @example
|
|
1184
|
-
* <div>
|
|
1185
|
-
* <code>
|
|
1186
1123
|
* let lavenderID;
|
|
1187
1124
|
* let isRemoved = false;
|
|
1188
1125
|
*
|
|
@@ -1229,8 +1166,6 @@ class MediaElement extends Element {
|
|
|
1229
1166
|
* isRemoved = true;
|
|
1230
1167
|
* }
|
|
1231
1168
|
* }
|
|
1232
|
-
* </code>
|
|
1233
|
-
* </div>
|
|
1234
1169
|
*/
|
|
1235
1170
|
removeCue(id) {
|
|
1236
1171
|
for (let i = 0; i < this._cues.length; i++) {
|
|
@@ -1249,8 +1184,6 @@ class MediaElement extends Element {
|
|
|
1249
1184
|
* Removes all functions scheduled with `media.addCue()`.
|
|
1250
1185
|
*
|
|
1251
1186
|
* @example
|
|
1252
|
-
* <div>
|
|
1253
|
-
* <code>
|
|
1254
1187
|
* let isChanging = true;
|
|
1255
1188
|
*
|
|
1256
1189
|
* function setup() {
|
|
@@ -1297,8 +1230,6 @@ class MediaElement extends Element {
|
|
|
1297
1230
|
* isChanging = false;
|
|
1298
1231
|
* }
|
|
1299
1232
|
* }
|
|
1300
|
-
* </code>
|
|
1301
|
-
* </div>
|
|
1302
1233
|
*/
|
|
1303
1234
|
clearCues() {
|
|
1304
1235
|
this._cues = [];
|
|
@@ -1415,8 +1346,6 @@ function media(p5, fn){
|
|
|
1415
1346
|
* @return {p5.MediaElement} new <a href="#/p5.MediaElement">p5.MediaElement</a> object.
|
|
1416
1347
|
*
|
|
1417
1348
|
* @example
|
|
1418
|
-
* <div class='notest'>
|
|
1419
|
-
* <code>
|
|
1420
1349
|
* function setup() {
|
|
1421
1350
|
* noCanvas();
|
|
1422
1351
|
*
|
|
@@ -1429,11 +1358,8 @@ function media(p5, fn){
|
|
|
1429
1358
|
*
|
|
1430
1359
|
* describe('A video of a toy robot with playback controls beneath it.');
|
|
1431
1360
|
* }
|
|
1432
|
-
* </code>
|
|
1433
|
-
* </div>
|
|
1434
1361
|
*
|
|
1435
|
-
*
|
|
1436
|
-
* <code>
|
|
1362
|
+
* @example
|
|
1437
1363
|
* function setup() {
|
|
1438
1364
|
* noCanvas();
|
|
1439
1365
|
*
|
|
@@ -1448,11 +1374,8 @@ function media(p5, fn){
|
|
|
1448
1374
|
*
|
|
1449
1375
|
* describe('A video of a toy robot with playback controls beneath it.');
|
|
1450
1376
|
* }
|
|
1451
|
-
* </code>
|
|
1452
|
-
* </div>
|
|
1453
1377
|
*
|
|
1454
|
-
*
|
|
1455
|
-
* <code>
|
|
1378
|
+
* @example
|
|
1456
1379
|
* let video;
|
|
1457
1380
|
*
|
|
1458
1381
|
* function setup() {
|
|
@@ -1476,8 +1399,6 @@ function media(p5, fn){
|
|
|
1476
1399
|
* function muteVideo() {
|
|
1477
1400
|
* video.volume(0);
|
|
1478
1401
|
* }
|
|
1479
|
-
* </code>
|
|
1480
|
-
* </div>
|
|
1481
1402
|
*/
|
|
1482
1403
|
fn.createVideo = function (src, callback) {
|
|
1483
1404
|
// p5._validateParameters('createVideo', arguments);
|
|
@@ -1511,8 +1432,6 @@ function media(p5, fn){
|
|
|
1511
1432
|
* @return {p5.MediaElement} new <a href="#/p5.MediaElement">p5.MediaElement</a> object.
|
|
1512
1433
|
*
|
|
1513
1434
|
* @example
|
|
1514
|
-
* <div class='notest'>
|
|
1515
|
-
* <code>
|
|
1516
1435
|
* function setup() {
|
|
1517
1436
|
* noCanvas();
|
|
1518
1437
|
*
|
|
@@ -1524,8 +1443,6 @@ function media(p5, fn){
|
|
|
1524
1443
|
*
|
|
1525
1444
|
* describe('An audio beat plays when the user double-clicks the square.');
|
|
1526
1445
|
* }
|
|
1527
|
-
* </code>
|
|
1528
|
-
* </div>
|
|
1529
1446
|
*/
|
|
1530
1447
|
fn.createAudio = function (src, callback) {
|
|
1531
1448
|
// p5._validateParameters('createAudio', arguments);
|
|
@@ -1609,8 +1526,6 @@ function media(p5, fn){
|
|
|
1609
1526
|
* @return {p5.MediaElement} new <a href="#/p5.MediaElement">p5.MediaElement</a> object.
|
|
1610
1527
|
*
|
|
1611
1528
|
* @example
|
|
1612
|
-
* <div class='notest'>
|
|
1613
|
-
* <code>
|
|
1614
1529
|
* function setup() {
|
|
1615
1530
|
* noCanvas();
|
|
1616
1531
|
*
|
|
@@ -1619,11 +1534,8 @@ function media(p5, fn){
|
|
|
1619
1534
|
*
|
|
1620
1535
|
* describe('A video stream from the webcam.');
|
|
1621
1536
|
* }
|
|
1622
|
-
* </code>
|
|
1623
|
-
* </div>
|
|
1624
1537
|
*
|
|
1625
|
-
*
|
|
1626
|
-
* <code>
|
|
1538
|
+
* @example
|
|
1627
1539
|
* let capture;
|
|
1628
1540
|
*
|
|
1629
1541
|
* function setup() {
|
|
@@ -1643,10 +1555,8 @@ function media(p5, fn){
|
|
|
1643
1555
|
* // Invert the colors in the stream.
|
|
1644
1556
|
* filter(INVERT);
|
|
1645
1557
|
* }
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
1648
|
-
* <div class='notest'>
|
|
1649
|
-
* <code>
|
|
1558
|
+
*
|
|
1559
|
+
* @example
|
|
1650
1560
|
* let capture;
|
|
1651
1561
|
*
|
|
1652
1562
|
* function setup() {
|
|
@@ -1659,11 +1569,8 @@ function media(p5, fn){
|
|
|
1659
1569
|
* describe('A video stream from the webcam with flipped or mirrored output.');
|
|
1660
1570
|
* }
|
|
1661
1571
|
*
|
|
1662
|
-
* </code>
|
|
1663
|
-
* </div>
|
|
1664
1572
|
*
|
|
1665
|
-
*
|
|
1666
|
-
* <code>
|
|
1573
|
+
* @example
|
|
1667
1574
|
* function setup() {
|
|
1668
1575
|
* createCanvas(480, 120);
|
|
1669
1576
|
*
|
|
@@ -1684,8 +1591,6 @@ function media(p5, fn){
|
|
|
1684
1591
|
*
|
|
1685
1592
|
* describe('A video stream from the webcam.');
|
|
1686
1593
|
* }
|
|
1687
|
-
* </code>
|
|
1688
|
-
* </div>
|
|
1689
1594
|
*/
|
|
1690
1595
|
fn.createCapture = function (...args) {
|
|
1691
1596
|
// p5._validateParameters('createCapture', args);
|
|
@@ -1782,8 +1687,6 @@ function media(p5, fn){
|
|
|
1782
1687
|
* @extends p5.Element
|
|
1783
1688
|
*
|
|
1784
1689
|
* @example
|
|
1785
|
-
* <div class='notest'>
|
|
1786
|
-
* <code>
|
|
1787
1690
|
* let capture;
|
|
1788
1691
|
*
|
|
1789
1692
|
* function setup() {
|
|
@@ -1801,8 +1704,6 @@ function media(p5, fn){
|
|
|
1801
1704
|
* image(capture, 0, 0, width, width * capture.height / capture.width);
|
|
1802
1705
|
* filter(INVERT);
|
|
1803
1706
|
* }
|
|
1804
|
-
* </code>
|
|
1805
|
-
* </div>
|
|
1806
1707
|
*/
|
|
1807
1708
|
p5.MediaElement = MediaElement;
|
|
1808
1709
|
|
|
@@ -1826,8 +1727,6 @@ function media(p5, fn){
|
|
|
1826
1727
|
* @property src
|
|
1827
1728
|
* @return {String} src
|
|
1828
1729
|
* @example
|
|
1829
|
-
* <div>
|
|
1830
|
-
* <code>
|
|
1831
1730
|
* let beat;
|
|
1832
1731
|
*
|
|
1833
1732
|
* function setup() {
|
|
@@ -1845,8 +1744,6 @@ function media(p5, fn){
|
|
|
1845
1744
|
* textWrap(CHAR);
|
|
1846
1745
|
* text(beat.src, 10, 10, 80, 80);
|
|
1847
1746
|
* }
|
|
1848
|
-
* </code>
|
|
1849
|
-
* </div>
|
|
1850
1747
|
*/
|
|
1851
1748
|
}
|
|
1852
1749
|
|