p5 2.0.1 → 2.0.2
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 -5
- package/dist/accessibility/describe.js +10 -0
- package/dist/accessibility/index.js +5 -5
- package/dist/accessibility/outputs.js +21 -0
- package/dist/app.js +5 -5
- package/dist/color/color_conversion.js +5 -5
- 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 +2 -2
- package/dist/{constants-C-g_eAdC.js → constants-tYr0tCl8.js} +19 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +6 -5
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +41 -75
- package/dist/core/friendly_errors/sketch_reader.js +5 -5
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/friendly_errors/validate_params.js +5 -5
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -5
- package/dist/core/legacy.js +5 -5
- package/dist/core/main.js +5 -5
- package/dist/core/p5.Graphics.js +4 -4
- package/dist/core/p5.Renderer.js +3 -3
- package/dist/core/p5.Renderer2D.js +5 -5
- package/dist/core/rendering.js +4 -4
- package/dist/{creating_reading-D4AAKRbx.js → creating_reading-Cr8L2Jnm.js} +2 -2
- package/dist/dom/dom.js +10 -10
- package/dist/dom/index.js +2 -2
- package/dist/dom/p5.Element.js +2 -2
- package/dist/dom/p5.MediaElement.js +2 -2
- package/dist/events/acceleration.js +24 -24
- package/dist/events/keyboard.js +1 -2
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -4
- package/dist/image/image.js +4 -4
- package/dist/image/index.js +4 -4
- package/dist/image/loading_displaying.js +4 -4
- package/dist/image/p5.Image.js +3 -3
- package/dist/image/pixels.js +1 -0
- package/dist/io/files.js +4 -4
- package/dist/io/index.js +4 -4
- package/dist/io/p5.TableRow.js +2 -2
- package/dist/{main-s72KWcUy.js → main-CAxvgiOV.js} +12 -9
- 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/math.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-CwAYZOC2.js → p5.Renderer-Swjl9HQO.js} +5 -5
- package/dist/{rendering--aAe5aq3.js → rendering-B5TRR7aY.js} +101 -66
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +2 -2
- package/dist/shape/index.js +2 -2
- package/dist/type/index.js +3 -3
- package/dist/type/p5.Font.js +3 -5
- package/dist/type/textCore.js +4 -4
- package/dist/webgl/3d_primitives.js +4 -4
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/index.js +4 -4
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +4 -4
- package/dist/webgl/loading.js +4 -4
- package/dist/webgl/material.js +4 -4
- package/dist/webgl/p5.Camera.js +4 -4
- package/dist/webgl/p5.Framebuffer.js +4 -4
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +4 -4
- package/dist/webgl/p5.Shader.js +4 -4
- package/dist/webgl/p5.Texture.js +4 -4
- package/dist/webgl/text.js +32 -34
- package/lib/p5.esm.js +273 -225
- package/lib/p5.js +273 -225
- package/lib/p5.min.js +1 -1
- package/package.json +1 -2
- package/types/accessibility/color_namer.d.ts +8 -0
- package/types/accessibility/describe.d.ts +184 -0
- package/types/accessibility/gridOutput.d.ts +8 -0
- package/types/accessibility/outputs.d.ts +235 -0
- package/types/accessibility/textOutput.d.ts +8 -0
- package/types/color/color_conversion.d.ts +47 -0
- package/types/color/creating_reading.d.ts +1348 -0
- package/types/color/p5.Color.d.ts +1070 -0
- package/types/color/setting.d.ts +2085 -0
- package/types/core/constants.d.ts +341 -0
- package/types/core/environment.d.ts +668 -0
- package/types/core/friendly_errors/fes_core.d.ts +8 -0
- package/types/core/friendly_errors/file_errors.d.ts +8 -0
- package/types/core/friendly_errors/param_validator.d.ts +30 -0
- package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
- package/types/core/friendly_errors/stacktrace.d.ts +11 -0
- package/types/core/friendly_errors/validate_params.d.ts +8 -0
- package/types/core/helpers.d.ts +8 -0
- package/types/core/legacy.d.ts +8 -0
- package/types/core/main.d.ts +5996 -0
- package/types/core/p5.Graphics.d.ts +484 -0
- package/types/core/p5.Renderer.d.ts +14 -0
- package/types/core/reference.d.ts +8 -0
- package/types/core/rendering.d.ts +481 -0
- package/types/core/structure.d.ts +492 -0
- package/types/core/transform.d.ts +1638 -0
- package/types/data/local_storage.d.ts +323 -0
- package/types/dom/dom.d.ts +1295 -0
- package/types/dom/p5.Element.d.ts +2011 -0
- package/types/dom/p5.File.d.ts +13 -0
- package/types/dom/p5.MediaElement.d.ts +1249 -0
- package/types/events/acceleration.d.ts +193 -0
- package/types/events/keyboard.d.ts +499 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5542 -0
- package/types/image/filterRenderer2D.d.ts +54 -0
- package/types/image/image.d.ts +326 -0
- package/types/image/loading_displaying.d.ts +580 -0
- package/types/image/p5.Image.d.ts +5882 -0
- package/types/image/pixels.d.ts +832 -0
- package/types/io/files.d.ts +1447 -0
- package/types/io/p5.Table.d.ts +1247 -0
- package/types/io/p5.TableRow.d.ts +343 -0
- package/types/io/p5.XML.d.ts +1188 -0
- package/types/math/Matrices/Matrix.d.ts +1029 -0
- package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
- package/types/math/calculation.d.ts +923 -0
- package/types/math/math.d.ts +90 -0
- package/types/math/noise.d.ts +311 -0
- package/types/math/p5.Matrix.d.ts +8 -0
- package/types/math/p5.Vector.d.ts +3416 -0
- package/types/math/random.d.ts +267 -0
- package/types/math/trigonometry.d.ts +663 -0
- package/types/p5.d.ts +6663 -0
- package/types/shape/2d_primitives.d.ts +1033 -0
- package/types/shape/attributes.d.ts +466 -0
- package/types/shape/curves.d.ts +740 -0
- package/types/shape/custom_shapes.d.ts +888 -0
- package/types/shape/vertex.d.ts +1141 -0
- package/types/type/p5.Font.d.ts +575 -0
- package/types/type/textCore.d.ts +1198 -0
- package/types/utilities/conversion.d.ts +894 -0
- package/types/utilities/time_date.d.ts +295 -0
- package/types/utilities/utility_functions.d.ts +587 -0
- package/types/webgl/3d_primitives.d.ts +1432 -0
- package/types/webgl/ShaderGenerator.d.ts +8 -0
- package/types/webgl/interaction.d.ts +371 -0
- package/types/webgl/light.d.ts +1184 -0
- package/types/webgl/loading.d.ts +481 -0
- package/types/webgl/material.d.ts +2656 -0
- package/types/webgl/p5.Camera.d.ts +3023 -0
- package/types/webgl/p5.DataArray.d.ts +61 -0
- package/types/webgl/p5.Framebuffer.d.ts +760 -0
- package/types/webgl/p5.Geometry.d.ts +1191 -0
- package/types/webgl/p5.Quat.d.ts +45 -0
- package/types/webgl/p5.RendererGL.d.ts +234 -0
- package/types/webgl/p5.Shader.d.ts +660 -0
- package/types/webgl/p5.Texture.d.ts +61 -0
- package/types/webgl/text.d.ts +74 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* Multiplies a quaternion with other quaternion.
|
|
8
|
+
*
|
|
9
|
+
* @param quaternion to multiply with the quaternion calling the method.
|
|
10
|
+
*/
|
|
11
|
+
function mult(quat?: p5.Quat): void;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns a Quaternion for the
|
|
15
|
+
* axis angle representation of the rotation
|
|
16
|
+
*
|
|
17
|
+
* @param Angle with which the points needs to be rotated
|
|
18
|
+
* @param x component of the axis vector
|
|
19
|
+
* @param y component of the axis vector
|
|
20
|
+
* @param z component of the axis vector
|
|
21
|
+
*/
|
|
22
|
+
function fromAxisAngle(angle?: number, x?: number, y?: number, z?: number): void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This is similar to quaternion multiplication
|
|
26
|
+
* but when multipying vector with quaternion
|
|
27
|
+
* the multiplication can be simplified to the below formula.
|
|
28
|
+
* This was taken from the below stackexchange link
|
|
29
|
+
*
|
|
30
|
+
* @param vector to rotate on the axis quaternion
|
|
31
|
+
*/
|
|
32
|
+
function rotateVector(p?: p5.Vector): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Rotates the Quaternion by the quaternion passed
|
|
36
|
+
* which contains the axis of roation and angle of rotation
|
|
37
|
+
*
|
|
38
|
+
* @param axis quaternion which contains
|
|
39
|
+
* the axis of rotation and angle of rotation
|
|
40
|
+
*/
|
|
41
|
+
function rotateBy(axesQuat?: p5.Quat): void;
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default function p5_Quat(p5: any, fn: any): void;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* ensures that p5 is using a 3d renderer. throws an error if not.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
function _assert3d(name: any): void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new p5.Geometry that contains all
|
|
14
|
+
* the shapes drawn in a provided callback function. The returned combined shape
|
|
15
|
+
* can then be drawn all at once using model().If you need to draw complex shapes every frame which don't change over time,
|
|
16
|
+
* combining them with `buildGeometry()` once and then drawing that will run
|
|
17
|
+
* faster than repeatedly drawing the individual pieces.One can also draw shapes directly between
|
|
18
|
+
* beginGeometry() and
|
|
19
|
+
* endGeometry() instead of using a callback
|
|
20
|
+
* function.
|
|
21
|
+
*
|
|
22
|
+
* @param A function that draws shapes.
|
|
23
|
+
* @returns The model that was built from the callback function.
|
|
24
|
+
*/
|
|
25
|
+
function buildGeometry(callback: Function): p5.Geometry;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* [background description]
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
function background(...args: any[]): void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get a matrix from world-space to screen-space
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
function getWorldToScreenMatrix(): void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Basic fill material for geometry with a given color
|
|
41
|
+
*
|
|
42
|
+
* @param gray value,
|
|
43
|
+
* red or hue value (depending on the current color mode),
|
|
44
|
+
* or color Array, or CSS color string
|
|
45
|
+
* @param green or saturation value
|
|
46
|
+
* @param blue or brightness value
|
|
47
|
+
* @param opacity
|
|
48
|
+
* @example <div>
|
|
49
|
+
* <code>
|
|
50
|
+
* function setup() {
|
|
51
|
+
* createCanvas(200, 200, WEBGL);
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* function draw() {
|
|
55
|
+
* background(0);
|
|
56
|
+
* noStroke();
|
|
57
|
+
* fill(100, 100, 240);
|
|
58
|
+
* rotateX(frameCount * 0.01);
|
|
59
|
+
* rotateY(frameCount * 0.01);
|
|
60
|
+
* box(75, 75, 75);
|
|
61
|
+
* }
|
|
62
|
+
* </code>
|
|
63
|
+
* </div>
|
|
64
|
+
* @alt black canvas with purple cube spinning
|
|
65
|
+
*/
|
|
66
|
+
function fill(...args: any[], v1: number | number[] | string | p5.Color, v2?: number, v3?: number, a?: number): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Basic stroke material for geometry with a given color
|
|
70
|
+
*
|
|
71
|
+
* @param gray value,
|
|
72
|
+
* red or hue value (depending on the current color mode),
|
|
73
|
+
* or color Array, or CSS color string
|
|
74
|
+
* @param green or saturation value
|
|
75
|
+
* @param blue or brightness value
|
|
76
|
+
* @param opacity
|
|
77
|
+
* @example <div>
|
|
78
|
+
* <code>
|
|
79
|
+
* function setup() {
|
|
80
|
+
* createCanvas(200, 200, WEBGL);
|
|
81
|
+
* }
|
|
82
|
+
*
|
|
83
|
+
* function draw() {
|
|
84
|
+
* background(0);
|
|
85
|
+
* stroke(240, 150, 150);
|
|
86
|
+
* fill(100, 100, 240);
|
|
87
|
+
* rotateX(frameCount * 0.01);
|
|
88
|
+
* rotateY(frameCount * 0.01);
|
|
89
|
+
* box(75, 75, 75);
|
|
90
|
+
* }
|
|
91
|
+
* </code>
|
|
92
|
+
* </div>
|
|
93
|
+
* @alt black canvas with purple cube with pink outline spinning
|
|
94
|
+
*/
|
|
95
|
+
function stroke(...args: any[], v1: number | number[] | string | p5.Color, v2?: number, v3?: number, a?: number): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Resets all depth information so that nothing previously drawn will
|
|
99
|
+
* occlude anything subsequently drawn.
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
function clearDepth(depth: any): void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Set attributes for the WebGL Drawing context.
|
|
106
|
+
* This is a way of adjusting how the WebGL
|
|
107
|
+
* renderer works to fine-tune the display and performance.Note that this will reinitialize the drawing context
|
|
108
|
+
* if called after the WebGL canvas is made.If an object is passed as the parameter, all attributes
|
|
109
|
+
* not declared in the object will be set to defaults.The available attributes are:
|
|
110
|
+
*
|
|
111
|
+
* alpha - indicates if the canvas contains an alpha buffer
|
|
112
|
+
* default is truedepth - indicates whether the drawing buffer has a depth buffer
|
|
113
|
+
* of at least 16 bits - default is truestencil - indicates whether the drawing buffer has a stencil buffer
|
|
114
|
+
* of at least 8 bitsantialias - indicates whether or not to perform anti-aliasing
|
|
115
|
+
* default is false (true in Safari)premultipliedAlpha - indicates that the page compositor will assume
|
|
116
|
+
* the drawing buffer contains colors with pre-multiplied alpha
|
|
117
|
+
* default is truepreserveDrawingBuffer - if true the buffers will not be cleared and
|
|
118
|
+
* and will preserve their values until cleared or overwritten by author
|
|
119
|
+
* (note that p5 clears automatically on draw loop)
|
|
120
|
+
* default is trueperPixelLighting - if true, per-pixel lighting will be used in the
|
|
121
|
+
* lighting shader otherwise per-vertex lighting is used.
|
|
122
|
+
* default is true.version - either 1 or 2, to specify which WebGL version to ask for. By
|
|
123
|
+
* default, WebGL 2 will be requested. If WebGL2 is not available, it will
|
|
124
|
+
* fall back to WebGL 1. You can check what version is used with by looking at
|
|
125
|
+
* the global `webglVersion` property.
|
|
126
|
+
*
|
|
127
|
+
* @for p5
|
|
128
|
+
* @param Name of attribute
|
|
129
|
+
* @param New value of named attribute
|
|
130
|
+
* @example <div>
|
|
131
|
+
* <code>
|
|
132
|
+
* function setup() {
|
|
133
|
+
* createCanvas(100, 100, WEBGL);
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* function draw() {
|
|
137
|
+
* background(255);
|
|
138
|
+
* push();
|
|
139
|
+
* rotateZ(frameCount * 0.02);
|
|
140
|
+
* rotateX(frameCount * 0.02);
|
|
141
|
+
* rotateY(frameCount * 0.02);
|
|
142
|
+
* fill(0, 0, 0);
|
|
143
|
+
* box(50);
|
|
144
|
+
* pop();
|
|
145
|
+
* }
|
|
146
|
+
* </code>
|
|
147
|
+
* </div>
|
|
148
|
+
*
|
|
149
|
+
* <div>
|
|
150
|
+
* <code>
|
|
151
|
+
* // Now with the antialias attribute set to true.
|
|
152
|
+
* function setup() {
|
|
153
|
+
* setAttributes('antialias', true);
|
|
154
|
+
* createCanvas(100, 100, WEBGL);
|
|
155
|
+
* }
|
|
156
|
+
*
|
|
157
|
+
* function draw() {
|
|
158
|
+
* background(255);
|
|
159
|
+
* push();
|
|
160
|
+
* rotateZ(frameCount * 0.02);
|
|
161
|
+
* rotateX(frameCount * 0.02);
|
|
162
|
+
* rotateY(frameCount * 0.02);
|
|
163
|
+
* fill(0, 0, 0);
|
|
164
|
+
* box(50);
|
|
165
|
+
* pop();
|
|
166
|
+
* }
|
|
167
|
+
* </code>
|
|
168
|
+
* </div>
|
|
169
|
+
*
|
|
170
|
+
* <div>
|
|
171
|
+
* <code>
|
|
172
|
+
* // press the mouse button to disable perPixelLighting
|
|
173
|
+
* function setup() {
|
|
174
|
+
* createCanvas(100, 100, WEBGL);
|
|
175
|
+
* noStroke();
|
|
176
|
+
* fill(255);
|
|
177
|
+
* }
|
|
178
|
+
*
|
|
179
|
+
* let lights = [
|
|
180
|
+
* { c: '#f00', t: 1.12, p: 1.91, r: 0.2 },
|
|
181
|
+
* { c: '#0f0', t: 1.21, p: 1.31, r: 0.2 },
|
|
182
|
+
* { c: '#00f', t: 1.37, p: 1.57, r: 0.2 },
|
|
183
|
+
* { c: '#ff0', t: 1.12, p: 1.91, r: 0.7 },
|
|
184
|
+
* { c: '#0ff', t: 1.21, p: 1.31, r: 0.7 },
|
|
185
|
+
* { c: '#f0f', t: 1.37, p: 1.57, r: 0.7 }
|
|
186
|
+
* ];
|
|
187
|
+
*
|
|
188
|
+
* function draw() {
|
|
189
|
+
* let t = millis() / 1000 + 1000;
|
|
190
|
+
* background(0);
|
|
191
|
+
* directionalLight(color('#222'), 1, 1, 1);
|
|
192
|
+
*
|
|
193
|
+
* for (let i = 0; i < lights.length; i++) {
|
|
194
|
+
* let light = lights[i];
|
|
195
|
+
* pointLight(
|
|
196
|
+
* color(light.c),
|
|
197
|
+
* p5.Vector.fromAngles(t * light.t, t * light.p, width * light.r)
|
|
198
|
+
* );
|
|
199
|
+
* }
|
|
200
|
+
*
|
|
201
|
+
* specularMaterial(255);
|
|
202
|
+
* sphere(width * 0.1);
|
|
203
|
+
*
|
|
204
|
+
* rotateX(t * 0.77);
|
|
205
|
+
* rotateY(t * 0.83);
|
|
206
|
+
* rotateZ(t * 0.91);
|
|
207
|
+
* torus(width * 0.3, width * 0.07, 24, 10);
|
|
208
|
+
* }
|
|
209
|
+
*
|
|
210
|
+
* function mousePressed() {
|
|
211
|
+
* setAttributes('perPixelLighting', false);
|
|
212
|
+
* noStroke();
|
|
213
|
+
* fill(255);
|
|
214
|
+
* }
|
|
215
|
+
* function mouseReleased() {
|
|
216
|
+
* setAttributes('perPixelLighting', true);
|
|
217
|
+
* noStroke();
|
|
218
|
+
* fill(255);
|
|
219
|
+
* }
|
|
220
|
+
* </code>
|
|
221
|
+
* </div>
|
|
222
|
+
* @alt a rotating cube with smoother edges
|
|
223
|
+
*/
|
|
224
|
+
function setAttributes(key: string, value: boolean): void;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @for p5
|
|
228
|
+
* @param object with key-value pairs
|
|
229
|
+
*/
|
|
230
|
+
function setAttributes(obj: object): void;
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export default function p5_RendererGL(p5: any, fn: any): void;
|