p5 2.2.3-rc.1 → 2.2.3
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/README.md +4 -5
- package/dist/accessibility/color_namer.js +4 -4
- package/dist/accessibility/index.js +4 -4
- package/dist/app.js +4 -4
- package/dist/color/color_conversion.js +4 -4
- package/dist/color/index.js +1 -1
- package/dist/color/setting.js +1 -1
- package/dist/{constants-BUwWryrh.js → constants-BdTiYOQI.js} +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +1 -1
- 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 +4 -4
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +4 -4
- package/dist/core/main.js +4 -4
- package/dist/core/p5.Graphics.js +3 -3
- package/dist/core/p5.Renderer.js +2 -2
- package/dist/core/p5.Renderer2D.js +4 -4
- package/dist/core/p5.Renderer3D.js +3 -3
- package/dist/core/rendering.js +3 -3
- package/dist/data/local_storage.js +13 -9
- package/dist/dom/dom.js +30 -29
- package/dist/dom/index.js +1 -1
- package/dist/dom/p5.Element.js +3 -3
- package/dist/dom/p5.MediaElement.js +4 -5
- package/dist/events/pointer.js +1 -1
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +3 -3
- package/dist/image/image.js +3 -3
- package/dist/image/index.js +3 -3
- package/dist/image/loading_displaying.js +3 -3
- package/dist/image/p5.Image.js +2 -2
- package/dist/io/files.js +3 -3
- package/dist/io/index.js +3 -3
- package/dist/io/p5.XML.js +8 -8
- package/dist/{main-DFpoFdvM.js → main-H_nu4eDs.js} +3 -3
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/index.js +1 -1
- package/dist/math/p5.Matrix.js +1 -1
- package/dist/math/p5.Vector.js +1 -1
- package/dist/math/trigonometry.js +1 -1
- package/dist/{p5.Renderer-D-EuAodU.js → p5.Renderer-BmD2P6Wv.js} +4 -3
- package/dist/{rendering-DE9-Hl7Y.js → rendering-CC8JNTwG.js} +8 -35
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +1 -1
- package/dist/shape/index.js +1 -1
- package/dist/type/index.js +2 -2
- package/dist/type/p5.Font.js +2 -2
- package/dist/type/textCore.js +2 -2
- package/dist/webgl/3d_primitives.js +3 -3
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/enums.js +1 -1
- package/dist/webgl/index.js +3 -3
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +3 -3
- package/dist/webgl/loading.js +4 -6
- package/dist/webgl/material.js +3 -3
- package/dist/webgl/p5.Camera.js +3 -3
- package/dist/webgl/p5.Framebuffer.js +3 -3
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +3 -3
- package/dist/webgl/p5.Texture.js +3 -3
- package/dist/webgl/text.js +3 -3
- package/dist/webgl/utils.js +3 -3
- package/dist/webgpu/index.js +1 -1
- package/dist/webgpu/p5.RendererWebGPU.js +1 -1
- package/lib/p5.esm.js +68 -92
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +68 -92
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +1 -1
- package/lib/p5.webgpu.js +1 -1
- package/lib/p5.webgpu.min.js +1 -1
- package/package.json +1 -1
- package/types/global.d.ts +601 -623
- package/types/p5.d.ts +297 -308
package/lib/p5.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! p5.js v2.2.3
|
|
1
|
+
/*! p5.js v2.2.3 March 21, 2026 */
|
|
2
2
|
/**
|
|
3
3
|
* @module Constants
|
|
4
4
|
* @submodule Constants
|
|
@@ -12,7 +12,7 @@ const _PI = Math.PI;
|
|
|
12
12
|
* @property {String} VERSION
|
|
13
13
|
* @final
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = '2.2.3
|
|
15
|
+
const VERSION = '2.2.3';
|
|
16
16
|
|
|
17
17
|
// GRAPHICS RENDERER
|
|
18
18
|
/**
|
|
@@ -12788,7 +12788,7 @@ class XML {
|
|
|
12788
12788
|
* Returns the element's name as a `String`.
|
|
12789
12789
|
*
|
|
12790
12790
|
* An XML element's name is given by its tag. For example, the element
|
|
12791
|
-
*
|
|
12791
|
+
* `<language>JavaScript</language>` has the name `language`.
|
|
12792
12792
|
*
|
|
12793
12793
|
* @return {String} name of the element.
|
|
12794
12794
|
*
|
|
@@ -12831,11 +12831,11 @@ class XML {
|
|
|
12831
12831
|
* Sets the element's tag name.
|
|
12832
12832
|
*
|
|
12833
12833
|
* An XML element's name is given by its tag. For example, the element
|
|
12834
|
-
*
|
|
12834
|
+
* `<language>JavaScript</language>` has the name `language`.
|
|
12835
12835
|
*
|
|
12836
12836
|
* The parameter, `name`, is the element's new name as a string. For example,
|
|
12837
12837
|
* calling `myXML.setName('planet')` will make the element's new tag name
|
|
12838
|
-
*
|
|
12838
|
+
* `<planet></planet>`.
|
|
12839
12839
|
*
|
|
12840
12840
|
* @param {String} name new tag name of the element.
|
|
12841
12841
|
*
|
|
@@ -12977,7 +12977,7 @@ class XML {
|
|
|
12977
12977
|
*
|
|
12978
12978
|
* The parameter, `name`, is optional. If a string is passed, as in
|
|
12979
12979
|
* `myXML.getChildren('cat')`, then the method will only return child elements
|
|
12980
|
-
* with the tag
|
|
12980
|
+
* with the tag `<cat>`.
|
|
12981
12981
|
*
|
|
12982
12982
|
* @param {String} [name] name of the elements to return.
|
|
12983
12983
|
* @return {p5.XML[]} child elements.
|
|
@@ -13071,7 +13071,7 @@ class XML {
|
|
|
13071
13071
|
*
|
|
13072
13072
|
* The parameter, `name`, is optional. If a string is passed, as in
|
|
13073
13073
|
* `myXML.getChild('cat')`, then the first child element with the tag
|
|
13074
|
-
*
|
|
13074
|
+
* `<cat>` will be returned. If a number is passed, as in
|
|
13075
13075
|
* `myXML.getChild(1)`, then the child element at that index will be returned.
|
|
13076
13076
|
*
|
|
13077
13077
|
* @param {String|Integer} name element name or index.
|
|
@@ -13204,7 +13204,7 @@ class XML {
|
|
|
13204
13204
|
*
|
|
13205
13205
|
* The parameter, `name`, is the child element to remove. If a string is
|
|
13206
13206
|
* passed, as in `myXML.removeChild('cat')`, then the first child element
|
|
13207
|
-
* with the tag
|
|
13207
|
+
* with the tag `<cat>` will be removed. If a number is passed, as in
|
|
13208
13208
|
* `myXML.removeChild(1)`, then the child element at that index will be
|
|
13209
13209
|
* removed.
|
|
13210
13210
|
*
|
|
@@ -13758,7 +13758,7 @@ class XML {
|
|
|
13758
13758
|
* Sets the element's content.
|
|
13759
13759
|
*
|
|
13760
13760
|
* An element's content is the text between its tags. For example, the element
|
|
13761
|
-
*
|
|
13761
|
+
* `<language>JavaScript</language>` has the content `JavaScript`.
|
|
13762
13762
|
*
|
|
13763
13763
|
* The parameter, `content`, is a string with the element's new content.
|
|
13764
13764
|
*
|
|
@@ -13876,7 +13876,7 @@ function xml(p5, fn){
|
|
|
13876
13876
|
* (<a href="https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction" target="_blank">XML</a>)
|
|
13877
13877
|
* is a standard format for sending data between applications. Like HTML, the
|
|
13878
13878
|
* XML format is based on tags and attributes, as in
|
|
13879
|
-
*
|
|
13879
|
+
* `<time units="s">1234</time>`.
|
|
13880
13880
|
*
|
|
13881
13881
|
* Note: Use <a href="#/p5/loadXML">loadXML()</a> to load external XML files.
|
|
13882
13882
|
*
|
|
@@ -14370,9 +14370,9 @@ class Element {
|
|
|
14370
14370
|
/**
|
|
14371
14371
|
* Attaches the element to a parent element.
|
|
14372
14372
|
*
|
|
14373
|
-
* For example, a
|
|
14373
|
+
* For example, a `<div></div>` element may be used as a box to
|
|
14374
14374
|
* hold two pieces of text, a header and a paragraph. The
|
|
14375
|
-
*
|
|
14375
|
+
* `<div></div>` is the parent element of both the header and
|
|
14376
14376
|
* paragraph.
|
|
14377
14377
|
*
|
|
14378
14378
|
* The parameter `parent` can have one of three types. `parent` can be a
|
|
@@ -18943,8 +18943,9 @@ class Image {
|
|
|
18943
18943
|
props.displayIndex = index;
|
|
18944
18944
|
this.drawingContext.putImageData(props.frames[index].image, 0, 0);
|
|
18945
18945
|
} else {
|
|
18946
|
-
|
|
18947
|
-
'Cannot set GIF to a frame number that is higher than total number of frames or below zero.'
|
|
18946
|
+
p5._friendlyError(
|
|
18947
|
+
'Cannot set GIF to a frame number that is higher than total number of frames or below zero.',
|
|
18948
|
+
'setFrame'
|
|
18948
18949
|
);
|
|
18949
18950
|
}
|
|
18950
18951
|
}
|
|
@@ -27690,7 +27691,6 @@ class MediaElement extends Element {
|
|
|
27690
27691
|
removeCue(id) {
|
|
27691
27692
|
for (let i = 0; i < this._cues.length; i++) {
|
|
27692
27693
|
if (this._cues[i].id === id) {
|
|
27693
|
-
console.log(id);
|
|
27694
27694
|
this._cues.splice(i, 1);
|
|
27695
27695
|
}
|
|
27696
27696
|
}
|
|
@@ -27840,7 +27840,7 @@ function media(p5, fn){
|
|
|
27840
27840
|
}
|
|
27841
27841
|
|
|
27842
27842
|
/**
|
|
27843
|
-
* Creates a
|
|
27843
|
+
* Creates a `<video>` element for simple audio/video playback.
|
|
27844
27844
|
*
|
|
27845
27845
|
* `createVideo()` returns a new
|
|
27846
27846
|
* <a href="#/p5.MediaElement">p5.MediaElement</a> object. Videos are shown by
|
|
@@ -27928,7 +27928,7 @@ function media(p5, fn){
|
|
|
27928
27928
|
/* AUDIO STUFF */
|
|
27929
27929
|
|
|
27930
27930
|
/**
|
|
27931
|
-
* Creates a hidden
|
|
27931
|
+
* Creates a hidden `<audio>` element for simple audio playback.
|
|
27932
27932
|
*
|
|
27933
27933
|
* `createAudio()` returns a new
|
|
27934
27934
|
* <a href="#/p5.MediaElement">p5.MediaElement</a> object.
|
|
@@ -28005,7 +28005,7 @@ function media(p5, fn){
|
|
|
28005
28005
|
}
|
|
28006
28006
|
|
|
28007
28007
|
/**
|
|
28008
|
-
* Creates a
|
|
28008
|
+
* Creates a `<video>` element that "captures" the audio/video stream from
|
|
28009
28009
|
* the webcam and microphone.
|
|
28010
28010
|
*
|
|
28011
28011
|
* `createCapture()` returns a new
|
|
@@ -36807,7 +36807,7 @@ function files(p5, fn){
|
|
|
36807
36807
|
* (<a href="https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction" target="_blank">XML</a>)
|
|
36808
36808
|
* is a standard format for sending data between applications. Like HTML, the
|
|
36809
36809
|
* XML format is based on tags and attributes, as in
|
|
36810
|
-
*
|
|
36810
|
+
* `<time units="s">1234</time>`.
|
|
36811
36811
|
*
|
|
36812
36812
|
* The first parameter, `path`, is always a string with the path to the file.
|
|
36813
36813
|
* Paths to local files should be relative, as in
|
|
@@ -55124,11 +55124,6 @@ function primitives3D(p5, fn){
|
|
|
55124
55124
|
* The parameter, `callback`, is a function with the drawing instructions for
|
|
55125
55125
|
* the new <a href="#/p5.Geometry">p5.Geometry</a> object. It will be called
|
|
55126
55126
|
* once to create the new 3D shape.
|
|
55127
|
-
*
|
|
55128
|
-
* See <a href="#/p5/beginGeometry">beginGeometry()</a> and
|
|
55129
|
-
* <a href="#/p5/endGeometry">endGeometry()</a> for another way to build 3D
|
|
55130
|
-
* shapes.
|
|
55131
|
-
*
|
|
55132
55127
|
* Note: `buildGeometry()` can only be used in WebGL mode.
|
|
55133
55128
|
*
|
|
55134
55129
|
* @method buildGeometry
|
|
@@ -55332,12 +55327,8 @@ function primitives3D(p5, fn){
|
|
|
55332
55327
|
* <a href="#/p5.Geometry">p5.Geometry</a> objects can contain lots of data
|
|
55333
55328
|
* about their vertices, surface normals, colors, and so on. Complex 3D shapes
|
|
55334
55329
|
* can use lots of memory which is a limited resource in many GPUs. Calling
|
|
55335
|
-
* `freeGeometry()` can improve performance by freeing a
|
|
55336
|
-
* <a href="#/p5.Geometry">p5.Geometry</a> object’s resources from GPU memory.
|
|
55337
55330
|
* `freeGeometry()` works with <a href="#/p5.Geometry">p5.Geometry</a> objects
|
|
55338
|
-
* created with <a href="#/p5/
|
|
55339
|
-
* <a href="#/p5/endGeometry">endGeometry()</a>,
|
|
55340
|
-
* <a href="#/p5/buildGeometry">buildGeometry()</a>, and
|
|
55331
|
+
* created with <a href="#/p5/buildGeometry">buildGeometry()</a> and
|
|
55341
55332
|
* <a href="#/p5/loadModel">loadModel()</a>.
|
|
55342
55333
|
*
|
|
55343
55334
|
* The parameter, `geometry`, is the <a href="#/p5.Geometry">p5.Geometry</a>
|
|
@@ -55353,24 +55344,6 @@ function primitives3D(p5, fn){
|
|
|
55353
55344
|
* @param {p5.Geometry} geometry 3D shape whose resources should be freed.
|
|
55354
55345
|
*
|
|
55355
55346
|
* @example
|
|
55356
|
-
* function setup() {
|
|
55357
|
-
* createCanvas(100, 100, WEBGL);
|
|
55358
|
-
*
|
|
55359
|
-
* background(200);
|
|
55360
|
-
*
|
|
55361
|
-
* // Create a p5.Geometry object.
|
|
55362
|
-
* beginGeometry();
|
|
55363
|
-
* cone();
|
|
55364
|
-
* let shape = endGeometry();
|
|
55365
|
-
*
|
|
55366
|
-
* // Draw the shape.
|
|
55367
|
-
* model(shape);
|
|
55368
|
-
*
|
|
55369
|
-
* // Free the shape's resources.
|
|
55370
|
-
* freeGeometry(shape);
|
|
55371
|
-
* }
|
|
55372
|
-
*
|
|
55373
|
-
* @example
|
|
55374
55347
|
* // Click and drag the mouse to view the scene from different angles.
|
|
55375
55348
|
*
|
|
55376
55349
|
* let button;
|
|
@@ -65474,7 +65447,7 @@ class Graphics {
|
|
|
65474
65447
|
* Removes the graphics buffer from the web page.
|
|
65475
65448
|
*
|
|
65476
65449
|
* Calling `myGraphics.remove()` removes the graphics buffer's
|
|
65477
|
-
*
|
|
65450
|
+
* `<canvas>` element from the web page. The graphics buffer also uses
|
|
65478
65451
|
* a bit of memory on the CPU that can be freed like so:
|
|
65479
65452
|
*
|
|
65480
65453
|
* ```js
|
|
@@ -65830,7 +65803,7 @@ function graphics(p5, fn){
|
|
|
65830
65803
|
* @param {Number} h height height of the graphics buffer in pixels.
|
|
65831
65804
|
* @param {(P2D|WEBGL|P2DHDR)} renderer the renderer to use, either P2D or WEBGL.
|
|
65832
65805
|
* @param {p5} [pInst] sketch instance.
|
|
65833
|
-
* @param {HTMLCanvasElement} [canvas] existing
|
|
65806
|
+
* @param {HTMLCanvasElement} [canvas] existing `<canvas>` element to use.
|
|
65834
65807
|
*
|
|
65835
65808
|
* @example
|
|
65836
65809
|
* let pg;
|
|
@@ -68809,9 +68782,9 @@ function rendering(p5, fn){
|
|
|
68809
68782
|
|
|
68810
68783
|
/**
|
|
68811
68784
|
* A system variable that provides direct access to the sketch's
|
|
68812
|
-
*
|
|
68785
|
+
* `<canvas>` element.
|
|
68813
68786
|
*
|
|
68814
|
-
* The
|
|
68787
|
+
* The `<canvas>` element provides many specialized features that aren't
|
|
68815
68788
|
* included in the p5.js library. The `drawingContext` system variable
|
|
68816
68789
|
* provides access to these features by exposing the sketch's
|
|
68817
68790
|
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D">CanvasRenderingContext2D</a>
|
|
@@ -97294,18 +97267,20 @@ function storage(p5, fn){
|
|
|
97294
97267
|
*/
|
|
97295
97268
|
fn.storeItem = function(key, value) {
|
|
97296
97269
|
if (typeof key !== 'string') {
|
|
97297
|
-
|
|
97298
|
-
`The argument that you passed to storeItem() - ${key} is not a string
|
|
97270
|
+
p5._friendlyError(
|
|
97271
|
+
`The argument that you passed to storeItem() - ${key} is not a string.`,
|
|
97272
|
+
'storeItem'
|
|
97299
97273
|
);
|
|
97300
97274
|
}
|
|
97301
97275
|
if (key.endsWith('p5TypeID')) {
|
|
97302
|
-
|
|
97303
|
-
`The argument that you passed to storeItem() - ${key} must not end with 'p5TypeID'
|
|
97276
|
+
p5._friendlyError(
|
|
97277
|
+
`The argument that you passed to storeItem() - ${key} must not end with 'p5TypeID'.`,
|
|
97278
|
+
'storeItem'
|
|
97304
97279
|
);
|
|
97305
97280
|
}
|
|
97306
97281
|
|
|
97307
97282
|
if (typeof value === 'undefined') {
|
|
97308
|
-
|
|
97283
|
+
p5._friendlyError('You cannot store undefined variables using storeItem().', 'storeItem');
|
|
97309
97284
|
}
|
|
97310
97285
|
let type = typeof value;
|
|
97311
97286
|
switch (type) {
|
|
@@ -97440,8 +97415,9 @@ function storage(p5, fn){
|
|
|
97440
97415
|
let value = localStorage.getItem(key);
|
|
97441
97416
|
const type = localStorage.getItem(`${key}p5TypeID`);
|
|
97442
97417
|
if (typeof type === 'undefined') {
|
|
97443
|
-
|
|
97444
|
-
`Unable to determine type of item stored under ${key}in local storage. Did you save the item with something other than setItem()
|
|
97418
|
+
p5._friendlyError(
|
|
97419
|
+
`Unable to determine type of item stored under ${key}in local storage. Did you save the item with something other than setItem()?`,
|
|
97420
|
+
'getItem'
|
|
97445
97421
|
);
|
|
97446
97422
|
} else if (value !== null) {
|
|
97447
97423
|
switch (type) {
|
|
@@ -97592,8 +97568,9 @@ function storage(p5, fn){
|
|
|
97592
97568
|
*/
|
|
97593
97569
|
fn.removeItem = function(key) {
|
|
97594
97570
|
if (typeof key !== 'string') {
|
|
97595
|
-
|
|
97596
|
-
`The argument that you passed to removeItem() - ${key} is not a string
|
|
97571
|
+
p5._friendlyError(
|
|
97572
|
+
`The argument that you passed to removeItem() - ${key} is not a string.`,
|
|
97573
|
+
'removeItem'
|
|
97597
97574
|
);
|
|
97598
97575
|
}
|
|
97599
97576
|
localStorage.removeItem(key);
|
|
@@ -97979,16 +97956,16 @@ function dom$1(p5, fn){
|
|
|
97979
97956
|
}
|
|
97980
97957
|
|
|
97981
97958
|
/**
|
|
97982
|
-
* Creates a
|
|
97959
|
+
* Creates a `<div></div>` element.
|
|
97983
97960
|
*
|
|
97984
|
-
*
|
|
97961
|
+
* `<div></div>` elements are commonly used as containers for
|
|
97985
97962
|
* other elements.
|
|
97986
97963
|
*
|
|
97987
97964
|
* The parameter `html` is optional. It accepts a string that sets the
|
|
97988
|
-
* inner HTML of the new
|
|
97965
|
+
* inner HTML of the new `<div></div>`.
|
|
97989
97966
|
*
|
|
97990
97967
|
* @method createDiv
|
|
97991
|
-
* @param {String} [html] inner HTML for the new
|
|
97968
|
+
* @param {String} [html] inner HTML for the new `<div></div>` element.
|
|
97992
97969
|
* @return {p5.Element} new <a href="#/p5.Element">p5.Element</a> object.
|
|
97993
97970
|
*
|
|
97994
97971
|
* @example
|
|
@@ -98026,13 +98003,13 @@ function dom$1(p5, fn){
|
|
|
98026
98003
|
/**
|
|
98027
98004
|
* Creates a paragraph element.
|
|
98028
98005
|
*
|
|
98029
|
-
*
|
|
98006
|
+
* `<p></p>` elements are commonly used for paragraph-length text.
|
|
98030
98007
|
*
|
|
98031
98008
|
* The parameter `html` is optional. It accepts a string that sets the
|
|
98032
|
-
* inner HTML of the new
|
|
98009
|
+
* inner HTML of the new `<p></p>`.
|
|
98033
98010
|
*
|
|
98034
98011
|
* @method createP
|
|
98035
|
-
* @param {String} [html] inner HTML for the new
|
|
98012
|
+
* @param {String} [html] inner HTML for the new `<p></p>` element.
|
|
98036
98013
|
* @return {p5.Element} new <a href="#/p5.Element">p5.Element</a> object.
|
|
98037
98014
|
*
|
|
98038
98015
|
* @example
|
|
@@ -98055,18 +98032,18 @@ function dom$1(p5, fn){
|
|
|
98055
98032
|
};
|
|
98056
98033
|
|
|
98057
98034
|
/**
|
|
98058
|
-
* Creates a
|
|
98035
|
+
* Creates a `<span></span>` element.
|
|
98059
98036
|
*
|
|
98060
|
-
*
|
|
98061
|
-
* for inline elements. For example, a
|
|
98037
|
+
* `<span></span>` elements are commonly used as containers
|
|
98038
|
+
* for inline elements. For example, a `<span></span>`
|
|
98062
98039
|
* can hold part of a sentence that's a
|
|
98063
98040
|
* <span style="color: deeppink;">different</span> style.
|
|
98064
98041
|
*
|
|
98065
98042
|
* The parameter `html` is optional. It accepts a string that sets the
|
|
98066
|
-
* inner HTML of the new
|
|
98043
|
+
* inner HTML of the new `<span></span>`.
|
|
98067
98044
|
*
|
|
98068
98045
|
* @method createSpan
|
|
98069
|
-
* @param {String} [html] inner HTML for the new
|
|
98046
|
+
* @param {String} [html] inner HTML for the new `<span></span>` element.
|
|
98070
98047
|
* @return {p5.Element} new <a href="#/p5.Element">p5.Element</a> object.
|
|
98071
98048
|
*
|
|
98072
98049
|
* @example
|
|
@@ -98119,7 +98096,7 @@ function dom$1(p5, fn){
|
|
|
98119
98096
|
};
|
|
98120
98097
|
|
|
98121
98098
|
/**
|
|
98122
|
-
* Creates an
|
|
98099
|
+
* Creates an `<img>` element that can appear outside of the canvas.
|
|
98123
98100
|
*
|
|
98124
98101
|
* The first parameter, `src`, is a string with the path to the image file.
|
|
98125
98102
|
* `src` should be a relative path, as in `'assets/image.png'`, or a URL, as
|
|
@@ -98190,7 +98167,7 @@ function dom$1(p5, fn){
|
|
|
98190
98167
|
};
|
|
98191
98168
|
|
|
98192
98169
|
/**
|
|
98193
|
-
* Creates an
|
|
98170
|
+
* Creates an `<a></a>` element that links to another web page.
|
|
98194
98171
|
*
|
|
98195
98172
|
* The first parmeter, `href`, is a string that sets the URL of the linked
|
|
98196
98173
|
* page.
|
|
@@ -98247,7 +98224,7 @@ function dom$1(p5, fn){
|
|
|
98247
98224
|
|
|
98248
98225
|
/* INPUT */
|
|
98249
98226
|
/**
|
|
98250
|
-
* Creates a slider
|
|
98227
|
+
* Creates a slider `<input></input>` element.
|
|
98251
98228
|
*
|
|
98252
98229
|
* Range sliders are useful for quickly selecting numbers from a given range.
|
|
98253
98230
|
*
|
|
@@ -98369,7 +98346,7 @@ function dom$1(p5, fn){
|
|
|
98369
98346
|
};
|
|
98370
98347
|
|
|
98371
98348
|
/**
|
|
98372
|
-
* Creates a
|
|
98349
|
+
* Creates a `<button></button>` element.
|
|
98373
98350
|
*
|
|
98374
98351
|
* The first parameter, `label`, is a string that sets the label displayed on
|
|
98375
98352
|
* the button.
|
|
@@ -98446,7 +98423,7 @@ function dom$1(p5, fn){
|
|
|
98446
98423
|
};
|
|
98447
98424
|
|
|
98448
98425
|
/**
|
|
98449
|
-
* Creates a checkbox
|
|
98426
|
+
* Creates a checkbox `<input></input>` element.
|
|
98450
98427
|
*
|
|
98451
98428
|
* Checkboxes extend the <a href="#/p5.Element">p5.Element</a> class with a
|
|
98452
98429
|
* `checked()` method. Calling `myBox.checked()` returns `true` if it the box
|
|
@@ -98587,11 +98564,11 @@ function dom$1(p5, fn){
|
|
|
98587
98564
|
};
|
|
98588
98565
|
|
|
98589
98566
|
/**
|
|
98590
|
-
* Creates a dropdown menu
|
|
98567
|
+
* Creates a dropdown menu `<select></select>` element.
|
|
98591
98568
|
*
|
|
98592
98569
|
* The parameter is optional. If `true` is passed, as in
|
|
98593
98570
|
* `let mySelect = createSelect(true)`, then the dropdown will support
|
|
98594
|
-
* multiple selections. If an existing
|
|
98571
|
+
* multiple selections. If an existing `<select></select>` element
|
|
98595
98572
|
* is passed, as in `let mySelect = createSelect(otherSelect)`, the existing
|
|
98596
98573
|
* element will be wrapped in a new <a href="#/p5.Element">p5.Element</a>
|
|
98597
98574
|
* object.
|
|
@@ -98858,8 +98835,8 @@ function dom$1(p5, fn){
|
|
|
98858
98835
|
*
|
|
98859
98836
|
* The parameter is optional. If a string is passed, as in
|
|
98860
98837
|
* `let myRadio = createSelect('food')`, then each radio option will
|
|
98861
|
-
* have `"food"` as its `name` parameter:
|
|
98862
|
-
* If an existing
|
|
98838
|
+
* have `"food"` as its `name` parameter: `<input name="food"></input>`.
|
|
98839
|
+
* If an existing `<div></div>` or `<span></span>`
|
|
98863
98840
|
* element is passed, as in `let myRadio = createSelect(container)`, it will
|
|
98864
98841
|
* become the radio button's parent element.
|
|
98865
98842
|
*
|
|
@@ -98872,8 +98849,8 @@ function dom$1(p5, fn){
|
|
|
98872
98849
|
* - `myRadio.disable(shouldDisable)` enables the entire radio button if `true` is passed and disables it if `false` is passed.
|
|
98873
98850
|
*
|
|
98874
98851
|
* @method createRadio
|
|
98875
|
-
* @param {Object} [containerElement] container HTML Element, either a
|
|
98876
|
-
* or
|
|
98852
|
+
* @param {Object} [containerElement] container HTML Element, either a `<div></div>`
|
|
98853
|
+
* or `<span></span>`.
|
|
98877
98854
|
* @return {p5.Element} new <a href="#/p5.Element">p5.Element</a> object.
|
|
98878
98855
|
*
|
|
98879
98856
|
* @example
|
|
@@ -98992,7 +98969,7 @@ function dom$1(p5, fn){
|
|
|
98992
98969
|
*/
|
|
98993
98970
|
/**
|
|
98994
98971
|
* @method createRadio
|
|
98995
|
-
* @param {String} [name] name parameter assigned to each option's
|
|
98972
|
+
* @param {String} [name] name parameter assigned to each option's `<input></input>` element.
|
|
98996
98973
|
* @return {p5.Element} new <a href="#/p5.Element">p5.Element</a> object.
|
|
98997
98974
|
*/
|
|
98998
98975
|
/**
|
|
@@ -99259,7 +99236,7 @@ function dom$1(p5, fn){
|
|
|
99259
99236
|
};
|
|
99260
99237
|
|
|
99261
99238
|
/**
|
|
99262
|
-
* Creates a text
|
|
99239
|
+
* Creates a text `<input></input>` element.
|
|
99263
99240
|
*
|
|
99264
99241
|
* Call `myInput.size()` to set the length of the text box.
|
|
99265
99242
|
*
|
|
@@ -99335,7 +99312,7 @@ function dom$1(p5, fn){
|
|
|
99335
99312
|
};
|
|
99336
99313
|
|
|
99337
99314
|
/**
|
|
99338
|
-
* Creates an
|
|
99315
|
+
* Creates an `<input></input>` element of type `'file'`.
|
|
99339
99316
|
*
|
|
99340
99317
|
* `createFileInput()` allows users to select local files for use in a sketch.
|
|
99341
99318
|
* It returns a <a href="#/p5.File">p5.File</a> object.
|
|
@@ -99440,8 +99417,9 @@ function dom$1(p5, fn){
|
|
|
99440
99417
|
|
|
99441
99418
|
// If File API's are not supported, throw Error
|
|
99442
99419
|
if (!(window.File && window.FileReader && window.FileList && window.Blob)) {
|
|
99443
|
-
|
|
99444
|
-
'The File APIs are not fully supported in this browser. Cannot create element.'
|
|
99420
|
+
p5._friendlyError(
|
|
99421
|
+
'The File APIs are not fully supported in this browser. Cannot create element.',
|
|
99422
|
+
'createFileInput'
|
|
99445
99423
|
);
|
|
99446
99424
|
return;
|
|
99447
99425
|
}
|
|
@@ -103140,7 +103118,7 @@ function pointer(p5, fn, lifecycles){
|
|
|
103140
103118
|
canvas.requestPointerLock =
|
|
103141
103119
|
canvas.requestPointerLock || canvas.mozRequestPointerLock;
|
|
103142
103120
|
if (!canvas.requestPointerLock) {
|
|
103143
|
-
|
|
103121
|
+
p5._friendlyError('requestPointerLock is not implemented in this browser', 'requestPointerLock');
|
|
103144
103122
|
return false;
|
|
103145
103123
|
}
|
|
103146
103124
|
canvas.requestPointerLock();
|
|
@@ -110734,9 +110712,7 @@ function loading$1(p5, fn){
|
|
|
110734
110712
|
* The parameter, `model`, is the
|
|
110735
110713
|
* <a href="#/p5.Geometry">p5.Geometry</a> object to draw.
|
|
110736
110714
|
* <a href="#/p5.Geometry">p5.Geometry</a> objects can be built with
|
|
110737
|
-
* <a href="#/p5/buildGeometry">buildGeometry()</a
|
|
110738
|
-
* <a href="#/p5/beginGeometry">beginGeometry()</a> and
|
|
110739
|
-
* <a href="#/p5/endGeometry">endGeometry()</a>. They can also be loaded from
|
|
110715
|
+
* <a href="#/p5/buildGeometry">buildGeometry()</a>. They can also be loaded from
|
|
110740
110716
|
* a file with <a href="#/p5/loadGeometry">loadGeometry()</a>.
|
|
110741
110717
|
*
|
|
110742
110718
|
* Note: `model()` can only be used in WebGL mode.
|