p5 2.0.1 → 2.0.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/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-BRcElHU3.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 +46 -93
- 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 +11 -6
- 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-BKN5yFoS.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-R23xoC7s.js} +5 -5
- package/dist/{rendering--aAe5aq3.js → rendering-CvUVN-Vb.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 +5 -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 +289 -247
- package/lib/p5.js +289 -247
- 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 +5999 -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 +501 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5544 -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 +6666 -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 +482 -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,267 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* Sets the seed value for the random() and
|
|
8
|
+
* randomGaussian() functions.By default, random() and
|
|
9
|
+
* randomGaussian() produce different
|
|
10
|
+
* results each time a sketch is run. Calling `randomSeed()` with a constant
|
|
11
|
+
* argument, such as `randomSeed(99)`, makes these functions produce the same
|
|
12
|
+
* results each time a sketch is run.
|
|
13
|
+
*
|
|
14
|
+
* @param seed value.
|
|
15
|
+
* @example <div>
|
|
16
|
+
* <code>
|
|
17
|
+
* function setup() {
|
|
18
|
+
* createCanvas(100, 100);
|
|
19
|
+
*
|
|
20
|
+
* background(200);
|
|
21
|
+
*
|
|
22
|
+
* // Get random coordinates.
|
|
23
|
+
* let x = random(0, 100);
|
|
24
|
+
* let y = random(0, 100);
|
|
25
|
+
*
|
|
26
|
+
* // Draw the white circle.
|
|
27
|
+
* circle(x, y, 10);
|
|
28
|
+
*
|
|
29
|
+
* // Set a random seed for consistency.
|
|
30
|
+
* randomSeed(99);
|
|
31
|
+
*
|
|
32
|
+
* // Get random coordinates.
|
|
33
|
+
* x = random(0, 100);
|
|
34
|
+
* y = random(0, 100);
|
|
35
|
+
*
|
|
36
|
+
* // Draw the black circle.
|
|
37
|
+
* fill(0);
|
|
38
|
+
* circle(x, y, 10);
|
|
39
|
+
*
|
|
40
|
+
* describe('A white circle appears at a random position. A black circle appears at (27.4, 25.8).');
|
|
41
|
+
* }
|
|
42
|
+
* </code>
|
|
43
|
+
* </div>
|
|
44
|
+
*/
|
|
45
|
+
function randomSeed(seed: number): void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns a random number or a random element from an array.`random()` follows uniform distribution, which means that all outcomes are
|
|
49
|
+
* equally likely. When `random()` is used to generate numbers, all
|
|
50
|
+
* numbers in the output range are equally likely to be returned. When
|
|
51
|
+
* `random()` is used to select elements from an array, all elements are
|
|
52
|
+
* equally likely to be chosen.By default, `random()` produces different results each time a sketch runs.
|
|
53
|
+
* The randomSeed() function can be used to
|
|
54
|
+
* generate the same sequence of numbers or choices each time a sketch runs.The version of `random()` with no parameters returns a random number from 0
|
|
55
|
+
* up to but not including 1.The version of `random()` with one parameter works one of two ways. If the
|
|
56
|
+
* argument passed is a number, `random()` returns a random number from 0 up
|
|
57
|
+
* to but not including the number. For example, calling `random(5)` returns
|
|
58
|
+
* values between 0 and 5. If the argument passed is an array, `random()`
|
|
59
|
+
* returns a random element from that array. For example, calling
|
|
60
|
+
* `random(['🦁', '🐯', '🐻'])` returns either a lion, tiger, or bear emoji.The version of `random()` with two parameters returns a random number from
|
|
61
|
+
* a given range. The arguments passed set the range's lower and upper bounds.
|
|
62
|
+
* For example, calling `random(-5, 10.2)` returns values from -5 up to but
|
|
63
|
+
* not including 10.2.
|
|
64
|
+
*
|
|
65
|
+
* @param lower bound (inclusive).
|
|
66
|
+
* @param upper bound (exclusive).
|
|
67
|
+
* @return random number.
|
|
68
|
+
* @example <div>
|
|
69
|
+
* <code>
|
|
70
|
+
* function setup() {
|
|
71
|
+
* createCanvas(100, 100);
|
|
72
|
+
*
|
|
73
|
+
* background(200);
|
|
74
|
+
*
|
|
75
|
+
* // Get random coordinates between 0 and 100.
|
|
76
|
+
* let x = random(0, 100);
|
|
77
|
+
* let y = random(0, 100);
|
|
78
|
+
*
|
|
79
|
+
* // Draw a point.
|
|
80
|
+
* strokeWeight(5);
|
|
81
|
+
* point(x, y);
|
|
82
|
+
*
|
|
83
|
+
* describe('A black dot appears in a random position on a gray square.');
|
|
84
|
+
* }
|
|
85
|
+
* </code>
|
|
86
|
+
* </div>
|
|
87
|
+
*
|
|
88
|
+
* <div>
|
|
89
|
+
* <code>
|
|
90
|
+
* function setup() {
|
|
91
|
+
* createCanvas(100, 100);
|
|
92
|
+
*
|
|
93
|
+
* background(200);
|
|
94
|
+
*
|
|
95
|
+
* // Get random coordinates between 0 and 100.
|
|
96
|
+
* let x = random(100);
|
|
97
|
+
* let y = random(100);
|
|
98
|
+
*
|
|
99
|
+
* // Draw the point.
|
|
100
|
+
* strokeWeight(5);
|
|
101
|
+
* point(x, y);
|
|
102
|
+
*
|
|
103
|
+
* describe('A black dot appears in a random position on a gray square.');
|
|
104
|
+
* }
|
|
105
|
+
* </code>
|
|
106
|
+
* </div>
|
|
107
|
+
*
|
|
108
|
+
* <div>
|
|
109
|
+
* <code>
|
|
110
|
+
* function setup() {
|
|
111
|
+
* createCanvas(100, 100);
|
|
112
|
+
*
|
|
113
|
+
* background(200);
|
|
114
|
+
*
|
|
115
|
+
* // Create an array of emoji strings.
|
|
116
|
+
* let animals = ['🦁', '🐯', '🐻'];
|
|
117
|
+
*
|
|
118
|
+
* // Choose a random element from the array.
|
|
119
|
+
* let choice = random(animals);
|
|
120
|
+
*
|
|
121
|
+
* // Style the text.
|
|
122
|
+
* textAlign(CENTER);
|
|
123
|
+
* textSize(20);
|
|
124
|
+
*
|
|
125
|
+
* // Display the emoji.
|
|
126
|
+
* text(choice, 50, 50);
|
|
127
|
+
*
|
|
128
|
+
* describe('An animal face is displayed at random. Either a lion, tiger, or bear.');
|
|
129
|
+
* }
|
|
130
|
+
* </code>
|
|
131
|
+
* </div>
|
|
132
|
+
*
|
|
133
|
+
* <div>
|
|
134
|
+
* <code>
|
|
135
|
+
* function setup() {
|
|
136
|
+
* createCanvas(100, 100);
|
|
137
|
+
*
|
|
138
|
+
* // Slow the frame rate.
|
|
139
|
+
* frameRate(5);
|
|
140
|
+
*
|
|
141
|
+
* describe('A black dot moves around randomly on a gray square.');
|
|
142
|
+
* }
|
|
143
|
+
*
|
|
144
|
+
* function draw() {
|
|
145
|
+
* background(200);
|
|
146
|
+
*
|
|
147
|
+
* // Get random coordinates between 0 and 100.
|
|
148
|
+
* let x = random(100);
|
|
149
|
+
* let y = random(100);
|
|
150
|
+
*
|
|
151
|
+
* // Draw the point.
|
|
152
|
+
* strokeWeight(5);
|
|
153
|
+
* point(x, y);
|
|
154
|
+
* }
|
|
155
|
+
* </code>
|
|
156
|
+
* </div>
|
|
157
|
+
*
|
|
158
|
+
* <div>
|
|
159
|
+
* <code>
|
|
160
|
+
* function setup() {
|
|
161
|
+
* createCanvas(100, 100);
|
|
162
|
+
*
|
|
163
|
+
* // Slow the frame rate.
|
|
164
|
+
* frameRate(5);
|
|
165
|
+
*
|
|
166
|
+
* describe('A black dot moves around randomly in the middle of a gray square.');
|
|
167
|
+
* }
|
|
168
|
+
*
|
|
169
|
+
* function draw() {
|
|
170
|
+
* background(200);
|
|
171
|
+
*
|
|
172
|
+
* // Get random coordinates between 45 and 55.
|
|
173
|
+
* let x = random(45, 55);
|
|
174
|
+
* let y = random(45, 55);
|
|
175
|
+
*
|
|
176
|
+
* // Draw the point.
|
|
177
|
+
* strokeWeight(5);
|
|
178
|
+
* point(x, y);
|
|
179
|
+
* }
|
|
180
|
+
* </code>
|
|
181
|
+
* </div>
|
|
182
|
+
*
|
|
183
|
+
* <div>
|
|
184
|
+
* <code>
|
|
185
|
+
* let x = 50;
|
|
186
|
+
* let y = 50;
|
|
187
|
+
*
|
|
188
|
+
* function setup() {
|
|
189
|
+
* createCanvas(100, 100);
|
|
190
|
+
*
|
|
191
|
+
* background(200);
|
|
192
|
+
*
|
|
193
|
+
* describe('A black dot moves around randomly leaving a trail.');
|
|
194
|
+
* }
|
|
195
|
+
*
|
|
196
|
+
* function draw() {
|
|
197
|
+
* // Update x and y randomly.
|
|
198
|
+
* x += random(-1, 1);
|
|
199
|
+
* y += random(-1, 1);
|
|
200
|
+
*
|
|
201
|
+
* // Draw the point.
|
|
202
|
+
* point(x, y);
|
|
203
|
+
* }
|
|
204
|
+
* </code>
|
|
205
|
+
* </div>
|
|
206
|
+
*/
|
|
207
|
+
function random(min?: number, max?: number): number;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @param array to choose from.
|
|
211
|
+
* @return random element from the array.
|
|
212
|
+
*/
|
|
213
|
+
function random<T>(choices: T[]): T;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Returns a random number fitting a Gaussian, or normal, distribution.Normal distributions look like bell curves when plotted. Values from a
|
|
217
|
+
* normal distribution cluster around a central value called the mean. The
|
|
218
|
+
* cluster's standard deviation describes its spread.By default, `randomGaussian()` produces different results each time a
|
|
219
|
+
* sketch runs. The randomSeed() function can be
|
|
220
|
+
* used to generate the same sequence of numbers each time a sketch runs.There's no minimum or maximum value that `randomGaussian()` might return.
|
|
221
|
+
* Values far from the mean are very unlikely and values near the mean are
|
|
222
|
+
* very likely.The version of `randomGaussian()` with no parameters returns values with a
|
|
223
|
+
* mean of 0 and standard deviation of 1.The version of `randomGaussian()` with one parameter interprets the
|
|
224
|
+
* argument passed as the mean. The standard deviation is 1.The version of `randomGaussian()` with two parameters interprets the first
|
|
225
|
+
* argument passed as the mean and the second as the standard deviation.
|
|
226
|
+
*
|
|
227
|
+
* @param mean.
|
|
228
|
+
* @param standard deviation.
|
|
229
|
+
* @return random number.
|
|
230
|
+
* @example <div>
|
|
231
|
+
* <code>
|
|
232
|
+
* function setup() {
|
|
233
|
+
* createCanvas(100, 100);
|
|
234
|
+
*
|
|
235
|
+
* background(200);
|
|
236
|
+
*
|
|
237
|
+
* describe('Three horizontal black lines are filled in randomly. The top line spans entire canvas. The middle line is very short. The bottom line spans two-thirds of the canvas.');
|
|
238
|
+
* }
|
|
239
|
+
*
|
|
240
|
+
* function draw() {
|
|
241
|
+
* // Style the circles.
|
|
242
|
+
* noStroke();
|
|
243
|
+
* fill(0, 10);
|
|
244
|
+
*
|
|
245
|
+
* // Uniform distribution between 0 and 100.
|
|
246
|
+
* let x = random(100);
|
|
247
|
+
* let y = 25;
|
|
248
|
+
* circle(x, y, 5);
|
|
249
|
+
*
|
|
250
|
+
* // Gaussian distribution with a mean of 50 and sd of 1.
|
|
251
|
+
* x = randomGaussian(50);
|
|
252
|
+
* y = 50;
|
|
253
|
+
* circle(x, y, 5);
|
|
254
|
+
*
|
|
255
|
+
* // Gaussian distribution with a mean of 50 and sd of 10.
|
|
256
|
+
* x = randomGaussian(50, 10);
|
|
257
|
+
* y = 75;
|
|
258
|
+
* circle(x, y, 5);
|
|
259
|
+
* }
|
|
260
|
+
* </code>
|
|
261
|
+
* </div>
|
|
262
|
+
*/
|
|
263
|
+
function randomGaussian(mean?: number, sd?: number): number;
|
|
264
|
+
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export default function random(p5: any, fn: any): void;
|