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.
Files changed (160) hide show
  1. package/dist/accessibility/color_namer.js +5 -5
  2. package/dist/accessibility/describe.js +10 -0
  3. package/dist/accessibility/index.js +5 -5
  4. package/dist/accessibility/outputs.js +21 -0
  5. package/dist/app.js +5 -5
  6. package/dist/color/color_conversion.js +5 -5
  7. package/dist/color/creating_reading.js +1 -1
  8. package/dist/color/index.js +2 -2
  9. package/dist/color/p5.Color.js +1 -1
  10. package/dist/color/setting.js +2 -2
  11. package/dist/{constants-C-g_eAdC.js → constants-BRcElHU3.js} +19 -3
  12. package/dist/core/constants.js +1 -1
  13. package/dist/core/environment.js +6 -5
  14. package/dist/core/friendly_errors/fes_core.js +1 -1
  15. package/dist/core/friendly_errors/index.js +1 -1
  16. package/dist/core/friendly_errors/param_validator.js +46 -93
  17. package/dist/core/friendly_errors/sketch_reader.js +5 -5
  18. package/dist/core/friendly_errors/sketch_verifier.js +1 -1
  19. package/dist/core/friendly_errors/validate_params.js +5 -5
  20. package/dist/core/helpers.js +1 -1
  21. package/dist/core/init.js +5 -5
  22. package/dist/core/legacy.js +5 -5
  23. package/dist/core/main.js +5 -5
  24. package/dist/core/p5.Graphics.js +4 -4
  25. package/dist/core/p5.Renderer.js +3 -3
  26. package/dist/core/p5.Renderer2D.js +5 -5
  27. package/dist/core/rendering.js +4 -4
  28. package/dist/{creating_reading-D4AAKRbx.js → creating_reading-Cr8L2Jnm.js} +2 -2
  29. package/dist/dom/dom.js +10 -10
  30. package/dist/dom/index.js +2 -2
  31. package/dist/dom/p5.Element.js +2 -2
  32. package/dist/dom/p5.MediaElement.js +2 -2
  33. package/dist/events/acceleration.js +24 -24
  34. package/dist/events/keyboard.js +11 -6
  35. package/dist/image/const.js +1 -1
  36. package/dist/image/filterRenderer2D.js +4 -4
  37. package/dist/image/image.js +4 -4
  38. package/dist/image/index.js +4 -4
  39. package/dist/image/loading_displaying.js +4 -4
  40. package/dist/image/p5.Image.js +3 -3
  41. package/dist/image/pixels.js +1 -0
  42. package/dist/io/files.js +4 -4
  43. package/dist/io/index.js +4 -4
  44. package/dist/io/p5.TableRow.js +2 -2
  45. package/dist/{main-s72KWcUy.js → main-BKN5yFoS.js} +12 -9
  46. package/dist/math/Matrices/Matrix.js +1 -1
  47. package/dist/math/Matrices/MatrixNumjs.js +1 -1
  48. package/dist/math/index.js +1 -1
  49. package/dist/math/math.js +1 -1
  50. package/dist/math/p5.Matrix.js +1 -1
  51. package/dist/math/p5.Vector.js +1 -1
  52. package/dist/math/trigonometry.js +1 -1
  53. package/dist/{p5.Renderer-CwAYZOC2.js → p5.Renderer-R23xoC7s.js} +5 -5
  54. package/dist/{rendering--aAe5aq3.js → rendering-CvUVN-Vb.js} +101 -66
  55. package/dist/shape/2d_primitives.js +1 -1
  56. package/dist/shape/attributes.js +1 -1
  57. package/dist/shape/custom_shapes.js +2 -2
  58. package/dist/shape/index.js +2 -2
  59. package/dist/type/index.js +3 -3
  60. package/dist/type/p5.Font.js +3 -5
  61. package/dist/type/textCore.js +4 -4
  62. package/dist/webgl/3d_primitives.js +4 -4
  63. package/dist/webgl/GeometryBuilder.js +1 -1
  64. package/dist/webgl/ShapeBuilder.js +1 -1
  65. package/dist/webgl/index.js +4 -4
  66. package/dist/webgl/interaction.js +1 -1
  67. package/dist/webgl/light.js +4 -4
  68. package/dist/webgl/loading.js +5 -4
  69. package/dist/webgl/material.js +4 -4
  70. package/dist/webgl/p5.Camera.js +4 -4
  71. package/dist/webgl/p5.Framebuffer.js +4 -4
  72. package/dist/webgl/p5.Geometry.js +1 -1
  73. package/dist/webgl/p5.Quat.js +1 -1
  74. package/dist/webgl/p5.RendererGL.js +4 -4
  75. package/dist/webgl/p5.Shader.js +4 -4
  76. package/dist/webgl/p5.Texture.js +4 -4
  77. package/dist/webgl/text.js +32 -34
  78. package/lib/p5.esm.js +289 -247
  79. package/lib/p5.js +289 -247
  80. package/lib/p5.min.js +1 -1
  81. package/package.json +1 -2
  82. package/types/accessibility/color_namer.d.ts +8 -0
  83. package/types/accessibility/describe.d.ts +184 -0
  84. package/types/accessibility/gridOutput.d.ts +8 -0
  85. package/types/accessibility/outputs.d.ts +235 -0
  86. package/types/accessibility/textOutput.d.ts +8 -0
  87. package/types/color/color_conversion.d.ts +47 -0
  88. package/types/color/creating_reading.d.ts +1348 -0
  89. package/types/color/p5.Color.d.ts +1070 -0
  90. package/types/color/setting.d.ts +2085 -0
  91. package/types/core/constants.d.ts +341 -0
  92. package/types/core/environment.d.ts +668 -0
  93. package/types/core/friendly_errors/fes_core.d.ts +8 -0
  94. package/types/core/friendly_errors/file_errors.d.ts +8 -0
  95. package/types/core/friendly_errors/param_validator.d.ts +30 -0
  96. package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
  97. package/types/core/friendly_errors/stacktrace.d.ts +11 -0
  98. package/types/core/friendly_errors/validate_params.d.ts +8 -0
  99. package/types/core/helpers.d.ts +8 -0
  100. package/types/core/legacy.d.ts +8 -0
  101. package/types/core/main.d.ts +5999 -0
  102. package/types/core/p5.Graphics.d.ts +484 -0
  103. package/types/core/p5.Renderer.d.ts +14 -0
  104. package/types/core/reference.d.ts +8 -0
  105. package/types/core/rendering.d.ts +481 -0
  106. package/types/core/structure.d.ts +492 -0
  107. package/types/core/transform.d.ts +1638 -0
  108. package/types/data/local_storage.d.ts +323 -0
  109. package/types/dom/dom.d.ts +1295 -0
  110. package/types/dom/p5.Element.d.ts +2011 -0
  111. package/types/dom/p5.File.d.ts +13 -0
  112. package/types/dom/p5.MediaElement.d.ts +1249 -0
  113. package/types/events/acceleration.d.ts +193 -0
  114. package/types/events/keyboard.d.ts +501 -0
  115. package/types/events/pointer.d.ts +782 -0
  116. package/types/global.d.ts +5544 -0
  117. package/types/image/filterRenderer2D.d.ts +54 -0
  118. package/types/image/image.d.ts +326 -0
  119. package/types/image/loading_displaying.d.ts +580 -0
  120. package/types/image/p5.Image.d.ts +5882 -0
  121. package/types/image/pixels.d.ts +832 -0
  122. package/types/io/files.d.ts +1447 -0
  123. package/types/io/p5.Table.d.ts +1247 -0
  124. package/types/io/p5.TableRow.d.ts +343 -0
  125. package/types/io/p5.XML.d.ts +1188 -0
  126. package/types/math/Matrices/Matrix.d.ts +1029 -0
  127. package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
  128. package/types/math/calculation.d.ts +923 -0
  129. package/types/math/math.d.ts +90 -0
  130. package/types/math/noise.d.ts +311 -0
  131. package/types/math/p5.Matrix.d.ts +8 -0
  132. package/types/math/p5.Vector.d.ts +3416 -0
  133. package/types/math/random.d.ts +267 -0
  134. package/types/math/trigonometry.d.ts +663 -0
  135. package/types/p5.d.ts +6666 -0
  136. package/types/shape/2d_primitives.d.ts +1033 -0
  137. package/types/shape/attributes.d.ts +466 -0
  138. package/types/shape/curves.d.ts +740 -0
  139. package/types/shape/custom_shapes.d.ts +888 -0
  140. package/types/shape/vertex.d.ts +1141 -0
  141. package/types/type/p5.Font.d.ts +575 -0
  142. package/types/type/textCore.d.ts +1198 -0
  143. package/types/utilities/conversion.d.ts +894 -0
  144. package/types/utilities/time_date.d.ts +295 -0
  145. package/types/utilities/utility_functions.d.ts +587 -0
  146. package/types/webgl/3d_primitives.d.ts +1432 -0
  147. package/types/webgl/ShaderGenerator.d.ts +8 -0
  148. package/types/webgl/interaction.d.ts +371 -0
  149. package/types/webgl/light.d.ts +1184 -0
  150. package/types/webgl/loading.d.ts +482 -0
  151. package/types/webgl/material.d.ts +2656 -0
  152. package/types/webgl/p5.Camera.d.ts +3023 -0
  153. package/types/webgl/p5.DataArray.d.ts +61 -0
  154. package/types/webgl/p5.Framebuffer.d.ts +760 -0
  155. package/types/webgl/p5.Geometry.d.ts +1191 -0
  156. package/types/webgl/p5.Quat.d.ts +45 -0
  157. package/types/webgl/p5.RendererGL.d.ts +234 -0
  158. package/types/webgl/p5.Shader.d.ts +660 -0
  159. package/types/webgl/p5.Texture.d.ts +61 -0
  160. package/types/webgl/text.d.ts +74 -0
@@ -0,0 +1,587 @@
1
+ // This file is auto-generated from JSDoc documentation
2
+
3
+ import p5 from 'p5';
4
+
5
+ declare module 'p5' {
6
+ /**
7
+ * Converts a `Number` into a `String` with a given number of digits.`nf()` converts numbers such as `123.45` into strings formatted with a set
8
+ * number of digits, as in `'123.4500'`.The first parameter, `num`, is the number to convert to a string. For
9
+ * example, calling `nf(123.45)` returns the string `'123.45'`. If an array of
10
+ * numbers is passed, as in `nf([123.45, 67.89])`, an array of formatted
11
+ * strings will be returned.The second parameter, `left`, is optional. If a number is passed, as in
12
+ * `nf(123.45, 4)`, it sets the minimum number of digits to include to the
13
+ * left of the decimal place. If `left` is larger than the number of digits in
14
+ * `num`, then unused digits will be set to 0. For example, calling
15
+ * `nf(123.45, 4)` returns the string `'0123.45'`.The third parameter, `right`, is also optional. If a number is passed, as
16
+ * in `nf(123.45, 4, 1)`, it sets the minimum number of digits to include to
17
+ * the right of the decimal place. If `right` is smaller than the number of
18
+ * decimal places in `num`, then `num` will be rounded to the given number of
19
+ * decimal places. For example, calling `nf(123.45, 4, 1)` returns the string
20
+ * `'0123.5'`. If right is larger than the number of decimal places in `num`,
21
+ * then unused decimal places will be set to 0. For example, calling
22
+ * `nf(123.45, 4, 3)` returns the string `'0123.450'`.When the number is negative, for example, calling `nf(-123.45, 5, 2)`
23
+ * returns the string `'-00123.45'`.
24
+ *
25
+ * @param number to format.
26
+ * @param number of digits to include to the left of
27
+ * the decimal point.
28
+ * @param number of digits to include to the right
29
+ * of the decimal point.
30
+ * @return formatted string.
31
+ * @example <div>
32
+ * <code>
33
+ * function setup() {
34
+ * createCanvas(100, 100);
35
+ *
36
+ * background(200);
37
+ *
38
+ * // Style the text.
39
+ * textAlign(LEFT, CENTER);
40
+ * textSize(16);
41
+ *
42
+ * // Create a number variable.
43
+ * let number = 123.45;
44
+ *
45
+ * // Display the number as a string.
46
+ * let formatted = nf(number);
47
+ * text(formatted, 20, 20);
48
+ *
49
+ * let negative = nf(-number, 4, 2);
50
+ * text(negative, 20, 40);
51
+ *
52
+ * // Display the number with four digits
53
+ * // to the left of the decimal.
54
+ * let left = nf(number, 4);
55
+ * text(left, 20, 60);
56
+ *
57
+ * // Display the number with four digits
58
+ * // to the left of the decimal and one
59
+ * // to the right.
60
+ * let right = nf(number, 4, 1);
61
+ * text(right, 20, 80);
62
+ *
63
+ * describe(
64
+ * 'The numbers "123.45", "-0123.45", "0123.45", and "0123.5" written on four separate lines. The text is in black on a gray background.'
65
+ * );
66
+ * }
67
+ * </code>
68
+ * </div>
69
+ */
70
+ function nf(num: number | string, left?: number | string, right?: number | string): string;
71
+
72
+ /**
73
+ * @param numbers to format.
74
+ * @return formatted strings.
75
+ */
76
+ function nf(nums: number[], left?: number | string, right?: number | string): string[];
77
+
78
+ /**
79
+ * Converts a `Number` into a `String` with commas to mark units of 1,000.`nfc()` converts numbers such as 12345 into strings formatted with commas
80
+ * to mark the thousands place, as in `'12,345'`.The first parameter, `num`, is the number to convert to a string. For
81
+ * example, calling `nfc(12345)` returns the string `'12,345'`.The second parameter, `right`, is optional. If a number is passed, as in
82
+ * `nfc(12345, 1)`, it sets the minimum number of digits to include to the
83
+ * right of the decimal place. If `right` is smaller than the number of
84
+ * decimal places in `num`, then `num` will be rounded to the given number of
85
+ * decimal places. For example, calling `nfc(12345.67, 1)` returns the string
86
+ * `'12,345.7'`. If `right` is larger than the number of decimal places in
87
+ * `num`, then unused decimal places will be set to 0. For example, calling
88
+ * `nfc(12345.67, 3)` returns the string `'12,345.670'`.
89
+ *
90
+ * @param number to format.
91
+ * @param number of digits to include to the right
92
+ * of the decimal point.
93
+ * @return formatted string.
94
+ * @example <div>
95
+ * <code>
96
+ * function setup() {
97
+ * createCanvas(100, 100);
98
+ *
99
+ * background(200);
100
+ *
101
+ * // Style the text.
102
+ * textAlign(LEFT, CENTER);
103
+ * textSize(16);
104
+ *
105
+ * // Create a number variable.
106
+ * let number = 12345;
107
+ *
108
+ * // Display the number as a string.
109
+ * let commas = nfc(number);
110
+ * text(commas, 15, 33);
111
+ *
112
+ * // Display the number with four digits
113
+ * // to the left of the decimal.
114
+ * let decimals = nfc(number, 2);
115
+ * text(decimals, 15, 67);
116
+ *
117
+ * describe(
118
+ * 'The numbers "12,345" and "12,345.00" written on separate lines. The text is in black on a gray background.'
119
+ * );
120
+ * }
121
+ * </code>
122
+ * </div>
123
+ *
124
+ * <div>
125
+ * <code>
126
+ * function setup() {
127
+ * createCanvas(100, 100);
128
+ *
129
+ * background(200);
130
+ *
131
+ * // Create an array of numbers.
132
+ * let numbers = [12345, 6789];
133
+ *
134
+ * // Convert the numbers to formatted strings.
135
+ * let formatted = nfc(numbers);
136
+ *
137
+ * // Style the text.
138
+ * textAlign(CENTER, CENTER);
139
+ * textSize(14);
140
+ *
141
+ * // Iterate over the array.
142
+ * for (let i = 0; i < formatted.length; i += 1) {
143
+ *
144
+ * // Calculate the y-coordinate.
145
+ * let y = (i + 1) * 33;
146
+ *
147
+ * // Display the original and formatted numbers.
148
+ * text(`${numbers[i]} : ${formatted[i]}`, 50, y);
149
+ * }
150
+ *
151
+ * describe(
152
+ * 'The text "12345 : 12,345" and "6789 : 6,789" written on two separate lines. The text is in black on a gray background.'
153
+ * );
154
+ * }
155
+ * </code>
156
+ * </div>
157
+ */
158
+ function nfc(num: number | string, right?: number | string): string;
159
+
160
+ /**
161
+ * @param numbers to format.
162
+ * @return formatted strings.
163
+ */
164
+ function nfc(nums: number[], right?: number | string): string[];
165
+
166
+ /**
167
+ * Converts a `Number` into a `String` with a plus or minus sign.`nfp()` converts numbers such as 123 into strings formatted with a `+` or
168
+ * `-` symbol to mark whether they're positive or negative, as in `'+123'`.The first parameter, `num`, is the number to convert to a string. For
169
+ * example, calling `nfp(123.45)` returns the string `'+123.45'`. If an array
170
+ * of numbers is passed, as in `nfp([123.45, -6.78])`, an array of formatted
171
+ * strings will be returned.The second parameter, `left`, is optional. If a number is passed, as in
172
+ * `nfp(123.45, 4)`, it sets the minimum number of digits to include to the
173
+ * left of the decimal place. If `left` is larger than the number of digits in
174
+ * `num`, then unused digits will be set to 0. For example, calling
175
+ * `nfp(123.45, 4)` returns the string `'+0123.45'`.The third parameter, `right`, is also optional. If a number is passed, as
176
+ * in `nfp(123.45, 4, 1)`, it sets the minimum number of digits to include to
177
+ * the right of the decimal place. If `right` is smaller than the number of
178
+ * decimal places in `num`, then `num` will be rounded to the given number of
179
+ * decimal places. For example, calling `nfp(123.45, 4, 1)` returns the
180
+ * string `'+0123.5'`. If `right` is larger than the number of decimal places
181
+ * in `num`, then unused decimal places will be set to 0. For example,
182
+ * calling `nfp(123.45, 4, 3)` returns the string `'+0123.450'`.
183
+ *
184
+ * @param number to format.
185
+ * @param number of digits to include to the left of the
186
+ * decimal point.
187
+ * @param number of digits to include to the right of the
188
+ * decimal point.
189
+ * @return formatted string.
190
+ * @example <div>
191
+ * <code>
192
+ * function setup() {
193
+ * createCanvas(100, 100);
194
+ *
195
+ * background(200);
196
+ *
197
+ * // Create number variables.
198
+ * let positive = 123;
199
+ * let negative = -123;
200
+ *
201
+ * // Convert the positive number to a formatted string.
202
+ * let p = nfp(positive);
203
+ *
204
+ * // Convert the negative number to a formatted string
205
+ * // with four digits to the left of the decimal
206
+ * // and two digits to the right of the decimal.
207
+ * let n = nfp(negative, 4, 2);
208
+ *
209
+ * // Style the text.
210
+ * textAlign(CENTER, CENTER);
211
+ * textSize(14);
212
+ *
213
+ * // Display the original and formatted numbers.
214
+ * text(`${positive} : ${p}`, 50, 33);
215
+ * text(`${negative} : ${n}`, 50, 67);
216
+ *
217
+ * describe(
218
+ * 'The text "123 : +123" and "-123 : -123.00" written on separate lines. The text is in black on a gray background.'
219
+ * );
220
+ * }
221
+ * </code>
222
+ * </div>
223
+ *
224
+ * <div>
225
+ * <code>
226
+ * function setup() {
227
+ * createCanvas(100, 100);
228
+ *
229
+ * background(200);
230
+ *
231
+ * // Create number variables.
232
+ * let numbers = [123, -4.56];
233
+ *
234
+ * // Convert the numbers to formatted strings
235
+ * // with four digits to the left of the decimal
236
+ * // and one digit to the right of the decimal.
237
+ * let formatted = nfp(numbers, 4, 1);
238
+ *
239
+ * // Style the text.
240
+ * textAlign(CENTER, CENTER);
241
+ * textSize(14);
242
+ *
243
+ * // Iterate over the array.
244
+ * for (let i = 0; i < formatted.length; i += 1) {
245
+ *
246
+ * // Calculate the y-coordinate.
247
+ * let y = (i + 1) * 33;
248
+ *
249
+ * // Display the original and formatted numbers.
250
+ * text(`${numbers[i]} : ${formatted[i]}`, 50, y);
251
+ * }
252
+ *
253
+ * describe(
254
+ * 'The text "123 : +0123.0" and "-4.56 : 00-4.6" written on separate lines. The text is in black on a gray background.'
255
+ * );
256
+ * }
257
+ * </code>
258
+ * </div>
259
+ */
260
+ function nfp(num: number, left?: number, right?: number): string;
261
+
262
+ /**
263
+ * @param numbers to format.
264
+ * @return formatted strings.
265
+ */
266
+ function nfp(nums: number[], left?: number, right?: number): string[];
267
+
268
+ /**
269
+ * Converts a positive `Number` into a `String` with an extra space in front.`nfs()` converts positive numbers such as 123.45 into strings formatted
270
+ * with an extra space in front, as in ' 123.45'. Doing so can be helpful for
271
+ * aligning positive and negative numbers.The first parameter, `num`, is the number to convert to a string. For
272
+ * example, calling `nfs(123.45)` returns the string `' 123.45'`.The second parameter, `left`, is optional. If a number is passed, as in
273
+ * `nfs(123.45, 4)`, it sets the minimum number of digits to include to the
274
+ * left of the decimal place. If `left` is larger than the number of digits in
275
+ * `num`, then unused digits will be set to 0. For example, calling
276
+ * `nfs(123.45, 4)` returns the string `' 0123.45'`.The third parameter, `right`, is also optional. If a number is passed, as
277
+ * in `nfs(123.45, 4, 1)`, it sets the minimum number of digits to include to
278
+ * the right of the decimal place. If `right` is smaller than the number of
279
+ * decimal places in `num`, then `num` will be rounded to the given number of
280
+ * decimal places. For example, calling `nfs(123.45, 4, 1)` returns the
281
+ * string `' 0123.5'`. If `right` is larger than the number of decimal places
282
+ * in `num`, then unused decimal places will be set to 0. For example,
283
+ * calling `nfs(123.45, 4, 3)` returns the string `' 0123.450'`.
284
+ *
285
+ * @param number to format.
286
+ * @param number of digits to include to the left of the
287
+ * decimal point.
288
+ * @param number of digits to include to the right of the
289
+ * decimal point.
290
+ * @return formatted string.
291
+ * @example <div>
292
+ * <code>
293
+ * function setup() {
294
+ * createCanvas(100, 100);
295
+ *
296
+ * background(200);
297
+ *
298
+ * // Create number variables.
299
+ * let positive = 123;
300
+ * let negative = -123;
301
+ *
302
+ * // Convert the positive number to a formatted string.
303
+ * let formatted = nfs(positive);
304
+ *
305
+ * // Style the text.
306
+ * textAlign(CENTER, CENTER);
307
+ * textFont('Courier New');
308
+ * textSize(16);
309
+ *
310
+ * // Display the negative number and the formatted positive number.
311
+ * text(negative, 50, 33);
312
+ * text(formatted, 50, 67);
313
+ *
314
+ * describe(
315
+ * 'The numbers -123 and 123 written on separate lines. The numbers align vertically. The text is in black on a gray background.'
316
+ * );
317
+ * }
318
+ * </code>
319
+ * </div>
320
+ *
321
+ * <div>
322
+ * <code>
323
+ * function setup() {
324
+ * createCanvas(100, 100);
325
+ *
326
+ * background(200);
327
+ *
328
+ * // Create a number variable.
329
+ * let number = 123.45;
330
+ *
331
+ * // Convert the positive number to a formatted string.
332
+ * // Use four digits to the left of the decimal and
333
+ * // one digit to the right.
334
+ * let formatted = nfs(number, 4, 1);
335
+ *
336
+ * // Style the text.
337
+ * textAlign(CENTER, CENTER);
338
+ * textFont('Courier New');
339
+ * textSize(16);
340
+ *
341
+ * // Display a negative version of the number and
342
+ * // the formatted positive version.
343
+ * text('-0123.5', 50, 33);
344
+ * text(formatted, 50, 67);
345
+ *
346
+ * describe(
347
+ * 'The numbers "-0123.5" and "0123.5" written on separate lines. The numbers align vertically. The text is in black on a gray background.'
348
+ * );
349
+ * }
350
+ * </code>
351
+ * </div>
352
+ */
353
+ function nfs(num: number, left?: number, right?: number): string;
354
+
355
+ /**
356
+ * @param numbers to format.
357
+ * @return formatted strings.
358
+ */
359
+ function nfs(nums: Array, left?: number, right?: number): string[];
360
+
361
+ /**
362
+ * Splits a `String` into pieces and returns an array containing the pieces.`splitTokens()` is an enhanced version of
363
+ * split(). It can split a string when any characters
364
+ * from a list are detected.The first parameter, `value`, is the string to split.The second parameter, `delim`, is optional. It sets the character(s) that
365
+ * should be used to split the string. `delim` can be a single string, as in
366
+ * `splitTokens('rock...paper...scissors...shoot', '...')`, or an array of
367
+ * strings, as in
368
+ * `splitTokens('rock;paper,scissors...shoot, [';', ',', '...'])`. By default,
369
+ * if no `delim` characters are specified, then any whitespace character is
370
+ * used to split. Whitespace characters include tab (`\t`), line feed (`\n`),
371
+ * carriage return (`\r`), form feed (`\f`), and space.
372
+ *
373
+ * @deprecated This will be removed in a future version of p5.js to make way for a new, friendlier version :)
374
+ * @param string to split.
375
+ * @param character(s) to use for splitting the string.
376
+ * @return separated strings.
377
+ * @example <div>
378
+ * <code>
379
+ * function setup() {
380
+ * createCanvas(100, 100);
381
+ *
382
+ * background(200);
383
+ *
384
+ * // Create a string variable.
385
+ * let string = 'rock paper scissors shoot';
386
+ *
387
+ * // Split the string at each space.
388
+ * let words = splitTokens(string);
389
+ *
390
+ * // Print the array to the console.
391
+ * print(words);
392
+ *
393
+ * // Style the text.
394
+ * textAlign(CENTER, CENTER);
395
+ * textFont('Courier New');
396
+ * textSize(12);
397
+ *
398
+ * // Iterate over the words array.
399
+ * for (let i = 0; i < words.length; i += 1) {
400
+ *
401
+ * // Calculate the y-coordinate.
402
+ * let y = (i + 1) * 20;
403
+ *
404
+ * // Display the word.
405
+ * text(words[i], 50, y);
406
+ * }
407
+ *
408
+ * describe(
409
+ * 'The words "rock", "paper", "scissors", and "shoot" written on separate lines. The text is black on a gray background.'
410
+ * );
411
+ * }
412
+ * </code>
413
+ * </div>
414
+ *
415
+ * <div>
416
+ * <code>
417
+ * function setup() {
418
+ * createCanvas(100, 100);
419
+ *
420
+ * background(200);
421
+ *
422
+ * // Create a string variable.
423
+ * let string = 'rock...paper...scissors...shoot';
424
+ *
425
+ * // Split the string at each ...
426
+ * let words = splitTokens(string, '...');
427
+ *
428
+ * // Print the array to the console.
429
+ * print(words);
430
+ *
431
+ * // Style the text.
432
+ * textAlign(CENTER, CENTER);
433
+ * textFont('Courier New');
434
+ * textSize(12);
435
+ *
436
+ * // Iterate over the words array.
437
+ * for (let i = 0; i < words.length; i += 1) {
438
+ *
439
+ * // Calculate the y-coordinate.
440
+ * let y = (i + 1) * 20;
441
+ *
442
+ * // Display the word.
443
+ * text(words[i], 50, y);
444
+ * }
445
+ *
446
+ * describe(
447
+ * 'The words "rock", "paper", "scissors", and "shoot" written on separate lines. The text is black on a gray background.'
448
+ * );
449
+ * }
450
+ * </code>
451
+ * </div>
452
+ *
453
+ * <div class='notest'>
454
+ * <code>
455
+ * function setup() {
456
+ * createCanvas(100, 100);
457
+ *
458
+ * background(200);
459
+ *
460
+ * // Create a string variable.
461
+ * let string = 'rock;paper,scissors...shoot';
462
+ *
463
+ * // Split the string at each semicolon, comma, or ...
464
+ * let words = splitTokens(string, [';', ',', '...']);
465
+ *
466
+ * // Print the array to the console.
467
+ * print(words);
468
+ *
469
+ * // Style the text.
470
+ * textAlign(CENTER, CENTER);
471
+ * textFont('Courier New');
472
+ * textSize(12);
473
+ *
474
+ * // Iterate over the words array.
475
+ * for (let i = 0; i < words.length; i += 1) {
476
+ *
477
+ * // Calculate the y-coordinate.
478
+ * let y = (i + 1) * 20;
479
+ *
480
+ * // Display the word.
481
+ * text(words[i], 50, y);
482
+ * }
483
+ *
484
+ * describe(
485
+ * 'The words "rock", "paper", "scissors", and "shoot" written on separate lines. The text is black on a gray background.'
486
+ * );
487
+ * }
488
+ * </code>
489
+ * </div>
490
+ */
491
+ function splitTokens(value: string, delim?: string): string[];
492
+
493
+ /**
494
+ * Shuffles the elements of an array.The first parameter, `array`, is the array to be shuffled. For example,
495
+ * calling `shuffle(myArray)` will shuffle the elements of `myArray`. By
496
+ * default, the original array won’t be modified. Instead, a copy will be
497
+ * created, shuffled, and returned.The second parameter, `modify`, is optional. If `true` is passed, as in
498
+ * `shuffle(myArray, true)`, then the array will be shuffled in place without
499
+ * making a copy.
500
+ *
501
+ * @param array to shuffle.
502
+ * @param if `true`, shuffle the original array in place. Defaults to `false`.
503
+ * @return shuffled array.
504
+ * @example <div>
505
+ * <code>
506
+ * function setup() {
507
+ * createCanvas(100, 100);
508
+ *
509
+ * background(200);
510
+ *
511
+ * // Create an array of colors.
512
+ * let colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];
513
+ *
514
+ * // Create a shuffled copy of the array.
515
+ * let shuffledColors = shuffle(colors);
516
+ *
517
+ * // Draw a row of circles using the original array.
518
+ * for (let i = 0; i < colors.length; i += 1) {
519
+ * // Calculate the x-coordinate.
520
+ * let x = (i + 1) * 12.5;
521
+ *
522
+ * // Style the circle.
523
+ * let c = colors[i];
524
+ * fill(c);
525
+ *
526
+ * // Draw the circle.
527
+ * circle(x, 33, 10);
528
+ * }
529
+ *
530
+ * // Draw a row of circles using the original array.
531
+ * for (let i = 0; i < shuffledColors.length; i += 1) {
532
+ * // Calculate the x-coordinate.
533
+ * let x = (i + 1) * 12.5;
534
+ *
535
+ * // Style the circle.
536
+ * let c = shuffledColors[i];
537
+ * fill(c);
538
+ *
539
+ * // Draw the circle.
540
+ * circle(x, 67, 10);
541
+ * }
542
+ *
543
+ * describe(
544
+ * 'Two rows of circles on a gray background. The top row follows the color sequence ROYGBIV. The bottom row has all the same colors but they are shuffled.'
545
+ * );
546
+ * }
547
+ * </code>
548
+ * </div>
549
+ *
550
+ * <div>
551
+ * <code>
552
+ * function setup() {
553
+ * createCanvas(100, 100);
554
+ *
555
+ * background(200);
556
+ *
557
+ * // Create an array of colors.
558
+ * let colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];
559
+ *
560
+ * // Shuffle the array.
561
+ * shuffle(colors, true);
562
+ *
563
+ * // Draw a row of circles using the original array.
564
+ * for (let i = 0; i < colors.length; i += 1) {
565
+ * // Calculate the x-coordinate.
566
+ * let x = (i + 1) * 12.5;
567
+ *
568
+ * // Style the circle.
569
+ * let c = colors[i];
570
+ * fill(c);
571
+ *
572
+ * // Draw the circle.
573
+ * circle(x, 50, 10);
574
+ * }
575
+ *
576
+ * describe(
577
+ * 'A row of colorful circles on a gray background. Their sequence changes each time the sketch runs.'
578
+ * );
579
+ * }
580
+ * </code>
581
+ * </div>
582
+ */
583
+ function shuffle(array: Array, bool?: boolean): Array;
584
+
585
+ }
586
+
587
+ export default function utility_functions(p5: any, fn: any): void;