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/types/p5.d.ts
CHANGED
|
@@ -1137,9 +1137,9 @@ declare const __BOTTOM: typeof BOTTOM;
|
|
|
1137
1137
|
|
|
1138
1138
|
/**
|
|
1139
1139
|
* A system variable that provides direct access to the sketch's
|
|
1140
|
-
*
|
|
1140
|
+
* `<canvas>` element.
|
|
1141
1141
|
*
|
|
1142
|
-
* The
|
|
1142
|
+
* The `<canvas>` element provides many specialized features that aren't
|
|
1143
1143
|
* included in the p5.js library. The `drawingContext` system variable
|
|
1144
1144
|
* provides access to these features by exposing the sketch's
|
|
1145
1145
|
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D">CanvasRenderingContext2D</a>
|
|
@@ -3325,6 +3325,26 @@ declare class p5 {
|
|
|
3325
3325
|
byte(n: string | boolean | number): number;
|
|
3326
3326
|
byte(ns: any[]): number[];
|
|
3327
3327
|
|
|
3328
|
+
/**
|
|
3329
|
+
* Creates a custom <a href="#/p5.Geometry">p5.Geometry</a> object from
|
|
3330
|
+
* simpler 3D shapes.
|
|
3331
|
+
*
|
|
3332
|
+
* `buildGeometry()` helps with creating complex 3D shapes from simpler ones
|
|
3333
|
+
* such as <a href="#/p5/sphere">sphere()</a>. It can help to make sketches
|
|
3334
|
+
* more performant. For example, if a complex 3D shape doesn’t change while a
|
|
3335
|
+
* sketch runs, then it can be created with `buildGeometry()`. Creating a
|
|
3336
|
+
* <a href="#/p5.Geometry">p5.Geometry</a> object once and then drawing it
|
|
3337
|
+
* will run faster than repeatedly drawing the individual pieces.
|
|
3338
|
+
*
|
|
3339
|
+
* The parameter, `callback`, is a function with the drawing instructions for
|
|
3340
|
+
* the new <a href="#/p5.Geometry">p5.Geometry</a> object. It will be called
|
|
3341
|
+
* once to create the new 3D shape.
|
|
3342
|
+
* Note: `buildGeometry()` can only be used in WebGL mode.
|
|
3343
|
+
* @param callback function that draws the shape.
|
|
3344
|
+
* @returns new 3D shape.
|
|
3345
|
+
*/
|
|
3346
|
+
buildGeometry(callback: Function): p5.Geometry;
|
|
3347
|
+
|
|
3328
3348
|
/**
|
|
3329
3349
|
* Calculates coordinates along a Bézier curve using interpolation.
|
|
3330
3350
|
*
|
|
@@ -3355,31 +3375,6 @@ declare class p5 {
|
|
|
3355
3375
|
*/
|
|
3356
3376
|
bezierPoint(a: number, b: number, c: number, d: number, t: number): number;
|
|
3357
3377
|
|
|
3358
|
-
/**
|
|
3359
|
-
* Creates a custom <a href="#/p5.Geometry">p5.Geometry</a> object from
|
|
3360
|
-
* simpler 3D shapes.
|
|
3361
|
-
*
|
|
3362
|
-
* `buildGeometry()` helps with creating complex 3D shapes from simpler ones
|
|
3363
|
-
* such as <a href="#/p5/sphere">sphere()</a>. It can help to make sketches
|
|
3364
|
-
* more performant. For example, if a complex 3D shape doesn’t change while a
|
|
3365
|
-
* sketch runs, then it can be created with `buildGeometry()`. Creating a
|
|
3366
|
-
* <a href="#/p5.Geometry">p5.Geometry</a> object once and then drawing it
|
|
3367
|
-
* will run faster than repeatedly drawing the individual pieces.
|
|
3368
|
-
*
|
|
3369
|
-
* The parameter, `callback`, is a function with the drawing instructions for
|
|
3370
|
-
* the new <a href="#/p5.Geometry">p5.Geometry</a> object. It will be called
|
|
3371
|
-
* once to create the new 3D shape.
|
|
3372
|
-
*
|
|
3373
|
-
* See <a href="#/p5/beginGeometry">beginGeometry()</a> and
|
|
3374
|
-
* <a href="#/p5/endGeometry">endGeometry()</a> for another way to build 3D
|
|
3375
|
-
* shapes.
|
|
3376
|
-
*
|
|
3377
|
-
* Note: `buildGeometry()` can only be used in WebGL mode.
|
|
3378
|
-
* @param callback function that draws the shape.
|
|
3379
|
-
* @returns new 3D shape.
|
|
3380
|
-
*/
|
|
3381
|
-
buildGeometry(callback: Function): p5.Geometry;
|
|
3382
|
-
|
|
3383
3378
|
/**
|
|
3384
3379
|
* Loads a 3D model to create a
|
|
3385
3380
|
* <a href="#/p5.Geometry">p5.Geometry</a> object.
|
|
@@ -3539,20 +3534,6 @@ declare class p5 {
|
|
|
3539
3534
|
*/
|
|
3540
3535
|
smooth(): void;
|
|
3541
3536
|
|
|
3542
|
-
/**
|
|
3543
|
-
* Removes all items in the web browser's local storage.
|
|
3544
|
-
*
|
|
3545
|
-
* Web browsers can save small amounts of data using the built-in
|
|
3546
|
-
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage" target="_blank">localStorage object</a>.
|
|
3547
|
-
* Data stored in `localStorage` can be retrieved at any point, even after
|
|
3548
|
-
* refreshing a page or restarting the browser. Data are stored as key-value
|
|
3549
|
-
* pairs. Calling `clearStorage()` removes all data from `localStorage`.
|
|
3550
|
-
*
|
|
3551
|
-
* Note: Sensitive data such as passwords or personal information shouldn't be
|
|
3552
|
-
* stored in `localStorage`.
|
|
3553
|
-
*/
|
|
3554
|
-
clearStorage(): void;
|
|
3555
|
-
|
|
3556
3537
|
/**
|
|
3557
3538
|
* Converts a `Number` into a `String` with a plus or minus sign.
|
|
3558
3539
|
*
|
|
@@ -3588,6 +3569,20 @@ declare class p5 {
|
|
|
3588
3569
|
nfp(num: number, left?: number, right?: number): string;
|
|
3589
3570
|
nfp(nums: number[], left?: number, right?: number): string[];
|
|
3590
3571
|
|
|
3572
|
+
/**
|
|
3573
|
+
* Removes all items in the web browser's local storage.
|
|
3574
|
+
*
|
|
3575
|
+
* Web browsers can save small amounts of data using the built-in
|
|
3576
|
+
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage" target="_blank">localStorage object</a>.
|
|
3577
|
+
* Data stored in `localStorage` can be retrieved at any point, even after
|
|
3578
|
+
* refreshing a page or restarting the browser. Data are stored as key-value
|
|
3579
|
+
* pairs. Calling `clearStorage()` removes all data from `localStorage`.
|
|
3580
|
+
*
|
|
3581
|
+
* Note: Sensitive data such as passwords or personal information shouldn't be
|
|
3582
|
+
* stored in `localStorage`.
|
|
3583
|
+
*/
|
|
3584
|
+
clearStorage(): void;
|
|
3585
|
+
|
|
3591
3586
|
/**
|
|
3592
3587
|
* Removes all elements created by p5.js, including any event handlers.
|
|
3593
3588
|
*
|
|
@@ -3830,6 +3825,29 @@ declare class p5 {
|
|
|
3830
3825
|
frameRate(fps: number): number;
|
|
3831
3826
|
frameRate(): number;
|
|
3832
3827
|
|
|
3828
|
+
/**
|
|
3829
|
+
* Clears a <a href="#/p5.Geometry">p5.Geometry</a> object from the graphics
|
|
3830
|
+
* processing unit (GPU) memory.
|
|
3831
|
+
*
|
|
3832
|
+
* <a href="#/p5.Geometry">p5.Geometry</a> objects can contain lots of data
|
|
3833
|
+
* about their vertices, surface normals, colors, and so on. Complex 3D shapes
|
|
3834
|
+
* can use lots of memory which is a limited resource in many GPUs. Calling
|
|
3835
|
+
* `freeGeometry()` works with <a href="#/p5.Geometry">p5.Geometry</a> objects
|
|
3836
|
+
* created with <a href="#/p5/buildGeometry">buildGeometry()</a> and
|
|
3837
|
+
* <a href="#/p5/loadModel">loadModel()</a>.
|
|
3838
|
+
*
|
|
3839
|
+
* The parameter, `geometry`, is the <a href="#/p5.Geometry">p5.Geometry</a>
|
|
3840
|
+
* object to be freed.
|
|
3841
|
+
*
|
|
3842
|
+
* Note: A <a href="#/p5.Geometry">p5.Geometry</a> object can still be drawn
|
|
3843
|
+
* after its resources are cleared from GPU memory. It may take longer to draw
|
|
3844
|
+
* the first time it’s redrawn.
|
|
3845
|
+
*
|
|
3846
|
+
* Note: `freeGeometry()` can only be used in WebGL mode.
|
|
3847
|
+
* @param geometry 3D shape whose resources should be freed.
|
|
3848
|
+
*/
|
|
3849
|
+
freeGeometry(geometry: p5.Geometry): void;
|
|
3850
|
+
|
|
3833
3851
|
/**
|
|
3834
3852
|
* Calculates the cosine of an angle.
|
|
3835
3853
|
*
|
|
@@ -3892,14 +3910,14 @@ declare class p5 {
|
|
|
3892
3910
|
specularColor(color: p5.Color): void;
|
|
3893
3911
|
|
|
3894
3912
|
/**
|
|
3895
|
-
* Creates a
|
|
3913
|
+
* Creates a `<div></div>` element.
|
|
3896
3914
|
*
|
|
3897
|
-
*
|
|
3915
|
+
* `<div></div>` elements are commonly used as containers for
|
|
3898
3916
|
* other elements.
|
|
3899
3917
|
*
|
|
3900
3918
|
* The parameter `html` is optional. It accepts a string that sets the
|
|
3901
|
-
* inner HTML of the new
|
|
3902
|
-
* @param html inner HTML for the new
|
|
3919
|
+
* inner HTML of the new `<div></div>`.
|
|
3920
|
+
* @param html inner HTML for the new `<div></div>` element.
|
|
3903
3921
|
* @returns new <a href="#/p5.Element">p5.Element</a> object.
|
|
3904
3922
|
*/
|
|
3905
3923
|
createDiv(html?: string): p5.Element;
|
|
@@ -3957,27 +3975,6 @@ declare class p5 {
|
|
|
3957
3975
|
boolean(n: string | boolean | number): boolean;
|
|
3958
3976
|
boolean(ns: any[]): boolean[];
|
|
3959
3977
|
|
|
3960
|
-
/**
|
|
3961
|
-
* Removes an item from the web browser's local storage.
|
|
3962
|
-
*
|
|
3963
|
-
* Web browsers can save small amounts of data using the built-in
|
|
3964
|
-
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage" target="_blank">localStorage object</a>.
|
|
3965
|
-
* Data stored in `localStorage` can be retrieved at any point, even after
|
|
3966
|
-
* refreshing a page or restarting the browser. Data are stored as key-value
|
|
3967
|
-
* pairs.
|
|
3968
|
-
*
|
|
3969
|
-
* <a href="#/p5/storeItem">storeItem()</a> makes it easy to store values in
|
|
3970
|
-
* `localStorage` and `removeItem()` makes it easy to delete them.
|
|
3971
|
-
*
|
|
3972
|
-
* The parameter, `key`, is the name of the value to remove as a string. For
|
|
3973
|
-
* example, calling `removeItem('size')` removes the item with the key `size`.
|
|
3974
|
-
*
|
|
3975
|
-
* Note: Sensitive data such as passwords or personal information shouldn't be
|
|
3976
|
-
* stored in `localStorage`.
|
|
3977
|
-
* @param key name of the value to remove.
|
|
3978
|
-
*/
|
|
3979
|
-
removeItem(key: string): void;
|
|
3980
|
-
|
|
3981
3978
|
/**
|
|
3982
3979
|
* Rotates the coordinate system.
|
|
3983
3980
|
*
|
|
@@ -4013,31 +4010,25 @@ declare class p5 {
|
|
|
4013
4010
|
rotate(angle: number, axis?: p5.Vector | number[]): void;
|
|
4014
4011
|
|
|
4015
4012
|
/**
|
|
4016
|
-
*
|
|
4017
|
-
* processing unit (GPU) memory.
|
|
4013
|
+
* Removes an item from the web browser's local storage.
|
|
4018
4014
|
*
|
|
4019
|
-
*
|
|
4020
|
-
*
|
|
4021
|
-
*
|
|
4022
|
-
*
|
|
4023
|
-
*
|
|
4024
|
-
* `freeGeometry()` works with <a href="#/p5.Geometry">p5.Geometry</a> objects
|
|
4025
|
-
* created with <a href="#/p5/beginGeometry">beginGeometry()</a> and
|
|
4026
|
-
* <a href="#/p5/endGeometry">endGeometry()</a>,
|
|
4027
|
-
* <a href="#/p5/buildGeometry">buildGeometry()</a>, and
|
|
4028
|
-
* <a href="#/p5/loadModel">loadModel()</a>.
|
|
4015
|
+
* Web browsers can save small amounts of data using the built-in
|
|
4016
|
+
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage" target="_blank">localStorage object</a>.
|
|
4017
|
+
* Data stored in `localStorage` can be retrieved at any point, even after
|
|
4018
|
+
* refreshing a page or restarting the browser. Data are stored as key-value
|
|
4019
|
+
* pairs.
|
|
4029
4020
|
*
|
|
4030
|
-
*
|
|
4031
|
-
*
|
|
4021
|
+
* <a href="#/p5/storeItem">storeItem()</a> makes it easy to store values in
|
|
4022
|
+
* `localStorage` and `removeItem()` makes it easy to delete them.
|
|
4032
4023
|
*
|
|
4033
|
-
*
|
|
4034
|
-
*
|
|
4035
|
-
* the first time it’s redrawn.
|
|
4024
|
+
* The parameter, `key`, is the name of the value to remove as a string. For
|
|
4025
|
+
* example, calling `removeItem('size')` removes the item with the key `size`.
|
|
4036
4026
|
*
|
|
4037
|
-
* Note:
|
|
4038
|
-
*
|
|
4027
|
+
* Note: Sensitive data such as passwords or personal information shouldn't be
|
|
4028
|
+
* stored in `localStorage`.
|
|
4029
|
+
* @param key name of the value to remove.
|
|
4039
4030
|
*/
|
|
4040
|
-
|
|
4031
|
+
removeItem(key: string): void;
|
|
4041
4032
|
|
|
4042
4033
|
/**
|
|
4043
4034
|
* The <a href="#/p5/setMoveThreshold">setMoveThreshold()</a> function is used to set the movement threshold for
|
|
@@ -4127,11 +4118,11 @@ declare class p5 {
|
|
|
4127
4118
|
/**
|
|
4128
4119
|
* Creates a paragraph element.
|
|
4129
4120
|
*
|
|
4130
|
-
*
|
|
4121
|
+
* `<p></p>` elements are commonly used for paragraph-length text.
|
|
4131
4122
|
*
|
|
4132
4123
|
* The parameter `html` is optional. It accepts a string that sets the
|
|
4133
|
-
* inner HTML of the new
|
|
4134
|
-
* @param html inner HTML for the new
|
|
4124
|
+
* inner HTML of the new `<p></p>`.
|
|
4125
|
+
* @param html inner HTML for the new `<p></p>` element.
|
|
4135
4126
|
* @returns new <a href="#/p5.Element">p5.Element</a> object.
|
|
4136
4127
|
*/
|
|
4137
4128
|
createP(html?: string): p5.Element;
|
|
@@ -4565,6 +4556,38 @@ declare class p5 {
|
|
|
4565
4556
|
*/
|
|
4566
4557
|
loadTable(filename: string | Request, separator?: string, header?: string, callback?: Function, errorCallback?: Function): Promise<object>;
|
|
4567
4558
|
|
|
4559
|
+
/**
|
|
4560
|
+
* Draws a plane.
|
|
4561
|
+
*
|
|
4562
|
+
* A plane is a four-sided, flat shape with every angle measuring 90˚. It’s
|
|
4563
|
+
* similar to a rectangle and offers advanced drawing features in WebGL mode.
|
|
4564
|
+
*
|
|
4565
|
+
* The first parameter, `width`, is optional. If a `Number` is passed, as in
|
|
4566
|
+
* `plane(20)`, it sets the plane’s width and height. By default, `width` is
|
|
4567
|
+
* 50.
|
|
4568
|
+
*
|
|
4569
|
+
* The second parameter, `height`, is also optional. If a `Number` is passed,
|
|
4570
|
+
* as in `plane(20, 30)`, it sets the plane’s height. By default, `height` is
|
|
4571
|
+
* set to the plane’s `width`.
|
|
4572
|
+
*
|
|
4573
|
+
* The third parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
4574
|
+
* as in `plane(20, 30, 5)` it sets the number of triangle subdivisions to use
|
|
4575
|
+
* along the x-axis. All 3D shapes are made by connecting triangles to form
|
|
4576
|
+
* their surfaces. By default, `detailX` is 1.
|
|
4577
|
+
*
|
|
4578
|
+
* The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
|
|
4579
|
+
* as in `plane(20, 30, 5, 7)` it sets the number of triangle subdivisions to
|
|
4580
|
+
* use along the y-axis. All 3D shapes are made by connecting triangles to
|
|
4581
|
+
* form their surfaces. By default, `detailY` is 1.
|
|
4582
|
+
*
|
|
4583
|
+
* Note: `plane()` can only be used in WebGL mode.
|
|
4584
|
+
* @param width width of the plane.
|
|
4585
|
+
* @param height height of the plane.
|
|
4586
|
+
* @param detailX number of triangle subdivisions along the x-axis.
|
|
4587
|
+
* @param detailY number of triangle subdivisions along the y-axis.
|
|
4588
|
+
*/
|
|
4589
|
+
plane(width?: number, height?: number, detailX?: number, detailY?: number): void;
|
|
4590
|
+
|
|
4568
4591
|
/**
|
|
4569
4592
|
* Gets the red value of a color.
|
|
4570
4593
|
*
|
|
@@ -4650,16 +4673,16 @@ declare class p5 {
|
|
|
4650
4673
|
tan(angle: number): number;
|
|
4651
4674
|
|
|
4652
4675
|
/**
|
|
4653
|
-
* Creates a
|
|
4676
|
+
* Creates a `<span></span>` element.
|
|
4654
4677
|
*
|
|
4655
|
-
*
|
|
4656
|
-
* for inline elements. For example, a
|
|
4678
|
+
* `<span></span>` elements are commonly used as containers
|
|
4679
|
+
* for inline elements. For example, a `<span></span>`
|
|
4657
4680
|
* can hold part of a sentence that's a
|
|
4658
4681
|
* <span style="color: deeppink;">different</span> style.
|
|
4659
4682
|
*
|
|
4660
4683
|
* The parameter `html` is optional. It accepts a string that sets the
|
|
4661
|
-
* inner HTML of the new
|
|
4662
|
-
* @param html inner HTML for the new
|
|
4684
|
+
* inner HTML of the new `<span></span>`.
|
|
4685
|
+
* @param html inner HTML for the new `<span></span>` element.
|
|
4663
4686
|
* @returns new <a href="#/p5.Element">p5.Element</a> object.
|
|
4664
4687
|
*/
|
|
4665
4688
|
createSpan(html?: string): p5.Element;
|
|
@@ -4712,38 +4735,6 @@ declare class p5 {
|
|
|
4712
4735
|
*/
|
|
4713
4736
|
loadFilterShader(filename: string, successCallback?: Function, failureCallback?: Function): Promise<p5.Shader>;
|
|
4714
4737
|
|
|
4715
|
-
/**
|
|
4716
|
-
* Draws a plane.
|
|
4717
|
-
*
|
|
4718
|
-
* A plane is a four-sided, flat shape with every angle measuring 90˚. It’s
|
|
4719
|
-
* similar to a rectangle and offers advanced drawing features in WebGL mode.
|
|
4720
|
-
*
|
|
4721
|
-
* The first parameter, `width`, is optional. If a `Number` is passed, as in
|
|
4722
|
-
* `plane(20)`, it sets the plane’s width and height. By default, `width` is
|
|
4723
|
-
* 50.
|
|
4724
|
-
*
|
|
4725
|
-
* The second parameter, `height`, is also optional. If a `Number` is passed,
|
|
4726
|
-
* as in `plane(20, 30)`, it sets the plane’s height. By default, `height` is
|
|
4727
|
-
* set to the plane’s `width`.
|
|
4728
|
-
*
|
|
4729
|
-
* The third parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
4730
|
-
* as in `plane(20, 30, 5)` it sets the number of triangle subdivisions to use
|
|
4731
|
-
* along the x-axis. All 3D shapes are made by connecting triangles to form
|
|
4732
|
-
* their surfaces. By default, `detailX` is 1.
|
|
4733
|
-
*
|
|
4734
|
-
* The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
|
|
4735
|
-
* as in `plane(20, 30, 5, 7)` it sets the number of triangle subdivisions to
|
|
4736
|
-
* use along the y-axis. All 3D shapes are made by connecting triangles to
|
|
4737
|
-
* form their surfaces. By default, `detailY` is 1.
|
|
4738
|
-
*
|
|
4739
|
-
* Note: `plane()` can only be used in WebGL mode.
|
|
4740
|
-
* @param width width of the plane.
|
|
4741
|
-
* @param height height of the plane.
|
|
4742
|
-
* @param detailX number of triangle subdivisions along the x-axis.
|
|
4743
|
-
* @param detailY number of triangle subdivisions along the y-axis.
|
|
4744
|
-
*/
|
|
4745
|
-
plane(width?: number, height?: number, detailX?: number, detailY?: number): void;
|
|
4746
|
-
|
|
4747
4738
|
/**
|
|
4748
4739
|
* Creates and a new <a href="#/p5.Framebuffer">p5.Framebuffer</a> object.
|
|
4749
4740
|
*
|
|
@@ -4853,7 +4844,7 @@ declare class p5 {
|
|
|
4853
4844
|
map(value: number, start1: number, stop1: number, start2: number, stop2: number, withinBounds?: boolean): number;
|
|
4854
4845
|
|
|
4855
4846
|
/**
|
|
4856
|
-
* Creates an
|
|
4847
|
+
* Creates an `<img>` element that can appear outside of the canvas.
|
|
4857
4848
|
*
|
|
4858
4849
|
* The first parameter, `src`, is a string with the path to the image file.
|
|
4859
4850
|
* `src` should be a relative path, as in `'assets/image.png'`, or a URL, as
|
|
@@ -5111,6 +5102,42 @@ declare class p5 {
|
|
|
5111
5102
|
*/
|
|
5112
5103
|
green(color: p5.Color | number[] | string): number;
|
|
5113
5104
|
|
|
5105
|
+
/**
|
|
5106
|
+
* Draws a box (rectangular prism).
|
|
5107
|
+
*
|
|
5108
|
+
* A box is a 3D shape with six faces. Each face makes a 90˚ with four
|
|
5109
|
+
* neighboring faces.
|
|
5110
|
+
*
|
|
5111
|
+
* The first parameter, `width`, is optional. If a `Number` is passed, as in
|
|
5112
|
+
* `box(20)`, it sets the box’s width and height. By default, `width` is 50.
|
|
5113
|
+
*
|
|
5114
|
+
* The second parameter, `height`, is also optional. If a `Number` is passed,
|
|
5115
|
+
* as in `box(20, 30)`, it sets the box’s height. By default, `height` is set
|
|
5116
|
+
* to the box’s `width`.
|
|
5117
|
+
*
|
|
5118
|
+
* The third parameter, `depth`, is also optional. If a `Number` is passed, as
|
|
5119
|
+
* in `box(20, 30, 40)`, it sets the box’s depth. By default, `depth` is set
|
|
5120
|
+
* to the box’s `height`.
|
|
5121
|
+
*
|
|
5122
|
+
* The fourth parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
5123
|
+
* as in `box(20, 30, 40, 5)`, it sets the number of triangle subdivisions to
|
|
5124
|
+
* use along the x-axis. All 3D shapes are made by connecting triangles to
|
|
5125
|
+
* form their surfaces. By default, `detailX` is 1.
|
|
5126
|
+
*
|
|
5127
|
+
* The fifth parameter, `detailY`, is also optional. If a number is passed, as
|
|
5128
|
+
* in `box(20, 30, 40, 5, 7)`, it sets the number of triangle subdivisions to
|
|
5129
|
+
* use along the y-axis. All 3D shapes are made by connecting triangles to
|
|
5130
|
+
* form their surfaces. By default, `detailY` is 1.
|
|
5131
|
+
*
|
|
5132
|
+
* Note: `box()` can only be used in WebGL mode.
|
|
5133
|
+
* @param width width of the box.
|
|
5134
|
+
* @param height height of the box.
|
|
5135
|
+
* @param depth depth of the box.
|
|
5136
|
+
* @param detailX number of triangle subdivisions along the x-axis.
|
|
5137
|
+
* @param detailY number of triangle subdivisions along the y-axis.
|
|
5138
|
+
*/
|
|
5139
|
+
box(width?: number, height?: number, depth?: number, detailX?: number, detailY?: number): void;
|
|
5140
|
+
|
|
5114
5141
|
/**
|
|
5115
5142
|
* Returns the largest value in a sequence of numbers.
|
|
5116
5143
|
*
|
|
@@ -5161,7 +5188,7 @@ declare class p5 {
|
|
|
5161
5188
|
bezierVertex(x: number, y: number, z: number, u?: number, v?: number): void;
|
|
5162
5189
|
|
|
5163
5190
|
/**
|
|
5164
|
-
* Creates an
|
|
5191
|
+
* Creates an `<a></a>` element that links to another web page.
|
|
5165
5192
|
*
|
|
5166
5193
|
* The first parmeter, `href`, is a string that sets the URL of the linked
|
|
5167
5194
|
* page.
|
|
@@ -5318,42 +5345,6 @@ declare class p5 {
|
|
|
5318
5345
|
clear(r?: number, g?: number, b?: number, a?: number): void;
|
|
5319
5346
|
clear(): void;
|
|
5320
5347
|
|
|
5321
|
-
/**
|
|
5322
|
-
* Draws a box (rectangular prism).
|
|
5323
|
-
*
|
|
5324
|
-
* A box is a 3D shape with six faces. Each face makes a 90˚ with four
|
|
5325
|
-
* neighboring faces.
|
|
5326
|
-
*
|
|
5327
|
-
* The first parameter, `width`, is optional. If a `Number` is passed, as in
|
|
5328
|
-
* `box(20)`, it sets the box’s width and height. By default, `width` is 50.
|
|
5329
|
-
*
|
|
5330
|
-
* The second parameter, `height`, is also optional. If a `Number` is passed,
|
|
5331
|
-
* as in `box(20, 30)`, it sets the box’s height. By default, `height` is set
|
|
5332
|
-
* to the box’s `width`.
|
|
5333
|
-
*
|
|
5334
|
-
* The third parameter, `depth`, is also optional. If a `Number` is passed, as
|
|
5335
|
-
* in `box(20, 30, 40)`, it sets the box’s depth. By default, `depth` is set
|
|
5336
|
-
* to the box’s `height`.
|
|
5337
|
-
*
|
|
5338
|
-
* The fourth parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
5339
|
-
* as in `box(20, 30, 40, 5)`, it sets the number of triangle subdivisions to
|
|
5340
|
-
* use along the x-axis. All 3D shapes are made by connecting triangles to
|
|
5341
|
-
* form their surfaces. By default, `detailX` is 1.
|
|
5342
|
-
*
|
|
5343
|
-
* The fifth parameter, `detailY`, is also optional. If a number is passed, as
|
|
5344
|
-
* in `box(20, 30, 40, 5, 7)`, it sets the number of triangle subdivisions to
|
|
5345
|
-
* use along the y-axis. All 3D shapes are made by connecting triangles to
|
|
5346
|
-
* form their surfaces. By default, `detailY` is 1.
|
|
5347
|
-
*
|
|
5348
|
-
* Note: `box()` can only be used in WebGL mode.
|
|
5349
|
-
* @param width width of the box.
|
|
5350
|
-
* @param height height of the box.
|
|
5351
|
-
* @param depth depth of the box.
|
|
5352
|
-
* @param detailX number of triangle subdivisions along the x-axis.
|
|
5353
|
-
* @param detailY number of triangle subdivisions along the y-axis.
|
|
5354
|
-
*/
|
|
5355
|
-
box(width?: number, height?: number, depth?: number, detailX?: number, detailY?: number): void;
|
|
5356
|
-
|
|
5357
5348
|
/**
|
|
5358
5349
|
* Converts a `Number` or `String` to a single-character `String`.
|
|
5359
5350
|
*
|
|
@@ -5498,7 +5489,7 @@ declare class p5 {
|
|
|
5498
5489
|
* (<a href="https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction" target="_blank">XML</a>)
|
|
5499
5490
|
* is a standard format for sending data between applications. Like HTML, the
|
|
5500
5491
|
* XML format is based on tags and attributes, as in
|
|
5501
|
-
*
|
|
5492
|
+
* `<time units="s">1234</time>`.
|
|
5502
5493
|
*
|
|
5503
5494
|
* The first parameter, `path`, is always a string with the path to the file.
|
|
5504
5495
|
* Paths to local files should be relative, as in
|
|
@@ -5667,6 +5658,33 @@ declare class p5 {
|
|
|
5667
5658
|
angleMode(mode: typeof p5.RADIANS | typeof p5.DEGREES): typeof p5.RADIANS | typeof p5.DEGREES;
|
|
5668
5659
|
angleMode(): typeof p5.RADIANS | typeof p5.DEGREES;
|
|
5669
5660
|
|
|
5661
|
+
/**
|
|
5662
|
+
* Draws a sphere.
|
|
5663
|
+
*
|
|
5664
|
+
* A sphere is a 3D shape with triangular faces that connect to form a round
|
|
5665
|
+
* surface. Spheres with few faces look like crystals. Spheres with many faces
|
|
5666
|
+
* have smooth surfaces and look like balls.
|
|
5667
|
+
*
|
|
5668
|
+
* The first parameter, `radius`, is optional. If a `Number` is passed, as in
|
|
5669
|
+
* `sphere(20)`, it sets the radius of the sphere. By default, `radius` is 50.
|
|
5670
|
+
*
|
|
5671
|
+
* The second parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
5672
|
+
* as in `sphere(20, 5)`, it sets the number of triangle subdivisions to use
|
|
5673
|
+
* along the x-axis. All 3D shapes are made by connecting triangles to form
|
|
5674
|
+
* their surfaces. By default, `detailX` is 24.
|
|
5675
|
+
*
|
|
5676
|
+
* The third parameter, `detailY`, is also optional. If a `Number` is passed,
|
|
5677
|
+
* as in `sphere(20, 5, 2)`, it sets the number of triangle subdivisions to
|
|
5678
|
+
* use along the y-axis. All 3D shapes are made by connecting triangles to
|
|
5679
|
+
* form their surfaces. By default, `detailY` is 16.
|
|
5680
|
+
*
|
|
5681
|
+
* Note: `sphere()` can only be used in WebGL mode.
|
|
5682
|
+
* @param radius radius of the sphere. Defaults to 50.
|
|
5683
|
+
* @param detailX number of triangle subdivisions along the x-axis. Defaults to 24.
|
|
5684
|
+
* @param detailY number of triangle subdivisions along the y-axis. Defaults to 16.
|
|
5685
|
+
*/
|
|
5686
|
+
sphere(radius?: number, detailX?: number, detailY?: number): void;
|
|
5687
|
+
|
|
5670
5688
|
/**
|
|
5671
5689
|
* Loads the current value of each pixel on the canvas into the
|
|
5672
5690
|
* <a href="#/p5/pixels">pixels</a> array.
|
|
@@ -5851,7 +5869,7 @@ declare class p5 {
|
|
|
5851
5869
|
loadBytes(file: string | Request, callback?: Function, errorCallback?: Function): Promise<Uint8Array>;
|
|
5852
5870
|
|
|
5853
5871
|
/**
|
|
5854
|
-
* Creates a slider
|
|
5872
|
+
* Creates a slider `<input></input>` element.
|
|
5855
5873
|
*
|
|
5856
5874
|
* Range sliders are useful for quickly selecting numbers from a given range.
|
|
5857
5875
|
*
|
|
@@ -5888,33 +5906,6 @@ declare class p5 {
|
|
|
5888
5906
|
*/
|
|
5889
5907
|
norm(value: number, start: number, stop: number): number;
|
|
5890
5908
|
|
|
5891
|
-
/**
|
|
5892
|
-
* Draws a sphere.
|
|
5893
|
-
*
|
|
5894
|
-
* A sphere is a 3D shape with triangular faces that connect to form a round
|
|
5895
|
-
* surface. Spheres with few faces look like crystals. Spheres with many faces
|
|
5896
|
-
* have smooth surfaces and look like balls.
|
|
5897
|
-
*
|
|
5898
|
-
* The first parameter, `radius`, is optional. If a `Number` is passed, as in
|
|
5899
|
-
* `sphere(20)`, it sets the radius of the sphere. By default, `radius` is 50.
|
|
5900
|
-
*
|
|
5901
|
-
* The second parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
5902
|
-
* as in `sphere(20, 5)`, it sets the number of triangle subdivisions to use
|
|
5903
|
-
* along the x-axis. All 3D shapes are made by connecting triangles to form
|
|
5904
|
-
* their surfaces. By default, `detailX` is 24.
|
|
5905
|
-
*
|
|
5906
|
-
* The third parameter, `detailY`, is also optional. If a `Number` is passed,
|
|
5907
|
-
* as in `sphere(20, 5, 2)`, it sets the number of triangle subdivisions to
|
|
5908
|
-
* use along the y-axis. All 3D shapes are made by connecting triangles to
|
|
5909
|
-
* form their surfaces. By default, `detailY` is 16.
|
|
5910
|
-
*
|
|
5911
|
-
* Note: `sphere()` can only be used in WebGL mode.
|
|
5912
|
-
* @param radius radius of the sphere. Defaults to 50.
|
|
5913
|
-
* @param detailX number of triangle subdivisions along the x-axis. Defaults to 24.
|
|
5914
|
-
* @param detailY number of triangle subdivisions along the y-axis. Defaults to 16.
|
|
5915
|
-
*/
|
|
5916
|
-
sphere(radius?: number, detailX?: number, detailY?: number): void;
|
|
5917
|
-
|
|
5918
5909
|
/**
|
|
5919
5910
|
* A function that's called once when any key is released.
|
|
5920
5911
|
*
|
|
@@ -6105,7 +6096,7 @@ declare class p5 {
|
|
|
6105
6096
|
alpha(color: p5.Color | number[] | string): number;
|
|
6106
6097
|
|
|
6107
6098
|
/**
|
|
6108
|
-
* Creates a
|
|
6099
|
+
* Creates a `<button></button>` element.
|
|
6109
6100
|
*
|
|
6110
6101
|
* The first parameter, `label`, is a string that sets the label displayed on
|
|
6111
6102
|
* the button.
|
|
@@ -6396,7 +6387,7 @@ declare class p5 {
|
|
|
6396
6387
|
panorama(img: p5.Image): void;
|
|
6397
6388
|
|
|
6398
6389
|
/**
|
|
6399
|
-
* Creates a checkbox
|
|
6390
|
+
* Creates a checkbox `<input></input>` element.
|
|
6400
6391
|
*
|
|
6401
6392
|
* Checkboxes extend the <a href="#/p5.Element">p5.Element</a> class with a
|
|
6402
6393
|
* `checked()` method. Calling `myBox.checked()` returns `true` if it the box
|
|
@@ -6472,6 +6463,50 @@ declare class p5 {
|
|
|
6472
6463
|
*/
|
|
6473
6464
|
hue(color: p5.Color | number[] | string): number;
|
|
6474
6465
|
|
|
6466
|
+
/**
|
|
6467
|
+
* Draws a cylinder.
|
|
6468
|
+
*
|
|
6469
|
+
* A cylinder is a 3D shape with triangular faces that connect a flat bottom
|
|
6470
|
+
* to a flat top. Cylinders with few faces look like boxes. Cylinders with
|
|
6471
|
+
* many faces have smooth surfaces.
|
|
6472
|
+
*
|
|
6473
|
+
* The first parameter, `radius`, is optional. If a `Number` is passed, as in
|
|
6474
|
+
* `cylinder(20)`, it sets the radius of the cylinder’s base. By default,
|
|
6475
|
+
* `radius` is 50.
|
|
6476
|
+
*
|
|
6477
|
+
* The second parameter, `height`, is also optional. If a `Number` is passed,
|
|
6478
|
+
* as in `cylinder(20, 30)`, it sets the cylinder’s height. By default,
|
|
6479
|
+
* `height` is set to the cylinder’s `radius`.
|
|
6480
|
+
*
|
|
6481
|
+
* The third parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
6482
|
+
* as in `cylinder(20, 30, 5)`, it sets the number of edges used to form the
|
|
6483
|
+
* cylinder's top and bottom. Using more edges makes the top and bottom look
|
|
6484
|
+
* more like circles. By default, `detailX` is 24.
|
|
6485
|
+
*
|
|
6486
|
+
* The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
|
|
6487
|
+
* as in `cylinder(20, 30, 5, 2)`, it sets the number of triangle subdivisions
|
|
6488
|
+
* to use along the y-axis, between cylinder's the top and bottom. All 3D
|
|
6489
|
+
* shapes are made by connecting triangles to form their surfaces. By default,
|
|
6490
|
+
* `detailY` is 1.
|
|
6491
|
+
*
|
|
6492
|
+
* The fifth parameter, `bottomCap`, is also optional. If a `false` is passed,
|
|
6493
|
+
* as in `cylinder(20, 30, 5, 2, false)` the cylinder’s bottom won’t be drawn.
|
|
6494
|
+
* By default, `bottomCap` is `true`.
|
|
6495
|
+
*
|
|
6496
|
+
* The sixth parameter, `topCap`, is also optional. If a `false` is passed, as
|
|
6497
|
+
* in `cylinder(20, 30, 5, 2, false, false)` the cylinder’s top won’t be
|
|
6498
|
+
* drawn. By default, `topCap` is `true`.
|
|
6499
|
+
*
|
|
6500
|
+
* Note: `cylinder()` can only be used in WebGL mode.
|
|
6501
|
+
* @param radius radius of the cylinder. Defaults to 50.
|
|
6502
|
+
* @param height height of the cylinder. Defaults to the value of `radius`.
|
|
6503
|
+
* @param detailX number of edges along the top and bottom. Defaults to 24.
|
|
6504
|
+
* @param detailY number of triangle subdivisions along the y-axis. Defaults to 1.
|
|
6505
|
+
* @param bottomCap whether to draw the cylinder's bottom. Defaults to `true`.
|
|
6506
|
+
* @param topCap whether to draw the cylinder's top. Defaults to `true`.
|
|
6507
|
+
*/
|
|
6508
|
+
cylinder(radius?: number, height?: number, detailX?: number, detailY?: number, bottomCap?: boolean, topCap?: boolean): void;
|
|
6509
|
+
|
|
6475
6510
|
/**
|
|
6476
6511
|
* Scales the coordinate system.
|
|
6477
6512
|
*
|
|
@@ -6591,50 +6626,6 @@ declare class p5 {
|
|
|
6591
6626
|
httpPost(path: string | Request, data: object | boolean, callback?: Function, errorCallback?: Function): Promise<any>;
|
|
6592
6627
|
httpPost(path: string | Request, callback?: Function, errorCallback?: Function): Promise<any>;
|
|
6593
6628
|
|
|
6594
|
-
/**
|
|
6595
|
-
* Draws a cylinder.
|
|
6596
|
-
*
|
|
6597
|
-
* A cylinder is a 3D shape with triangular faces that connect a flat bottom
|
|
6598
|
-
* to a flat top. Cylinders with few faces look like boxes. Cylinders with
|
|
6599
|
-
* many faces have smooth surfaces.
|
|
6600
|
-
*
|
|
6601
|
-
* The first parameter, `radius`, is optional. If a `Number` is passed, as in
|
|
6602
|
-
* `cylinder(20)`, it sets the radius of the cylinder’s base. By default,
|
|
6603
|
-
* `radius` is 50.
|
|
6604
|
-
*
|
|
6605
|
-
* The second parameter, `height`, is also optional. If a `Number` is passed,
|
|
6606
|
-
* as in `cylinder(20, 30)`, it sets the cylinder’s height. By default,
|
|
6607
|
-
* `height` is set to the cylinder’s `radius`.
|
|
6608
|
-
*
|
|
6609
|
-
* The third parameter, `detailX`, is also optional. If a `Number` is passed,
|
|
6610
|
-
* as in `cylinder(20, 30, 5)`, it sets the number of edges used to form the
|
|
6611
|
-
* cylinder's top and bottom. Using more edges makes the top and bottom look
|
|
6612
|
-
* more like circles. By default, `detailX` is 24.
|
|
6613
|
-
*
|
|
6614
|
-
* The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
|
|
6615
|
-
* as in `cylinder(20, 30, 5, 2)`, it sets the number of triangle subdivisions
|
|
6616
|
-
* to use along the y-axis, between cylinder's the top and bottom. All 3D
|
|
6617
|
-
* shapes are made by connecting triangles to form their surfaces. By default,
|
|
6618
|
-
* `detailY` is 1.
|
|
6619
|
-
*
|
|
6620
|
-
* The fifth parameter, `bottomCap`, is also optional. If a `false` is passed,
|
|
6621
|
-
* as in `cylinder(20, 30, 5, 2, false)` the cylinder’s bottom won’t be drawn.
|
|
6622
|
-
* By default, `bottomCap` is `true`.
|
|
6623
|
-
*
|
|
6624
|
-
* The sixth parameter, `topCap`, is also optional. If a `false` is passed, as
|
|
6625
|
-
* in `cylinder(20, 30, 5, 2, false, false)` the cylinder’s top won’t be
|
|
6626
|
-
* drawn. By default, `topCap` is `true`.
|
|
6627
|
-
*
|
|
6628
|
-
* Note: `cylinder()` can only be used in WebGL mode.
|
|
6629
|
-
* @param radius radius of the cylinder. Defaults to 50.
|
|
6630
|
-
* @param height height of the cylinder. Defaults to the value of `radius`.
|
|
6631
|
-
* @param detailX number of edges along the top and bottom. Defaults to 24.
|
|
6632
|
-
* @param detailY number of triangle subdivisions along the y-axis. Defaults to 1.
|
|
6633
|
-
* @param bottomCap whether to draw the cylinder's bottom. Defaults to `true`.
|
|
6634
|
-
* @param topCap whether to draw the cylinder's top. Defaults to `true`.
|
|
6635
|
-
*/
|
|
6636
|
-
cylinder(radius?: number, height?: number, detailX?: number, detailY?: number, bottomCap?: boolean, topCap?: boolean): void;
|
|
6637
|
-
|
|
6638
6629
|
/**
|
|
6639
6630
|
* Returns the sketch's current
|
|
6640
6631
|
* <a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL" target="_blank">URL</a>
|
|
@@ -7232,7 +7223,7 @@ declare class p5 {
|
|
|
7232
7223
|
* Sets the element's content.
|
|
7233
7224
|
*
|
|
7234
7225
|
* An element's content is the text between its tags. For example, the element
|
|
7235
|
-
*
|
|
7226
|
+
* `<language>JavaScript</language>` has the content `JavaScript`.
|
|
7236
7227
|
*
|
|
7237
7228
|
* The parameter, `content`, is a string with the element's new content.
|
|
7238
7229
|
* @param content new content for the element.
|
|
@@ -7245,9 +7236,7 @@ declare class p5 {
|
|
|
7245
7236
|
* The parameter, `model`, is the
|
|
7246
7237
|
* <a href="#/p5.Geometry">p5.Geometry</a> object to draw.
|
|
7247
7238
|
* <a href="#/p5.Geometry">p5.Geometry</a> objects can be built with
|
|
7248
|
-
* <a href="#/p5/buildGeometry">buildGeometry()</a
|
|
7249
|
-
* <a href="#/p5/beginGeometry">beginGeometry()</a> and
|
|
7250
|
-
* <a href="#/p5/endGeometry">endGeometry()</a>. They can also be loaded from
|
|
7239
|
+
* <a href="#/p5/buildGeometry">buildGeometry()</a>. They can also be loaded from
|
|
7251
7240
|
* a file with <a href="#/p5/loadGeometry">loadGeometry()</a>.
|
|
7252
7241
|
*
|
|
7253
7242
|
* Note: `model()` can only be used in WebGL mode.
|
|
@@ -7355,11 +7344,11 @@ declare class p5 {
|
|
|
7355
7344
|
saturation(color: p5.Color | number[] | string): number;
|
|
7356
7345
|
|
|
7357
7346
|
/**
|
|
7358
|
-
* Creates a dropdown menu
|
|
7347
|
+
* Creates a dropdown menu `<select></select>` element.
|
|
7359
7348
|
*
|
|
7360
7349
|
* The parameter is optional. If `true` is passed, as in
|
|
7361
7350
|
* `let mySelect = createSelect(true)`, then the dropdown will support
|
|
7362
|
-
* multiple selections. If an existing
|
|
7351
|
+
* multiple selections. If an existing `<select></select>` element
|
|
7363
7352
|
* is passed, as in `let mySelect = createSelect(otherSelect)`, the existing
|
|
7364
7353
|
* element will be wrapped in a new <a href="#/p5.Element">p5.Element</a>
|
|
7365
7354
|
* object.
|
|
@@ -7388,20 +7377,6 @@ declare class p5 {
|
|
|
7388
7377
|
createSelect(multiple?: boolean): p5.Element;
|
|
7389
7378
|
createSelect(existing: object): p5.Element;
|
|
7390
7379
|
|
|
7391
|
-
/**
|
|
7392
|
-
* Converts 3D world coordinates to 2D screen coordinates.
|
|
7393
|
-
*
|
|
7394
|
-
* This function takes a 3D vector and converts its coordinates
|
|
7395
|
-
* from the world space to screen space. This can be useful for placing
|
|
7396
|
-
* 2D elements in a 3D scene or for determining the screen position
|
|
7397
|
-
* of 3D objects.
|
|
7398
|
-
* @param x The x coordinate in world space. (Or a vector for all three coordinates.)
|
|
7399
|
-
* @param y The y coordinate in world space.
|
|
7400
|
-
* @param z The z coordinate in world space.
|
|
7401
|
-
* @returns A vector containing the 2D screen coordinates.
|
|
7402
|
-
*/
|
|
7403
|
-
worldToScreen(x: number | p5.Vector, y: number, z?: number): p5.Vector;
|
|
7404
|
-
|
|
7405
7380
|
/**
|
|
7406
7381
|
* Draws a cone.
|
|
7407
7382
|
*
|
|
@@ -7440,6 +7415,20 @@ declare class p5 {
|
|
|
7440
7415
|
*/
|
|
7441
7416
|
cone(radius?: number, height?: number, detailX?: number, detailY?: number, cap?: boolean): void;
|
|
7442
7417
|
|
|
7418
|
+
/**
|
|
7419
|
+
* Converts 3D world coordinates to 2D screen coordinates.
|
|
7420
|
+
*
|
|
7421
|
+
* This function takes a 3D vector and converts its coordinates
|
|
7422
|
+
* from the world space to screen space. This can be useful for placing
|
|
7423
|
+
* 2D elements in a 3D scene or for determining the screen position
|
|
7424
|
+
* of 3D objects.
|
|
7425
|
+
* @param x The x coordinate in world space. (Or a vector for all three coordinates.)
|
|
7426
|
+
* @param y The y coordinate in world space.
|
|
7427
|
+
* @param z The z coordinate in world space.
|
|
7428
|
+
* @returns A vector containing the 2D screen coordinates.
|
|
7429
|
+
*/
|
|
7430
|
+
worldToScreen(x: number | p5.Vector, y: number, z?: number): p5.Vector;
|
|
7431
|
+
|
|
7443
7432
|
/**
|
|
7444
7433
|
* Load a 3d model from an OBJ or STL string.
|
|
7445
7434
|
*
|
|
@@ -8354,8 +8343,8 @@ declare class p5 {
|
|
|
8354
8343
|
*
|
|
8355
8344
|
* The parameter is optional. If a string is passed, as in
|
|
8356
8345
|
* `let myRadio = createSelect('food')`, then each radio option will
|
|
8357
|
-
* have `"food"` as its `name` parameter:
|
|
8358
|
-
* If an existing
|
|
8346
|
+
* have `"food"` as its `name` parameter: `<input name="food"></input>`.
|
|
8347
|
+
* If an existing `<div></div>` or `<span></span>`
|
|
8359
8348
|
* element is passed, as in `let myRadio = createSelect(container)`, it will
|
|
8360
8349
|
* become the radio button's parent element.
|
|
8361
8350
|
*
|
|
@@ -8371,8 +8360,8 @@ declare class p5 {
|
|
|
8371
8360
|
* - `myRadio.selected(value)` selects the given option and returns it as an <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement" target="_blank">`HTMLInputElement`</a>.
|
|
8372
8361
|
*
|
|
8373
8362
|
* - `myRadio.disable(shouldDisable)` enables the entire radio button if `true` is passed and disables it if `false` is passed.
|
|
8374
|
-
* @param containerElement container HTML Element, either a
|
|
8375
|
-
* or
|
|
8363
|
+
* @param containerElement container HTML Element, either a `<div></div>`
|
|
8364
|
+
* or `<span></span>`.
|
|
8376
8365
|
* @returns new <a href="#/p5.Element">p5.Element</a> object.
|
|
8377
8366
|
*/
|
|
8378
8367
|
createRadio(containerElement?: object): p5.Element;
|
|
@@ -8380,7 +8369,7 @@ declare class p5 {
|
|
|
8380
8369
|
createRadio(): p5.Element;
|
|
8381
8370
|
|
|
8382
8371
|
/**
|
|
8383
|
-
* Creates a
|
|
8372
|
+
* Creates a `<video>` element for simple audio/video playback.
|
|
8384
8373
|
*
|
|
8385
8374
|
* `createVideo()` returns a new
|
|
8386
8375
|
* <a href="#/p5.MediaElement">p5.MediaElement</a> object. Videos are shown by
|
|
@@ -8469,7 +8458,7 @@ declare class p5 {
|
|
|
8469
8458
|
lerpColor(c1: p5.Color, c2: p5.Color, amt: number): p5.Color;
|
|
8470
8459
|
|
|
8471
8460
|
/**
|
|
8472
|
-
* Creates a hidden
|
|
8461
|
+
* Creates a hidden `<audio>` element for simple audio playback.
|
|
8473
8462
|
*
|
|
8474
8463
|
* `createAudio()` returns a new
|
|
8475
8464
|
* <a href="#/p5.MediaElement">p5.MediaElement</a> object.
|
|
@@ -8492,22 +8481,6 @@ declare class p5 {
|
|
|
8492
8481
|
*/
|
|
8493
8482
|
createAudio(src?: string | string[], callback?: (video: p5.MediaElement<HTMLAudioElement>) => any): p5.MediaElement<HTMLAudioElement>;
|
|
8494
8483
|
|
|
8495
|
-
/**
|
|
8496
|
-
* Blends multiple colors to find a color between them.
|
|
8497
|
-
*
|
|
8498
|
-
* The `amt` parameter specifies the amount to interpolate between the color
|
|
8499
|
-
* stops which are colors at each `amt` value "location" with `amt` values
|
|
8500
|
-
* that are between 2 color stops interpolating between them based on its relative
|
|
8501
|
-
* distance to both.
|
|
8502
|
-
*
|
|
8503
|
-
* The way that colors are interpolated depends on the current
|
|
8504
|
-
* <a href="/reference/p5/colorMode/">colorMode()</a>.
|
|
8505
|
-
* @param colors_stops color stops to interpolate from
|
|
8506
|
-
* @param amt number to use to interpolate relative to color stops
|
|
8507
|
-
* @returns interpolated color.
|
|
8508
|
-
*/
|
|
8509
|
-
paletteLerp(colors_stops: [p5.Color | string | number | number[], number][], amt: number): p5.Color;
|
|
8510
|
-
|
|
8511
8484
|
/**
|
|
8512
8485
|
* Draws a torus.
|
|
8513
8486
|
*
|
|
@@ -8539,6 +8512,22 @@ declare class p5 {
|
|
|
8539
8512
|
*/
|
|
8540
8513
|
torus(radius?: number, tubeRadius?: number, detailX?: number, detailY?: number): void;
|
|
8541
8514
|
|
|
8515
|
+
/**
|
|
8516
|
+
* Blends multiple colors to find a color between them.
|
|
8517
|
+
*
|
|
8518
|
+
* The `amt` parameter specifies the amount to interpolate between the color
|
|
8519
|
+
* stops which are colors at each `amt` value "location" with `amt` values
|
|
8520
|
+
* that are between 2 color stops interpolating between them based on its relative
|
|
8521
|
+
* distance to both.
|
|
8522
|
+
*
|
|
8523
|
+
* The way that colors are interpolated depends on the current
|
|
8524
|
+
* <a href="/reference/p5/colorMode/">colorMode()</a>.
|
|
8525
|
+
* @param colors_stops color stops to interpolate from
|
|
8526
|
+
* @param amt number to use to interpolate relative to color stops
|
|
8527
|
+
* @returns interpolated color.
|
|
8528
|
+
*/
|
|
8529
|
+
paletteLerp(colors_stops: [p5.Color | string | number | number[], number][], amt: number): p5.Color;
|
|
8530
|
+
|
|
8542
8531
|
/**
|
|
8543
8532
|
* Saves the file and closes the print stream.
|
|
8544
8533
|
*/
|
|
@@ -8762,7 +8751,7 @@ declare class p5 {
|
|
|
8762
8751
|
buildMaterialShader(hooks: object, scope?: object): p5.Shader;
|
|
8763
8752
|
|
|
8764
8753
|
/**
|
|
8765
|
-
* Creates a
|
|
8754
|
+
* Creates a `<video>` element that "captures" the audio/video stream from
|
|
8766
8755
|
* the webcam and microphone.
|
|
8767
8756
|
*
|
|
8768
8757
|
* `createCapture()` returns a new
|
|
@@ -9075,7 +9064,7 @@ declare class p5 {
|
|
|
9075
9064
|
noErase(): void;
|
|
9076
9065
|
|
|
9077
9066
|
/**
|
|
9078
|
-
* Creates a text
|
|
9067
|
+
* Creates a text `<input></input>` element.
|
|
9079
9068
|
*
|
|
9080
9069
|
* Call `myInput.size()` to set the length of the text box.
|
|
9081
9070
|
*
|
|
@@ -9423,7 +9412,7 @@ declare class p5 {
|
|
|
9423
9412
|
pop(): void;
|
|
9424
9413
|
|
|
9425
9414
|
/**
|
|
9426
|
-
* Creates an
|
|
9415
|
+
* Creates an `<input></input>` element of type `'file'`.
|
|
9427
9416
|
*
|
|
9428
9417
|
* `createFileInput()` allows users to select local files for use in a sketch.
|
|
9429
9418
|
* It returns a <a href="#/p5.File">p5.File</a> object.
|
|
@@ -10403,6 +10392,20 @@ declare class p5 {
|
|
|
10403
10392
|
vertex(x: number, y: number, u?: number, v?: number): void;
|
|
10404
10393
|
vertex(x: number, y: number, z: number, u?: number, v?: number): void;
|
|
10405
10394
|
|
|
10395
|
+
/**
|
|
10396
|
+
* Sets the number of segments used to draw spline curves in WebGL mode.
|
|
10397
|
+
*
|
|
10398
|
+
* In WebGL mode, smooth shapes are drawn using many flat segments. Adding
|
|
10399
|
+
* more flat segments makes shapes appear smoother.
|
|
10400
|
+
*
|
|
10401
|
+
* The parameter, `detail`, is the density of segments to use while drawing a
|
|
10402
|
+
* spline curve.
|
|
10403
|
+
*
|
|
10404
|
+
* Note: `curveDetail()` has no effect in 2D mode.
|
|
10405
|
+
* @param resolution number of segments to use. Default is 1/4
|
|
10406
|
+
*/
|
|
10407
|
+
curveDetail(resolution: number): void;
|
|
10408
|
+
|
|
10406
10409
|
/**
|
|
10407
10410
|
* Sets the frustum of the current camera in a 3D sketch.
|
|
10408
10411
|
*
|
|
@@ -10442,20 +10445,6 @@ declare class p5 {
|
|
|
10442
10445
|
*/
|
|
10443
10446
|
frustum(left?: number, right?: number, bottom?: number, top?: number, near?: number, far?: number): void;
|
|
10444
10447
|
|
|
10445
|
-
/**
|
|
10446
|
-
* Sets the number of segments used to draw spline curves in WebGL mode.
|
|
10447
|
-
*
|
|
10448
|
-
* In WebGL mode, smooth shapes are drawn using many flat segments. Adding
|
|
10449
|
-
* more flat segments makes shapes appear smoother.
|
|
10450
|
-
*
|
|
10451
|
-
* The parameter, `detail`, is the density of segments to use while drawing a
|
|
10452
|
-
* spline curve.
|
|
10453
|
-
*
|
|
10454
|
-
* Note: `curveDetail()` has no effect in 2D mode.
|
|
10455
|
-
* @param resolution number of segments to use. Default is 1/4
|
|
10456
|
-
*/
|
|
10457
|
-
curveDetail(resolution: number): void;
|
|
10458
|
-
|
|
10459
10448
|
/**
|
|
10460
10449
|
* Creates a new <a href="#/p5.Camera">p5.Camera</a> object.
|
|
10461
10450
|
*
|
|
@@ -12208,7 +12197,7 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
12208
12197
|
* Removes the graphics buffer from the web page.
|
|
12209
12198
|
*
|
|
12210
12199
|
* Calling `myGraphics.remove()` removes the graphics buffer's
|
|
12211
|
-
*
|
|
12200
|
+
* `<canvas>` element from the web page. The graphics buffer also uses
|
|
12212
12201
|
* a bit of memory on the CPU that can be freed like so:
|
|
12213
12202
|
*
|
|
12214
12203
|
* `// Remove the graphics buffer from the web page.
|
|
@@ -12672,7 +12661,7 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
12672
12661
|
* (<a href="https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction" target="_blank">XML</a>)
|
|
12673
12662
|
* is a standard format for sending data between applications. Like HTML, the
|
|
12674
12663
|
* XML format is based on tags and attributes, as in
|
|
12675
|
-
*
|
|
12664
|
+
* `<time units="s">1234</time>`.
|
|
12676
12665
|
*
|
|
12677
12666
|
* Note: Use <a href="#/p5/loadXML">loadXML()</a> to load external XML files.
|
|
12678
12667
|
*/
|
|
@@ -12688,7 +12677,7 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
12688
12677
|
* Returns the element's name as a `String`.
|
|
12689
12678
|
*
|
|
12690
12679
|
* An XML element's name is given by its tag. For example, the element
|
|
12691
|
-
*
|
|
12680
|
+
* `<language>JavaScript</language>` has the name `language`.
|
|
12692
12681
|
* @returns name of the element.
|
|
12693
12682
|
*/
|
|
12694
12683
|
getName(): string;
|
|
@@ -12697,11 +12686,11 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
12697
12686
|
* Sets the element's tag name.
|
|
12698
12687
|
*
|
|
12699
12688
|
* An XML element's name is given by its tag. For example, the element
|
|
12700
|
-
*
|
|
12689
|
+
* `<language>JavaScript</language>` has the name `language`.
|
|
12701
12690
|
*
|
|
12702
12691
|
* The parameter, `name`, is the element's new name as a string. For example,
|
|
12703
12692
|
* calling `myXML.setName('planet')` will make the element's new tag name
|
|
12704
|
-
*
|
|
12693
|
+
* `<planet></planet>`.
|
|
12705
12694
|
* @param name new tag name of the element.
|
|
12706
12695
|
*/
|
|
12707
12696
|
setName(name: string): void;
|
|
@@ -12725,7 +12714,7 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
12725
12714
|
*
|
|
12726
12715
|
* The parameter, `name`, is optional. If a string is passed, as in
|
|
12727
12716
|
* `myXML.getChildren('cat')`, then the method will only return child elements
|
|
12728
|
-
* with the tag
|
|
12717
|
+
* with the tag `<cat>`.
|
|
12729
12718
|
* @param name name of the elements to return.
|
|
12730
12719
|
* @returns child elements.
|
|
12731
12720
|
*/
|
|
@@ -12737,7 +12726,7 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
12737
12726
|
*
|
|
12738
12727
|
* The parameter, `name`, is optional. If a string is passed, as in
|
|
12739
12728
|
* `myXML.getChild('cat')`, then the first child element with the tag
|
|
12740
|
-
*
|
|
12729
|
+
* `<cat>` will be returned. If a number is passed, as in
|
|
12741
12730
|
* `myXML.getChild(1)`, then the child element at that index will be returned.
|
|
12742
12731
|
* @param name element name or index.
|
|
12743
12732
|
* @returns child element.
|
|
@@ -12760,7 +12749,7 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
12760
12749
|
*
|
|
12761
12750
|
* The parameter, `name`, is the child element to remove. If a string is
|
|
12762
12751
|
* passed, as in `myXML.removeChild('cat')`, then the first child element
|
|
12763
|
-
* with the tag
|
|
12752
|
+
* with the tag `<cat>` will be removed. If a number is passed, as in
|
|
12764
12753
|
* `myXML.removeChild(1)`, then the child element at that index will be
|
|
12765
12754
|
* removed.
|
|
12766
12755
|
* @param name name or index of the child element to remove.
|
|
@@ -14638,9 +14627,9 @@ const EXCLUDE: typeof __EXCLUDE;
|
|
|
14638
14627
|
/**
|
|
14639
14628
|
* Attaches the element to a parent element.
|
|
14640
14629
|
*
|
|
14641
|
-
* For example, a
|
|
14630
|
+
* For example, a `<div></div>` element may be used as a box to
|
|
14642
14631
|
* hold two pieces of text, a header and a paragraph. The
|
|
14643
|
-
*
|
|
14632
|
+
* `<div></div>` is the parent element of both the header and
|
|
14644
14633
|
* paragraph.
|
|
14645
14634
|
*
|
|
14646
14635
|
* The parameter `parent` can have one of three types. `parent` can be a
|