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,1033 @@
1
+ // This file is auto-generated from JSDoc documentation
2
+
3
+ import p5 from 'p5';
4
+ import { Vector } from '../math/p5.Vector';
5
+
6
+ declare module 'p5' {
7
+ /**
8
+ * This function does 3 things:
9
+ *
10
+ */
11
+ function _normalizeArcAngles(start: any, stop: any, width: any, height: any, correctForScaling: any): void;
12
+
13
+ /**
14
+ * Draws an arc.An arc is a section of an ellipse defined by the `x`, `y`, `w`, and
15
+ * `h` parameters. `x` and `y` set the location of the arc's center. `w` and
16
+ * `h` set the arc's width and height. See
17
+ * ellipse() and
18
+ * ellipseMode() for more details.The fifth and sixth parameters, `start` and `stop`, set the angles
19
+ * between which to draw the arc. Arcs are always drawn clockwise from
20
+ * `start` to `stop`. Angles are always given in radians.The seventh parameter, `mode`, is optional. It determines the arc's fill
21
+ * style. The fill modes are a semi-circle (`OPEN`), a closed semi-circle
22
+ * (`CHORD`), or a closed pie segment (`PIE`).The eighth parameter, `detail`, is also optional. It determines how many
23
+ * vertices are used to draw the arc in WebGL mode. The default value is 25.
24
+ *
25
+ * @param x-coordinate of the arc's ellipse.
26
+ * @param y-coordinate of the arc's ellipse.
27
+ * @param width of the arc's ellipse by default.
28
+ * @param height of the arc's ellipse by default.
29
+ * @param angle to start the arc, specified in radians.
30
+ * @param angle to stop the arc, specified in radians.
31
+ * @param optional parameter to determine the way of drawing
32
+ * the arc. either CHORD, PIE, or OPEN.
33
+ * @param optional parameter for WebGL mode only. This is to
34
+ * specify the number of vertices that makes up the
35
+ * perimeter of the arc. Default value is 25. Won't
36
+ * draw a stroke for a detail of more than 50.
37
+ * @example <div>
38
+ * <code>
39
+ * function setup() {
40
+ * createCanvas(100, 100);
41
+ *
42
+ * background(200);
43
+ *
44
+ * arc(50, 50, 80, 80, 0, PI + HALF_PI);
45
+ *
46
+ * describe('A white circle on a gray canvas. The top-right quarter of the circle is missing.');
47
+ * }
48
+ * </code>
49
+ * </div>
50
+ * @example <div>
51
+ * <code>
52
+ * function setup() {
53
+ * createCanvas(100, 100);
54
+ *
55
+ * background(200);
56
+ *
57
+ * arc(50, 50, 80, 40, 0, PI + HALF_PI);
58
+ *
59
+ * describe('A white ellipse on a gray canvas. The top-right quarter of the ellipse is missing.');
60
+ * }
61
+ * </code>
62
+ * </div>
63
+ * @example <div>
64
+ * <code>
65
+ * function setup() {
66
+ * createCanvas(100, 100);
67
+ *
68
+ * background(200);
69
+ *
70
+ * // Bottom-right.
71
+ * arc(50, 55, 50, 50, 0, HALF_PI);
72
+ *
73
+ * noFill();
74
+ *
75
+ * // Bottom-left.
76
+ * arc(50, 55, 60, 60, HALF_PI, PI);
77
+ *
78
+ * // Top-left.
79
+ * arc(50, 55, 70, 70, PI, PI + QUARTER_PI);
80
+ *
81
+ * // Top-right.
82
+ * arc(50, 55, 80, 80, PI + QUARTER_PI, TWO_PI);
83
+ *
84
+ * describe(
85
+ * 'A shattered outline of an circle with a quarter of a white circle at the bottom-right.'
86
+ * );
87
+ * }
88
+ * </code>
89
+ * </div>
90
+ *
91
+ * <div>
92
+ * <code>
93
+ * function setup() {
94
+ * createCanvas(100, 100);
95
+ *
96
+ * background(200);
97
+ *
98
+ * // Default fill mode.
99
+ * arc(50, 50, 80, 80, 0, PI + QUARTER_PI);
100
+ *
101
+ * describe('A white circle with the top-right third missing. The bottom is outlined in black.');
102
+ * }
103
+ * </code>
104
+ * </div>
105
+ *
106
+ * <div>
107
+ * <code>
108
+ * function setup() {
109
+ * createCanvas(100, 100);
110
+ *
111
+ * background(200);
112
+ *
113
+ * // OPEN fill mode.
114
+ * arc(50, 50, 80, 80, 0, PI + QUARTER_PI, OPEN);
115
+ *
116
+ * describe(
117
+ * 'A white circle missing a section from the top-right. The bottom is outlined in black.'
118
+ * );
119
+ * }
120
+ * </code>
121
+ * </div>
122
+ *
123
+ * <div>
124
+ * <code>
125
+ * function setup() {
126
+ * createCanvas(100, 100);
127
+ *
128
+ * background(200);
129
+ *
130
+ * // CHORD fill mode.
131
+ * arc(50, 50, 80, 80, 0, PI + QUARTER_PI, CHORD);
132
+ *
133
+ * describe('A white circle with a black outline missing a section from the top-right.');
134
+ * }
135
+ * </code>
136
+ * </div>
137
+ *
138
+ * <div>
139
+ * <code>
140
+ * function setup() {
141
+ * createCanvas(100, 100);
142
+ *
143
+ * background(200);
144
+ *
145
+ * // PIE fill mode.
146
+ * arc(50, 50, 80, 80, 0, PI + QUARTER_PI, PIE);
147
+ *
148
+ * describe('A white circle with a black outline. The top-right third is missing.');
149
+ * }
150
+ * </code>
151
+ * </div>
152
+ *
153
+ * <div>
154
+ * <code>
155
+ * function setup() {
156
+ * createCanvas(100, 100, WEBGL);
157
+ *
158
+ * background(200);
159
+ *
160
+ * // PIE fill mode.
161
+ * arc(0, 0, 80, 80, 0, PI + QUARTER_PI, PIE);
162
+ *
163
+ * describe('A white circle with a black outline. The top-right third is missing.');
164
+ * }
165
+ * </code>
166
+ * </div>
167
+ *
168
+ * <div>
169
+ * <code>
170
+ * function setup() {
171
+ * createCanvas(100, 100, WEBGL);
172
+ *
173
+ * background(200);
174
+ *
175
+ * // PIE fill mode with 5 vertices.
176
+ * arc(0, 0, 80, 80, 0, PI + QUARTER_PI, PIE, 5);
177
+ *
178
+ * describe('A white circle with a black outline. The top-right third is missing.');
179
+ * }
180
+ * </code>
181
+ * </div>
182
+ *
183
+ * <div>
184
+ * <code>
185
+ * function setup() {
186
+ * createCanvas(100, 100);
187
+ *
188
+ * describe('A yellow circle on a black background. The circle opens and closes its mouth.');
189
+ * }
190
+ *
191
+ * function draw() {
192
+ * background(0);
193
+ *
194
+ * // Style the arc.
195
+ * noStroke();
196
+ * fill(255, 255, 0);
197
+ *
198
+ * // Update start and stop angles.
199
+ * let biteSize = PI / 16;
200
+ * let startAngle = biteSize * sin(frameCount * 0.1) + biteSize;
201
+ * let endAngle = TWO_PI - startAngle;
202
+ *
203
+ * // Draw the arc.
204
+ * arc(50, 50, 80, 80, startAngle, endAngle, PIE);
205
+ * }
206
+ * </code>
207
+ * </div>
208
+ */
209
+ function arc(x: number, y: number, w: number, h: number, start: number, stop: number, mode?: CHORD | PIE | OPEN, detail?: number): void;
210
+
211
+ /**
212
+ * Draws an ellipse (oval).An ellipse is a round shape defined by the `x`, `y`, `w`, and
213
+ * `h` parameters. `x` and `y` set the location of its center. `w` and
214
+ * `h` set its width and height. See
215
+ * ellipseMode() for other ways to set
216
+ * its position.If no height is set, the value of width is used for both the width and
217
+ * height. If a negative height or width is specified, the absolute value is
218
+ * taken.The fifth parameter, `detail`, is also optional. It determines how many
219
+ * vertices are used to draw the ellipse in WebGL mode. The default value is
220
+ * 25.
221
+ *
222
+ * @param x-coordinate of the center of the ellipse.
223
+ * @param y-coordinate of the center of the ellipse.
224
+ * @param width of the ellipse.
225
+ * @param height of the ellipse.
226
+ * @example <div>
227
+ * <code>
228
+ * function setup() {
229
+ * createCanvas(100, 100);
230
+ *
231
+ * background(200);
232
+ *
233
+ * ellipse(50, 50, 80, 80);
234
+ *
235
+ * describe('A white circle on a gray canvas.');
236
+ * }
237
+ * </code>
238
+ * </div>
239
+ * @example <div>
240
+ * <code>
241
+ * function setup() {
242
+ * createCanvas(100, 100);
243
+ *
244
+ * background(200);
245
+ *
246
+ * ellipse(50, 50, 80);
247
+ *
248
+ * describe('A white circle on a gray canvas.');
249
+ * }
250
+ * </code>
251
+ * </div>
252
+ * @example <div>
253
+ * <code>
254
+ * function setup() {
255
+ * createCanvas(100, 100);
256
+ *
257
+ * background(200);
258
+ *
259
+ * ellipse(50, 50, 80, 40);
260
+ *
261
+ * describe('A white ellipse on a gray canvas.');
262
+ * }
263
+ * </code>
264
+ * </div>
265
+ * @example <div>
266
+ * <code>
267
+ * function setup() {
268
+ * createCanvas(100, 100, WEBGL);
269
+ *
270
+ * background(200);
271
+ *
272
+ * ellipse(0, 0, 80, 40);
273
+ *
274
+ * describe('A white ellipse on a gray canvas.');
275
+ * }
276
+ * </code>
277
+ * </div>
278
+ * @example <div>
279
+ * <code>
280
+ * function setup() {
281
+ * createCanvas(100, 100, WEBGL);
282
+ *
283
+ * background(200);
284
+ *
285
+ * // Use 6 vertices.
286
+ * ellipse(0, 0, 80, 40, 6);
287
+ *
288
+ * describe('A white hexagon on a gray canvas.');
289
+ * }
290
+ * </code>
291
+ * </div>
292
+ */
293
+ function ellipse(x: number, y: number, w: number, h?: number): void;
294
+
295
+ /**
296
+ * @param optional parameter for WebGL mode only. This is to
297
+ * specify the number of vertices that makes up the
298
+ * perimeter of the ellipse. Default value is 25. Won't
299
+ * draw a stroke for a detail of more than 50.
300
+ */
301
+ function ellipse(x: number, y: number, w: number, h: number, detail?: number): void;
302
+
303
+ /**
304
+ * Draws a circle.A circle is a round shape defined by the `x`, `y`, and `d` parameters.
305
+ * `x` and `y` set the location of its center. `d` sets its width and height (diameter).
306
+ * Every point on the circle's edge is the same distance, `0.5 * d`, from its center.
307
+ * `0.5 * d` (half the diameter) is the circle's radius.
308
+ * See ellipseMode() for other ways to set its position.
309
+ *
310
+ * @param x-coordinate of the center of the circle.
311
+ * @param y-coordinate of the center of the circle.
312
+ * @param diameter of the circle.
313
+ * @example <div>
314
+ * <code>
315
+ * function setup() {
316
+ * createCanvas(100, 100);
317
+ *
318
+ * background(200);
319
+ *
320
+ * circle(50, 50, 25);
321
+ *
322
+ * describe('A white circle with black outline in the middle of a gray canvas.');
323
+ * }
324
+ * </code>
325
+ * </div>
326
+ * @example <div>
327
+ * <code>
328
+ * function setup() {
329
+ * createCanvas(100, 100, WEBGL);
330
+ *
331
+ * background(200);
332
+ *
333
+ * circle(0, 0, 25);
334
+ *
335
+ * describe('A white circle with black outline in the middle of a gray canvas.');
336
+ * }
337
+ * </code>
338
+ * </div>
339
+ */
340
+ function circle(x: number, y: number, d: number): void;
341
+
342
+ /**
343
+ * Draws a straight line between two points.A line's default width is one pixel. The version of `line()` with four
344
+ * parameters draws the line in 2D. To color a line, use the
345
+ * stroke() function. To change its width, use the
346
+ * strokeWeight() function. A line
347
+ * can't be filled, so the fill() function won't
348
+ * affect the line's color.The version of `line()` with six parameters allows the line to be drawn in
349
+ * 3D space. Doing so requires adding the `WEBGL` argument to
350
+ * createCanvas().
351
+ *
352
+ * @param the x-coordinate of the first point.
353
+ * @param the y-coordinate of the first point.
354
+ * @param the x-coordinate of the second point.
355
+ * @param the y-coordinate of the second point.
356
+ * @example <div>
357
+ * <code>
358
+ * function setup() {
359
+ * createCanvas(100, 100);
360
+ *
361
+ * background(200);
362
+ *
363
+ * line(30, 20, 85, 75);
364
+ *
365
+ * describe(
366
+ * 'A black line on a gray canvas running from top-center to bottom-right.'
367
+ * );
368
+ * }
369
+ * </code>
370
+ * </div>
371
+ * @example <div>
372
+ * <code>
373
+ * function setup() {
374
+ * createCanvas(100, 100);
375
+ *
376
+ * background(200);
377
+ *
378
+ * // Style the line.
379
+ * stroke('magenta');
380
+ * strokeWeight(5);
381
+ *
382
+ * line(30, 20, 85, 75);
383
+ *
384
+ * describe(
385
+ * 'A thick, magenta line on a gray canvas running from top-center to bottom-right.'
386
+ * );
387
+ * }
388
+ * </code>
389
+ * </div>
390
+ *
391
+ * <div>
392
+ * <code>
393
+ * function setup() {
394
+ * createCanvas(100, 100);
395
+ *
396
+ * background(200);
397
+ *
398
+ * // Top.
399
+ * line(30, 20, 85, 20);
400
+ *
401
+ * // Right.
402
+ * stroke(126);
403
+ * line(85, 20, 85, 75);
404
+ *
405
+ * // Bottom.
406
+ * stroke(255);
407
+ * line(85, 75, 30, 75);
408
+ *
409
+ * describe(
410
+ * 'Three lines drawn in grayscale on a gray canvas. They form the top, right, and bottom sides of a square.'
411
+ * );
412
+ * }
413
+ * </code>
414
+ * </div>
415
+ * @example <div>
416
+ * <code>
417
+ * function setup() {
418
+ * createCanvas(100, 100, WEBGL);
419
+ *
420
+ * background(200);
421
+ *
422
+ * line(-20, -30, 35, 25);
423
+ *
424
+ * describe(
425
+ * 'A black line on a gray canvas running from top-center to bottom-right.'
426
+ * );
427
+ * }
428
+ * </code>
429
+ * </div>
430
+ *
431
+ * <div>
432
+ * <code>
433
+ * function setup() {
434
+ * createCanvas(100, 100, WEBGL);
435
+ *
436
+ * describe('A black line connecting two spheres. The scene spins slowly.');
437
+ * }
438
+ *
439
+ * function draw() {
440
+ * background(200);
441
+ *
442
+ * // Rotate around the y-axis.
443
+ * rotateY(frameCount * 0.01);
444
+ *
445
+ * // Draw a line.
446
+ * line(0, 0, 0, 30, 20, -10);
447
+ *
448
+ * // Draw the center sphere.
449
+ * sphere(10);
450
+ *
451
+ * // Translate to the second point.
452
+ * translate(30, 20, -10);
453
+ *
454
+ * // Draw the bottom-right sphere.
455
+ * sphere(10);
456
+ * }
457
+ * </code>
458
+ * </div>
459
+ */
460
+ function line(x1: number, y1: number, x2: number, y2: number): void;
461
+
462
+ /**
463
+ * @param the z-coordinate of the first point.
464
+ * @param the z-coordinate of the second point.
465
+ */
466
+ function line(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): void;
467
+
468
+ /**
469
+ * Draws a single point in space.A point's default width is one pixel. To color a point, use the
470
+ * stroke() function. To change its width, use the
471
+ * strokeWeight() function. A point
472
+ * can't be filled, so the fill() function won't
473
+ * affect the point's color.The version of `point()` with two parameters allows the point's location to
474
+ * be set with its x- and y-coordinates, as in `point(10, 20)`.The version of `point()` with three parameters allows the point to be drawn
475
+ * in 3D space with x-, y-, and z-coordinates, as in `point(10, 20, 30)`.
476
+ * Doing so requires adding the `WEBGL` argument to
477
+ * createCanvas().The version of `point()` with one parameter allows the point's location to
478
+ * be set with a p5.Vector object.
479
+ *
480
+ * @param the x-coordinate.
481
+ * @param the y-coordinate.
482
+ * @param the z-coordinate (for WebGL mode).
483
+ * @example <div>
484
+ * <code>
485
+ * function setup() {
486
+ * createCanvas(100, 100);
487
+ *
488
+ * background(200);
489
+ *
490
+ * // Top-left.
491
+ * point(30, 20);
492
+ *
493
+ * // Top-right.
494
+ * point(85, 20);
495
+ *
496
+ * // Bottom-right.
497
+ * point(85, 75);
498
+ *
499
+ * // Bottom-left.
500
+ * point(30, 75);
501
+ *
502
+ * describe(
503
+ * 'Four small, black points drawn on a gray canvas. The points form the corners of a square.'
504
+ * );
505
+ * }
506
+ * </code>
507
+ * </div>
508
+ *
509
+ * <div>
510
+ * <code>
511
+ * function setup() {
512
+ * createCanvas(100, 100);
513
+ *
514
+ * background(200);
515
+ *
516
+ * // Top-left.
517
+ * point(30, 20);
518
+ *
519
+ * // Top-right.
520
+ * point(70, 20);
521
+ *
522
+ * // Style the next points.
523
+ * stroke('purple');
524
+ * strokeWeight(10);
525
+ *
526
+ * // Bottom-right.
527
+ * point(70, 80);
528
+ *
529
+ * // Bottom-left.
530
+ * point(30, 80);
531
+ *
532
+ * describe(
533
+ * 'Four points drawn on a gray canvas. Two are black and two are purple. The points form the corners of a square.'
534
+ * );
535
+ * }
536
+ * </code>
537
+ * </div>
538
+ *
539
+ * <div>
540
+ * <code>
541
+ * function setup() {
542
+ * createCanvas(100, 100);
543
+ *
544
+ * background(200);
545
+ *
546
+ * // Top-left.
547
+ * let a = createVector(30, 20);
548
+ * point(a);
549
+ *
550
+ * // Top-right.
551
+ * let b = createVector(70, 20);
552
+ * point(b);
553
+ *
554
+ * // Bottom-right.
555
+ * let c = createVector(70, 80);
556
+ * point(c);
557
+ *
558
+ * // Bottom-left.
559
+ * let d = createVector(30, 80);
560
+ * point(d);
561
+ *
562
+ * describe(
563
+ * 'Four small, black points drawn on a gray canvas. The points form the corners of a square.'
564
+ * );
565
+ * }
566
+ * </code>
567
+ * </div>
568
+ *
569
+ * <div>
570
+ * <code>
571
+ * function setup() {
572
+ * createCanvas(100, 100, WEBGL);
573
+ *
574
+ * describe('Two purple points drawn on a gray canvas.');
575
+ * }
576
+ *
577
+ * function draw() {
578
+ * background(200);
579
+ *
580
+ * // Style the points.
581
+ * stroke('purple');
582
+ * strokeWeight(10);
583
+ *
584
+ * // Top-left.
585
+ * point(-20, -30);
586
+ *
587
+ * // Bottom-right.
588
+ * point(20, 30);
589
+ * }
590
+ * </code>
591
+ * </div>
592
+ *
593
+ * <div>
594
+ * <code>
595
+ * function setup() {
596
+ * createCanvas(100, 100, WEBGL);
597
+ *
598
+ * describe('Two purple points drawn on a gray canvas. The scene spins slowly.');
599
+ * }
600
+ *
601
+ * function draw() {
602
+ * background(200);
603
+ *
604
+ * // Rotate around the y-axis.
605
+ * rotateY(frameCount * 0.01);
606
+ *
607
+ * // Style the points.
608
+ * stroke('purple');
609
+ * strokeWeight(10);
610
+ *
611
+ * // Top-left.
612
+ * point(-20, -30, 0);
613
+ *
614
+ * // Bottom-right.
615
+ * point(20, 30, -50);
616
+ * }
617
+ * </code>
618
+ * </div>
619
+ */
620
+ function point(x: number, y: number, z?: number): void;
621
+
622
+ /**
623
+ * @param the coordinate vector.
624
+ */
625
+ function point(coordinateVector: p5.Vector): void;
626
+
627
+ /**
628
+ * Draws a quadrilateral (four-sided shape).Quadrilaterals include rectangles, squares, rhombuses, and trapezoids. The
629
+ * first pair of parameters `(x1, y1)` sets the quad's first point. The next
630
+ * three pairs of parameters set the coordinates for its next three points
631
+ * `(x2, y2)`, `(x3, y3)`, and `(x4, y4)`. Points should be added in either
632
+ * clockwise or counter-clockwise order.The version of `quad()` with twelve parameters allows the quad to be drawn
633
+ * in 3D space. Doing so requires adding the `WEBGL` argument to
634
+ * createCanvas().The thirteenth and fourteenth parameters are optional. In WebGL mode, they
635
+ * set the number of segments used to draw the quadrilateral in the x- and
636
+ * y-directions. They're both 2 by default.
637
+ *
638
+ * @param the x-coordinate of the first point.
639
+ * @param the y-coordinate of the first point.
640
+ * @param the x-coordinate of the second point.
641
+ * @param the y-coordinate of the second point.
642
+ * @param the x-coordinate of the third point.
643
+ * @param the y-coordinate of the third point.
644
+ * @param the x-coordinate of the fourth point.
645
+ * @param the y-coordinate of the fourth point.
646
+ * @param number of segments in the x-direction.
647
+ * @param number of segments in the y-direction.
648
+ * @example <div>
649
+ * <code>
650
+ * function setup() {
651
+ * createCanvas(100, 100);
652
+ *
653
+ * background(200);
654
+ *
655
+ * quad(20, 20, 80, 20, 80, 80, 20, 80);
656
+ *
657
+ * describe('A white square with a black outline drawn on a gray canvas.');
658
+ * }
659
+ * </code>
660
+ * </div>
661
+ *
662
+ * <div>
663
+ * <code>
664
+ * function setup() {
665
+ * createCanvas(100, 100);
666
+ *
667
+ * background(200);
668
+ *
669
+ * quad(20, 30, 80, 30, 80, 70, 20, 70);
670
+ *
671
+ * describe('A white rectangle with a black outline drawn on a gray canvas.');
672
+ * }
673
+ * </code>
674
+ * </div>
675
+ *
676
+ * <div>
677
+ * <code>
678
+ * function setup() {
679
+ * createCanvas(100, 100);
680
+ *
681
+ * background(200);
682
+ *
683
+ * quad(50, 62, 86, 50, 50, 38, 14, 50);
684
+ *
685
+ * describe('A white rhombus with a black outline drawn on a gray canvas.');
686
+ * }
687
+ * </code>
688
+ * </div>
689
+ *
690
+ * <div>
691
+ * <code>
692
+ * function setup() {
693
+ * createCanvas(100, 100);
694
+ *
695
+ * background(200);
696
+ *
697
+ * quad(20, 50, 80, 30, 80, 70, 20, 70);
698
+ *
699
+ * describe('A white trapezoid with a black outline drawn on a gray canvas.');
700
+ * }
701
+ * </code>
702
+ * </div>
703
+ *
704
+ * <div>
705
+ * <code>
706
+ * function setup() {
707
+ * createCanvas(100, 100, WEBGL);
708
+ *
709
+ * background(200);
710
+ *
711
+ * quad(-30, -30, 30, -30, 30, 30, -30, 30);
712
+ *
713
+ * describe('A white square with a black outline drawn on a gray canvas.');
714
+ * }
715
+ * </code>
716
+ * </div>
717
+ *
718
+ * <div>
719
+ * <code>
720
+ * function setup() {
721
+ * createCanvas(100, 100, WEBGL);
722
+ *
723
+ * describe('A wavy white surface spins around on gray canvas.');
724
+ * }
725
+ *
726
+ * function draw() {
727
+ * background(200);
728
+ *
729
+ * // Rotate around the y-axis.
730
+ * rotateY(frameCount * 0.01);
731
+ *
732
+ * // Draw the quad.
733
+ * quad(-30, -30, 0, 30, -30, 0, 30, 30, 20, -30, 30, -20);
734
+ * }
735
+ * </code>
736
+ * </div>
737
+ */
738
+ function quad(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, detailX?: number, detailY?: number): void;
739
+
740
+ /**
741
+ * @param the z-coordinate of the first point.
742
+ * @param the z-coordinate of the second point.
743
+ * @param the z-coordinate of the third point.
744
+ * @param the z-coordinate of the fourth point.
745
+ */
746
+ function quad(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, x3: number, y3: number, z3: number, x4: number, y4: number, z4: number, detailX?: number, detailY?: number): void;
747
+
748
+ /**
749
+ * Draws a rectangle.A rectangle is a four-sided shape defined by the `x`, `y`, `w`, and `h`
750
+ * parameters. `x` and `y` set the location of its top-left corner. `w` sets
751
+ * its width and `h` sets its height. Every angle in the rectangle measures
752
+ * 90˚. See rectMode() for other ways to define
753
+ * rectangles.The version of `rect()` with five parameters creates a rounded rectangle. The
754
+ * fifth parameter sets the radius for all four corners.The version of `rect()` with eight parameters also creates a rounded
755
+ * rectangle. Each of the last four parameters set the radius of a corner. The
756
+ * radii start with the top-left corner and move clockwise around the
757
+ * rectangle. If any of these parameters are omitted, they are set to the
758
+ * value of the last radius that was set.
759
+ *
760
+ * @param x-coordinate of the rectangle.
761
+ * @param y-coordinate of the rectangle.
762
+ * @param width of the rectangle.
763
+ * @param height of the rectangle.
764
+ * @param optional radius of top-left corner.
765
+ * @param optional radius of top-right corner.
766
+ * @param optional radius of bottom-right corner.
767
+ * @param optional radius of bottom-left corner.
768
+ * @example <div>
769
+ * <code>
770
+ * function setup() {
771
+ * createCanvas(100, 100);
772
+ *
773
+ * background(200);
774
+ *
775
+ * rect(30, 20, 55, 55);
776
+ *
777
+ * describe('A white square with a black outline on a gray canvas.');
778
+ * }
779
+ * </code>
780
+ * </div>
781
+ *
782
+ * <div>
783
+ * <code>
784
+ * function setup() {
785
+ * createCanvas(100, 100);
786
+ *
787
+ * background(200);
788
+ *
789
+ * rect(30, 20, 55, 40);
790
+ *
791
+ * describe('A white rectangle with a black outline on a gray canvas.');
792
+ * }
793
+ * </code>
794
+ * </div>
795
+ *
796
+ * <div>
797
+ * <code>
798
+ * function setup() {
799
+ * createCanvas(100, 100);
800
+ *
801
+ * background(200);
802
+ *
803
+ * // Give all corners a radius of 20.
804
+ * rect(30, 20, 55, 50, 20);
805
+ *
806
+ * describe('A white rectangle with a black outline and round edges on a gray canvas.');
807
+ * }
808
+ * </code>
809
+ * </div>
810
+ *
811
+ * <div>
812
+ * <code>
813
+ * function setup() {
814
+ * createCanvas(100, 100);
815
+ *
816
+ * background(200);
817
+ *
818
+ * // Give each corner a unique radius.
819
+ * rect(30, 20, 55, 50, 20, 15, 10, 5);
820
+ *
821
+ * describe('A white rectangle with a black outline and round edges of different radii.');
822
+ * }
823
+ * </code>
824
+ * </div>
825
+ *
826
+ * <div>
827
+ * <code>
828
+ * function setup() {
829
+ * createCanvas(100, 100, WEBGL);
830
+ *
831
+ * background(200);
832
+ *
833
+ * rect(-20, -30, 55, 55);
834
+ *
835
+ * describe('A white square with a black outline on a gray canvas.');
836
+ * }
837
+ * </code>
838
+ * </div>
839
+ *
840
+ * <div>
841
+ * <code>
842
+ * function setup() {
843
+ * createCanvas(100, 100, WEBGL);
844
+ *
845
+ * describe('A white square spins around on gray canvas.');
846
+ * }
847
+ *
848
+ * function draw() {
849
+ * background(200);
850
+ *
851
+ * // Rotate around the y-axis.
852
+ * rotateY(frameCount * 0.01);
853
+ *
854
+ * // Draw the rectangle.
855
+ * rect(-20, -30, 55, 55);
856
+ * }
857
+ * </code>
858
+ * </div>
859
+ */
860
+ function rect(x: number, y: number, w: number, h?: number, tl?: number, tr?: number, br?: number, bl?: number): void;
861
+
862
+ /**
863
+ * @param number of segments in the x-direction (for WebGL mode).
864
+ * @param number of segments in the y-direction (for WebGL mode).
865
+ */
866
+ function rect(x: number, y: number, w: number, h: number, detailX?: number, detailY?: number): void;
867
+
868
+ /**
869
+ * Draws a square.A square is a four-sided shape defined by the `x`, `y`, and `s`
870
+ * parameters. `x` and `y` set the location of its top-left corner. `s` sets
871
+ * its width and height. Every angle in the square measures 90˚ and all its
872
+ * sides are the same length. See rectMode() for
873
+ * other ways to define squares.The version of `square()` with four parameters creates a rounded square.
874
+ * The fourth parameter sets the radius for all four corners.The version of `square()` with seven parameters also creates a rounded
875
+ * square. Each of the last four parameters set the radius of a corner. The
876
+ * radii start with the top-left corner and move clockwise around the
877
+ * square. If any of these parameters are omitted, they are set to the
878
+ * value of the last radius that was set.
879
+ *
880
+ * @param x-coordinate of the square.
881
+ * @param y-coordinate of the square.
882
+ * @param side size of the square.
883
+ * @param optional radius of top-left corner.
884
+ * @param optional radius of top-right corner.
885
+ * @param optional radius of bottom-right corner.
886
+ * @param optional radius of bottom-left corner.
887
+ * @example <div>
888
+ * <code>
889
+ * function setup() {
890
+ * createCanvas(100, 100);
891
+ *
892
+ * background(200);
893
+ *
894
+ * square(30, 20, 55);
895
+ *
896
+ * describe('A white square with a black outline in on a gray canvas.');
897
+ * }
898
+ * </code>
899
+ * </div>
900
+ *
901
+ * <div>
902
+ * <code>
903
+ * function setup() {
904
+ * createCanvas(100, 100);
905
+ *
906
+ * background(200);
907
+ *
908
+ * // Give all corners a radius of 20.
909
+ * square(30, 20, 55, 20);
910
+ *
911
+ * describe(
912
+ * 'A white square with a black outline and round edges on a gray canvas.'
913
+ * );
914
+ * }
915
+ * </code>
916
+ * </div>
917
+ *
918
+ * <div>
919
+ * <code>
920
+ * function setup() {
921
+ * createCanvas(100, 100);
922
+ *
923
+ * background(200);
924
+ *
925
+ * // Give each corner a unique radius.
926
+ * square(30, 20, 55, 20, 15, 10, 5);
927
+ *
928
+ * describe('A white square with a black outline and round edges of different radii.');
929
+ * }
930
+ * </code>
931
+ * </div>
932
+ *
933
+ * <div>
934
+ * <code>
935
+ * function setup() {
936
+ * createCanvas(100, 100, WEBGL);
937
+ *
938
+ * background(200);
939
+ *
940
+ * square(-20, -30, 55);
941
+ *
942
+ * describe('A white square with a black outline in on a gray canvas.');
943
+ * }
944
+ * </code>
945
+ * </div>
946
+ *
947
+ * <div>
948
+ * <code>
949
+ * function setup() {
950
+ * createCanvas(100, 100, WEBGL);
951
+ *
952
+ * describe('A white square spins around on gray canvas.');
953
+ * }
954
+ *
955
+ * function draw() {
956
+ * background(200);
957
+ *
958
+ * // Rotate around the y-axis.
959
+ * rotateY(frameCount * 0.01);
960
+ *
961
+ * // Draw the square.
962
+ * square(-20, -30, 55);
963
+ * }
964
+ * </code>
965
+ * </div>
966
+ */
967
+ function square(x: number, y: number, s: number, tl?: number, tr?: number, br?: number, bl?: number): void;
968
+
969
+ /**
970
+ * Draws a triangle.A triangle is a three-sided shape defined by three points. The
971
+ * first two parameters specify the triangle's first point `(x1, y1)`. The
972
+ * middle two parameters specify its second point `(x2, y2)`. And the last two
973
+ * parameters specify its third point `(x3, y3)`.
974
+ *
975
+ * @param x-coordinate of the first point.
976
+ * @param y-coordinate of the first point.
977
+ * @param x-coordinate of the second point.
978
+ * @param y-coordinate of the second point.
979
+ * @param x-coordinate of the third point.
980
+ * @param y-coordinate of the third point.
981
+ * @example <div>
982
+ * <code>
983
+ * function setup() {
984
+ * createCanvas(100, 100);
985
+ *
986
+ * background(200);
987
+ *
988
+ * triangle(30, 75, 58, 20, 86, 75);
989
+ *
990
+ * describe('A white triangle with a black outline on a gray canvas.');
991
+ * }
992
+ * </code>
993
+ * </div>
994
+ *
995
+ * <div>
996
+ * <code>
997
+ * function setup() {
998
+ * createCanvas(100, 100, WEBGL);
999
+ *
1000
+ * background(200);
1001
+ *
1002
+ * triangle(-20, 25, 8, -30, 36, 25);
1003
+ *
1004
+ * describe('A white triangle with a black outline on a gray canvas.');
1005
+ * }
1006
+ * </code>
1007
+ * </div>
1008
+ *
1009
+ * <div>
1010
+ * <code>
1011
+ * function setup() {
1012
+ * createCanvas(100, 100, WEBGL);
1013
+ *
1014
+ * describe('A white triangle spins around on a gray canvas.');
1015
+ * }
1016
+ *
1017
+ * function draw() {
1018
+ * background(200);
1019
+ *
1020
+ * // Rotate around the y-axis.
1021
+ * rotateY(frameCount * 0.01);
1022
+ *
1023
+ * // Draw the triangle.
1024
+ * triangle(-20, 25, 8, -30, 36, 25);
1025
+ * }
1026
+ * </code>
1027
+ * </div>
1028
+ */
1029
+ function triangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
1030
+
1031
+ }
1032
+
1033
+ export default function 2d_primitives(p5: any, fn: any): void;