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.
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-tYr0tCl8.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 +41 -75
  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 +1 -2
  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-CAxvgiOV.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-Swjl9HQO.js} +5 -5
  54. package/dist/{rendering--aAe5aq3.js → rendering-B5TRR7aY.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 +4 -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 +273 -225
  79. package/lib/p5.js +273 -225
  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 +5996 -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 +499 -0
  115. package/types/events/pointer.d.ts +782 -0
  116. package/types/global.d.ts +5542 -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 +6663 -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 +481 -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,1432 @@
1
+ // This file is auto-generated from JSDoc documentation
2
+
3
+ import p5 from 'p5';
4
+
5
+ declare module 'p5' {
6
+ /**
7
+ * Sets the stroke rendering mode to balance performance and visual features when drawing lines.`strokeMode()` offers two modes:Choose the mode that best suits your application's needs to either improve rendering speed or enhance visual quality.
8
+ *
9
+ * @param The stroke mode to set. Possible values are:
10
+ * - `'SIMPLE'`: Fast rendering without caps, joins, or stroke color.
11
+ * - `'FULL'`: Detailed rendering with caps, joins, and stroke color.
12
+ * @example <div>
13
+ * <code>
14
+ * function setup() {
15
+ * createCanvas(300, 300, WEBGL);
16
+ * describe('A sphere with red stroke and a red, wavy line on a gray background. The wavy line have caps, joins and colors.');
17
+ * }
18
+ *
19
+ * function draw() {
20
+ * background(128);
21
+ * strokeMode(FULL); // Enables detailed rendering with caps, joins, and stroke color.
22
+ * push();
23
+ * strokeWeight(1);
24
+ * translate(0, -50, 0);
25
+ * sphere(50);
26
+ * pop();
27
+ * orbitControl();
28
+ *
29
+ * noFill();
30
+ * strokeWeight(15);
31
+ * stroke('red');
32
+ * beginShape();
33
+ * bezierOrder(2); // Sets the order of the Bezier curve.
34
+ * bezierVertex(80, 80);
35
+ * bezierVertex(50, -40);
36
+ * bezierVertex(-80, 80);
37
+ * endShape();
38
+ * }
39
+ * </code>
40
+ * </div>
41
+ *
42
+ * <div>
43
+ * <code>
44
+ * function setup() {
45
+ * createCanvas(300, 300, WEBGL);
46
+ * describe('A sphere with red stroke and a wavy line without full curve decorations without caps and color on a gray background.');
47
+ * }
48
+ *
49
+ * function draw() {
50
+ * background(128);
51
+ * strokeMode(SIMPLE); // Simplifies stroke rendering for better performance.
52
+ *
53
+ * // Draw sphere
54
+ * push();
55
+ * strokeWeight(1);
56
+ * translate(0, -50, 0);
57
+ * sphere(50);
58
+ * pop();
59
+ * orbitControl();
60
+ *
61
+ * // Draw modified wavy red line
62
+ * noFill();
63
+ * strokeWeight(15);
64
+ * stroke('red');
65
+ * beginShape();
66
+ * bezierOrder(2); // Sets the order of the Bezier curve.
67
+ * bezierVertex(80, 80);
68
+ * bezierVertex(50, -40);
69
+ * bezierVertex(-80, 80);
70
+ * endShape();
71
+ * }
72
+ * </code>
73
+ * </div>
74
+ */
75
+ function strokeMode(mode: string): void;
76
+
77
+ /**
78
+ * Creates a custom p5.Geometry object from
79
+ * simpler 3D shapes.`buildGeometry()` helps with creating complex 3D shapes from simpler ones
80
+ * such as sphere(). It can help to make sketches
81
+ * more performant. For example, if a complex 3D shape doesn’t change while a
82
+ * sketch runs, then it can be created with `buildGeometry()`. Creating a
83
+ * p5.Geometry object once and then drawing it
84
+ * will run faster than repeatedly drawing the individual pieces.The parameter, `callback`, is a function with the drawing instructions for
85
+ * the new p5.Geometry object. It will be called
86
+ * once to create the new 3D shape.See beginGeometry() and
87
+ * endGeometry() for another way to build 3D
88
+ * shapes.Note: `buildGeometry()` can only be used in WebGL mode.
89
+ *
90
+ * @param function that draws the shape.
91
+ * @returns new 3D shape.
92
+ * @example <div>
93
+ * <code>
94
+ * // Click and drag the mouse to view the scene from different angles.
95
+ *
96
+ * let shape;
97
+ *
98
+ * function setup() {
99
+ * createCanvas(100, 100, WEBGL);
100
+ *
101
+ * // Create the p5.Geometry object.
102
+ * shape = buildGeometry(createShape);
103
+ *
104
+ * describe('A white cone drawn on a gray background.');
105
+ * }
106
+ *
107
+ * function draw() {
108
+ * background(50);
109
+ *
110
+ * // Enable orbiting with the mouse.
111
+ * orbitControl();
112
+ *
113
+ * // Turn on the lights.
114
+ * lights();
115
+ *
116
+ * // Style the p5.Geometry object.
117
+ * noStroke();
118
+ *
119
+ * // Draw the p5.Geometry object.
120
+ * model(shape);
121
+ * }
122
+ *
123
+ * // Create p5.Geometry object from a single cone.
124
+ * function createShape() {
125
+ * cone();
126
+ * }
127
+ * </code>
128
+ * </div>
129
+ *
130
+ * <div>
131
+ * <code>
132
+ * // Click and drag the mouse to view the scene from different angles.
133
+ *
134
+ * let shape;
135
+ *
136
+ * function setup() {
137
+ * createCanvas(100, 100, WEBGL);
138
+ *
139
+ * // Create the arrow.
140
+ * shape = buildGeometry(createArrow);
141
+ *
142
+ * describe('A white arrow drawn on a gray background.');
143
+ * }
144
+ *
145
+ * function draw() {
146
+ * background(50);
147
+ *
148
+ * // Enable orbiting with the mouse.
149
+ * orbitControl();
150
+ *
151
+ * // Turn on the lights.
152
+ * lights();
153
+ *
154
+ * // Style the arrow.
155
+ * noStroke();
156
+ *
157
+ * // Draw the arrow.
158
+ * model(shape);
159
+ * }
160
+ *
161
+ * function createArrow() {
162
+ * // Add shapes to the p5.Geometry object.
163
+ * push();
164
+ * rotateX(PI);
165
+ * cone(10);
166
+ * translate(0, -10, 0);
167
+ * cylinder(3, 20);
168
+ * pop();
169
+ * }
170
+ * </code>
171
+ * </div>
172
+ *
173
+ * <div>
174
+ * <code>
175
+ * // Click and drag the mouse to view the scene from different angles.
176
+ *
177
+ * let shape;
178
+ *
179
+ * function setup() {
180
+ * createCanvas(100, 100, WEBGL);
181
+ *
182
+ * // Create the p5.Geometry object.
183
+ * shape = buildGeometry(createArrow);
184
+ *
185
+ * describe('Two white arrows drawn on a gray background. The arrow on the right rotates slowly.');
186
+ * }
187
+ *
188
+ * function draw() {
189
+ * background(50);
190
+ *
191
+ * // Enable orbiting with the mouse.
192
+ * orbitControl();
193
+ *
194
+ * // Turn on the lights.
195
+ * lights();
196
+ *
197
+ * // Style the arrows.
198
+ * noStroke();
199
+ *
200
+ * // Draw the p5.Geometry object.
201
+ * model(shape);
202
+ *
203
+ * // Translate and rotate the coordinate system.
204
+ * translate(30, 0, 0);
205
+ * rotateZ(frameCount * 0.01);
206
+ *
207
+ * // Draw the p5.Geometry object again.
208
+ * model(shape);
209
+ * }
210
+ *
211
+ * function createArrow() {
212
+ * // Add shapes to the p5.Geometry object.
213
+ * push();
214
+ * rotateX(PI);
215
+ * cone(10);
216
+ * translate(0, -10, 0);
217
+ * cylinder(3, 20);
218
+ * pop();
219
+ * }
220
+ * </code>
221
+ * </div>
222
+ *
223
+ * <div>
224
+ * <code>
225
+ * // Click and drag the mouse to view the scene from different angles.
226
+ *
227
+ * let button;
228
+ * let particles;
229
+ *
230
+ * function setup() {
231
+ * createCanvas(100, 100, WEBGL);
232
+ *
233
+ * // Create a button to reset the particle system.
234
+ * button = createButton('Reset');
235
+ *
236
+ * // Call resetModel() when the user presses the button.
237
+ * button.mousePressed(resetModel);
238
+ *
239
+ * // Add the original set of particles.
240
+ * resetModel();
241
+ *
242
+ * describe('A set of white spheres on a gray background. The spheres are positioned randomly. Their positions reset when the user presses the Reset button.');
243
+ * }
244
+ *
245
+ * function draw() {
246
+ * background(50);
247
+ *
248
+ * // Enable orbiting with the mouse.
249
+ * orbitControl();
250
+ *
251
+ * // Turn on the lights.
252
+ * lights();
253
+ *
254
+ * // Style the particles.
255
+ * noStroke();
256
+ *
257
+ * // Draw the particles.
258
+ * model(particles);
259
+ * }
260
+ *
261
+ * function resetModel() {
262
+ * // If the p5.Geometry object has already been created,
263
+ * // free those resources.
264
+ * if (particles) {
265
+ * freeGeometry(particles);
266
+ * }
267
+ *
268
+ * // Create a new p5.Geometry object with random spheres.
269
+ * particles = buildGeometry(createParticles);
270
+ * }
271
+ *
272
+ * function createParticles() {
273
+ * for (let i = 0; i < 60; i += 1) {
274
+ * // Calculate random coordinates.
275
+ * let x = randomGaussian(0, 20);
276
+ * let y = randomGaussian(0, 20);
277
+ * let z = randomGaussian(0, 20);
278
+ *
279
+ * push();
280
+ * // Translate to the particle's coordinates.
281
+ * translate(x, y, z);
282
+ * // Draw the particle.
283
+ * sphere(5);
284
+ * pop();
285
+ * }
286
+ * }
287
+ * </code>
288
+ * </div>
289
+ */
290
+ function buildGeometry(callback: Function): p5.Geometry;
291
+
292
+ /**
293
+ * Clears a p5.Geometry object from the graphics
294
+ * processing unit (GPU) memory.p5.Geometry objects can contain lots of data
295
+ * about their vertices, surface normals, colors, and so on. Complex 3D shapes
296
+ * can use lots of memory which is a limited resource in many GPUs. Calling
297
+ * `freeGeometry()` can improve performance by freeing a
298
+ * p5.Geometry object’s resources from GPU memory.
299
+ * `freeGeometry()` works with p5.Geometry objects
300
+ * created with beginGeometry() and
301
+ * endGeometry(),
302
+ * buildGeometry(), and
303
+ * loadModel().The parameter, `geometry`, is the p5.Geometry
304
+ * object to be freed.Note: A p5.Geometry object can still be drawn
305
+ * after its resources are cleared from GPU memory. It may take longer to draw
306
+ * the first time it’s redrawn.Note: `freeGeometry()` can only be used in WebGL mode.
307
+ *
308
+ * @param 3D shape whose resources should be freed.
309
+ * @example <div>
310
+ * <code>
311
+ * function setup() {
312
+ * createCanvas(100, 100, WEBGL);
313
+ *
314
+ * background(200);
315
+ *
316
+ * // Create a p5.Geometry object.
317
+ * beginGeometry();
318
+ * cone();
319
+ * let shape = endGeometry();
320
+ *
321
+ * // Draw the shape.
322
+ * model(shape);
323
+ *
324
+ * // Free the shape's resources.
325
+ * freeGeometry(shape);
326
+ * }
327
+ * </code>
328
+ * </div>
329
+ *
330
+ * <div>
331
+ * <code>
332
+ * // Click and drag the mouse to view the scene from different angles.
333
+ *
334
+ * let button;
335
+ * let particles;
336
+ *
337
+ * function setup() {
338
+ * createCanvas(100, 100, WEBGL);
339
+ *
340
+ * // Create a button to reset the particle system.
341
+ * button = createButton('Reset');
342
+ *
343
+ * // Call resetModel() when the user presses the button.
344
+ * button.mousePressed(resetModel);
345
+ *
346
+ * // Add the original set of particles.
347
+ * resetModel();
348
+ * }
349
+ *
350
+ * function draw() {
351
+ * background(50);
352
+ *
353
+ * // Enable orbiting with the mouse.
354
+ * orbitControl();
355
+ *
356
+ * // Turn on the lights.
357
+ * lights();
358
+ *
359
+ * // Style the particles.
360
+ * noStroke();
361
+ *
362
+ * // Draw the particles.
363
+ * model(particles);
364
+ * }
365
+ *
366
+ * function resetModel() {
367
+ * // If the p5.Geometry object has already been created,
368
+ * // free those resources.
369
+ * if (particles) {
370
+ * freeGeometry(particles);
371
+ * }
372
+ *
373
+ * // Create a new p5.Geometry object with random spheres.
374
+ * particles = buildGeometry(createParticles);
375
+ * }
376
+ *
377
+ * function createParticles() {
378
+ * for (let i = 0; i < 60; i += 1) {
379
+ * // Calculate random coordinates.
380
+ * let x = randomGaussian(0, 20);
381
+ * let y = randomGaussian(0, 20);
382
+ * let z = randomGaussian(0, 20);
383
+ *
384
+ * push();
385
+ * // Translate to the particle's coordinates.
386
+ * translate(x, y, z);
387
+ * // Draw the particle.
388
+ * sphere(5);
389
+ * pop();
390
+ * }
391
+ * }
392
+ * </code>
393
+ * </div>
394
+ */
395
+ function freeGeometry(geometry: p5.Geometry): void;
396
+
397
+ /**
398
+ * Draws a plane.A plane is a four-sided, flat shape with every angle measuring 90˚. It’s
399
+ * similar to a rectangle and offers advanced drawing features in WebGL mode.The first parameter, `width`, is optional. If a `Number` is passed, as in
400
+ * `plane(20)`, it sets the plane’s width and height. By default, `width` is
401
+ * 50.The second parameter, `height`, is also optional. If a `Number` is passed,
402
+ * as in `plane(20, 30)`, it sets the plane’s height. By default, `height` is
403
+ * set to the plane’s `width`.The third parameter, `detailX`, is also optional. If a `Number` is passed,
404
+ * as in `plane(20, 30, 5)` it sets the number of triangle subdivisions to use
405
+ * along the x-axis. All 3D shapes are made by connecting triangles to form
406
+ * their surfaces. By default, `detailX` is 1.The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
407
+ * as in `plane(20, 30, 5, 7)` it sets the number of triangle subdivisions to
408
+ * use along the y-axis. All 3D shapes are made by connecting triangles to
409
+ * form their surfaces. By default, `detailY` is 1.Note: `plane()` can only be used in WebGL mode.
410
+ *
411
+ * @param width of the plane.
412
+ * @param height of the plane.
413
+ * @param number of triangle subdivisions along the x-axis.
414
+ * @param number of triangle subdivisions along the y-axis.
415
+ * @example <div>
416
+ * <code>
417
+ * // Click and drag the mouse to view the scene from different angles.
418
+ *
419
+ * function setup() {
420
+ * createCanvas(100, 100, WEBGL);
421
+ *
422
+ * describe('A white plane on a gray background.');
423
+ * }
424
+ *
425
+ * function draw() {
426
+ * background(200);
427
+ *
428
+ * // Enable orbiting with the mouse.
429
+ * orbitControl();
430
+ *
431
+ * // Draw the plane.
432
+ * plane();
433
+ * }
434
+ * </code>
435
+ * </div>
436
+ *
437
+ * <div>
438
+ * <code>
439
+ * // Click and drag the mouse to view the scene from different angles.
440
+ *
441
+ * function setup() {
442
+ * createCanvas(100, 100, WEBGL);
443
+ *
444
+ * describe('A white plane on a gray background.');
445
+ * }
446
+ *
447
+ * function draw() {
448
+ * background(200);
449
+ *
450
+ * // Enable orbiting with the mouse.
451
+ * orbitControl();
452
+ *
453
+ * // Draw the plane.
454
+ * // Set its width and height to 30.
455
+ * plane(30);
456
+ * }
457
+ * </code>
458
+ * </div>
459
+ *
460
+ * <div>
461
+ * <code>
462
+ * // Click and drag the mouse to view the scene from different angles.
463
+ *
464
+ * function setup() {
465
+ * createCanvas(100, 100, WEBGL);
466
+ *
467
+ * describe('A white plane on a gray background.');
468
+ * }
469
+ *
470
+ * function draw() {
471
+ * background(200);
472
+ *
473
+ * // Enable orbiting with the mouse.
474
+ * orbitControl();
475
+ *
476
+ * // Draw the plane.
477
+ * // Set its width to 30 and height to 50.
478
+ * plane(30, 50);
479
+ * }
480
+ * </code>
481
+ * </div>
482
+ */
483
+ function plane(width?: number, height?: number, detailX?: number, detailY?: number): void;
484
+
485
+ /**
486
+ * Draws a box (rectangular prism).A box is a 3D shape with six faces. Each face makes a 90˚ with four
487
+ * neighboring faces.The first parameter, `width`, is optional. If a `Number` is passed, as in
488
+ * `box(20)`, it sets the box’s width and height. By default, `width` is 50.The second parameter, `height`, is also optional. If a `Number` is passed,
489
+ * as in `box(20, 30)`, it sets the box’s height. By default, `height` is set
490
+ * to the box’s `width`.The third parameter, `depth`, is also optional. If a `Number` is passed, as
491
+ * in `box(20, 30, 40)`, it sets the box’s depth. By default, `depth` is set
492
+ * to the box’s `height`.The fourth parameter, `detailX`, is also optional. If a `Number` is passed,
493
+ * as in `box(20, 30, 40, 5)`, it sets the number of triangle subdivisions to
494
+ * use along the x-axis. All 3D shapes are made by connecting triangles to
495
+ * form their surfaces. By default, `detailX` is 1.The fifth parameter, `detailY`, is also optional. If a number is passed, as
496
+ * in `box(20, 30, 40, 5, 7)`, it sets the number of triangle subdivisions to
497
+ * use along the y-axis. All 3D shapes are made by connecting triangles to
498
+ * form their surfaces. By default, `detailY` is 1.Note: `box()` can only be used in WebGL mode.
499
+ *
500
+ * @param width of the box.
501
+ * @param height of the box.
502
+ * @param depth of the box.
503
+ * @param number of triangle subdivisions along the x-axis.
504
+ * @param number of triangle subdivisions along the y-axis.
505
+ * @example <div>
506
+ * <code>
507
+ * // Click and drag the mouse to view the scene from different angles.
508
+ *
509
+ * function setup() {
510
+ * createCanvas(100, 100, WEBGL);
511
+ *
512
+ * describe('A white box on a gray background.');
513
+ * }
514
+ *
515
+ * function draw() {
516
+ * background(200);
517
+ *
518
+ * // Enable orbiting with the mouse.
519
+ * orbitControl();
520
+ *
521
+ * // Draw the box.
522
+ * box();
523
+ * }
524
+ * </code>
525
+ * </div>
526
+ *
527
+ * <div>
528
+ * <code>
529
+ * // Click and drag the mouse to view the scene from different angles.
530
+ *
531
+ * function setup() {
532
+ * createCanvas(100, 100, WEBGL);
533
+ *
534
+ * describe('A white box on a gray background.');
535
+ * }
536
+ *
537
+ * function draw() {
538
+ * background(200);
539
+ *
540
+ * // Enable orbiting with the mouse.
541
+ * orbitControl();
542
+ *
543
+ * // Draw the box.
544
+ * // Set its width and height to 30.
545
+ * box(30);
546
+ * }
547
+ * </code>
548
+ * </div>
549
+ *
550
+ * <div>
551
+ * <code>
552
+ * // Click and drag the mouse to view the scene from different angles.
553
+ *
554
+ * function setup() {
555
+ * createCanvas(100, 100, WEBGL);
556
+ *
557
+ * describe('A white box on a gray background.');
558
+ * }
559
+ *
560
+ * function draw() {
561
+ * background(200);
562
+ *
563
+ * // Enable orbiting with the mouse.
564
+ * orbitControl();
565
+ *
566
+ * // Draw the box.
567
+ * // Set its width to 30 and height to 50.
568
+ * box(30, 50);
569
+ * }
570
+ * </code>
571
+ * </div>
572
+ *
573
+ * <div>
574
+ * <code>
575
+ * // Click and drag the mouse to view the scene from different angles.
576
+ *
577
+ * function setup() {
578
+ * createCanvas(100, 100, WEBGL);
579
+ *
580
+ * describe('A white box on a gray background.');
581
+ * }
582
+ *
583
+ * function draw() {
584
+ * background(200);
585
+ *
586
+ * // Enable orbiting with the mouse.
587
+ * orbitControl();
588
+ *
589
+ * // Draw the box.
590
+ * // Set its width to 30, height to 50, and depth to 10.
591
+ * box(30, 50, 10);
592
+ * }
593
+ * </code>
594
+ * </div>
595
+ */
596
+ function box(width?: number, height?: number, depth?: number, detailX?: number, detailY?: number): void;
597
+
598
+ /**
599
+ * Draws a sphere.A sphere is a 3D shape with triangular faces that connect to form a round
600
+ * surface. Spheres with few faces look like crystals. Spheres with many faces
601
+ * have smooth surfaces and look like balls.The first parameter, `radius`, is optional. If a `Number` is passed, as in
602
+ * `sphere(20)`, it sets the radius of the sphere. By default, `radius` is 50.The second parameter, `detailX`, is also optional. If a `Number` is passed,
603
+ * as in `sphere(20, 5)`, it sets the number of triangle subdivisions to use
604
+ * along the x-axis. All 3D shapes are made by connecting triangles to form
605
+ * their surfaces. By default, `detailX` is 24.The third parameter, `detailY`, is also optional. If a `Number` is passed,
606
+ * as in `sphere(20, 5, 2)`, it sets the number of triangle subdivisions to
607
+ * use along the y-axis. All 3D shapes are made by connecting triangles to
608
+ * form their surfaces. By default, `detailY` is 16.Note: `sphere()` can only be used in WebGL mode.
609
+ *
610
+ * @param radius of the sphere. Defaults to 50.
611
+ * @param number of triangle subdivisions along the x-axis. Defaults to 24.
612
+ * @param number of triangle subdivisions along the y-axis. Defaults to 16.
613
+ * @example <div>
614
+ * <code>
615
+ * // Click and drag the mouse to view the scene from different angles.
616
+ *
617
+ * function setup() {
618
+ * createCanvas(100, 100, WEBGL);
619
+ *
620
+ * describe('A white sphere on a gray background.');
621
+ * }
622
+ *
623
+ * function draw() {
624
+ * background(200);
625
+ *
626
+ * // Enable orbiting with the mouse.
627
+ * orbitControl();
628
+ *
629
+ * // Draw the sphere.
630
+ * sphere();
631
+ * }
632
+ * </code>
633
+ * </div>
634
+ *
635
+ * <div>
636
+ * <code>
637
+ * // Click and drag the mouse to view the scene from different angles.
638
+ *
639
+ * function setup() {
640
+ * createCanvas(100, 100, WEBGL);
641
+ *
642
+ * describe('A white sphere on a gray background.');
643
+ * }
644
+ *
645
+ * function draw() {
646
+ * background(200);
647
+ *
648
+ * // Enable orbiting with the mouse.
649
+ * orbitControl();
650
+ *
651
+ * // Draw the sphere.
652
+ * // Set its radius to 30.
653
+ * sphere(30);
654
+ * }
655
+ * </code>
656
+ * </div>
657
+ *
658
+ * <div>
659
+ * <code>
660
+ * // Click and drag the mouse to view the scene from different angles.
661
+ *
662
+ * function setup() {
663
+ * createCanvas(100, 100, WEBGL);
664
+ *
665
+ * describe('A white sphere on a gray background.');
666
+ * }
667
+ *
668
+ * function draw() {
669
+ * background(200);
670
+ *
671
+ * // Enable orbiting with the mouse.
672
+ * orbitControl();
673
+ *
674
+ * // Draw the sphere.
675
+ * // Set its radius to 30.
676
+ * // Set its detailX to 6.
677
+ * sphere(30, 6);
678
+ * }
679
+ * </code>
680
+ * </div>
681
+ *
682
+ * <div>
683
+ * <code>
684
+ * // Click and drag the mouse to view the scene from different angles.
685
+ *
686
+ * function setup() {
687
+ * createCanvas(100, 100, WEBGL);
688
+ *
689
+ * describe('A white sphere on a gray background.');
690
+ * }
691
+ *
692
+ * function draw() {
693
+ * background(200);
694
+ *
695
+ * // Enable orbiting with the mouse.
696
+ * orbitControl();
697
+ *
698
+ * // Draw the sphere.
699
+ * // Set its radius to 30.
700
+ * // Set its detailX to 24.
701
+ * // Set its detailY to 4.
702
+ * sphere(30, 24, 4);
703
+ * }
704
+ * </code>
705
+ * </div>
706
+ */
707
+ function sphere(radius?: number, detailX?: number, detailY?: number): void;
708
+
709
+ /**
710
+ * Draws a cylinder.A cylinder is a 3D shape with triangular faces that connect a flat bottom
711
+ * to a flat top. Cylinders with few faces look like boxes. Cylinders with
712
+ * many faces have smooth surfaces.The first parameter, `radius`, is optional. If a `Number` is passed, as in
713
+ * `cylinder(20)`, it sets the radius of the cylinder’s base. By default,
714
+ * `radius` is 50.The second parameter, `height`, is also optional. If a `Number` is passed,
715
+ * as in `cylinder(20, 30)`, it sets the cylinder’s height. By default,
716
+ * `height` is set to the cylinder’s `radius`.The third parameter, `detailX`, is also optional. If a `Number` is passed,
717
+ * as in `cylinder(20, 30, 5)`, it sets the number of edges used to form the
718
+ * cylinder's top and bottom. Using more edges makes the top and bottom look
719
+ * more like circles. By default, `detailX` is 24.The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
720
+ * as in `cylinder(20, 30, 5, 2)`, it sets the number of triangle subdivisions
721
+ * to use along the y-axis, between cylinder's the top and bottom. All 3D
722
+ * shapes are made by connecting triangles to form their surfaces. By default,
723
+ * `detailY` is 1.The fifth parameter, `bottomCap`, is also optional. If a `false` is passed,
724
+ * as in `cylinder(20, 30, 5, 2, false)` the cylinder’s bottom won’t be drawn.
725
+ * By default, `bottomCap` is `true`.The sixth parameter, `topCap`, is also optional. If a `false` is passed, as
726
+ * in `cylinder(20, 30, 5, 2, false, false)` the cylinder’s top won’t be
727
+ * drawn. By default, `topCap` is `true`.Note: `cylinder()` can only be used in WebGL mode.
728
+ *
729
+ * @param radius of the cylinder. Defaults to 50.
730
+ * @param height of the cylinder. Defaults to the value of `radius`.
731
+ * @param number of edges along the top and bottom. Defaults to 24.
732
+ * @param number of triangle subdivisions along the y-axis. Defaults to 1.
733
+ * @param whether to draw the cylinder's bottom. Defaults to `true`.
734
+ * @param whether to draw the cylinder's top. Defaults to `true`.
735
+ * @example <div>
736
+ * <code>
737
+ * // Click and drag the mouse to view the scene from different angles.
738
+ *
739
+ * function setup() {
740
+ * createCanvas(100, 100, WEBGL);
741
+ *
742
+ * describe('A white cylinder on a gray background.');
743
+ * }
744
+ *
745
+ * function draw() {
746
+ * background(200);
747
+ *
748
+ * // Enable orbiting with the mouse.
749
+ * orbitControl();
750
+ *
751
+ * // Draw the cylinder.
752
+ * cylinder();
753
+ * }
754
+ * </code>
755
+ * </div>
756
+ *
757
+ * <div>
758
+ * <code>
759
+ * // Click and drag the mouse to view the scene from different angles.
760
+ *
761
+ * function setup() {
762
+ * createCanvas(100, 100, WEBGL);
763
+ *
764
+ * describe('A white cylinder on a gray background.');
765
+ * }
766
+ *
767
+ * function draw() {
768
+ * background(200);
769
+ *
770
+ * // Enable orbiting with the mouse.
771
+ * orbitControl();
772
+ *
773
+ * // Draw the cylinder.
774
+ * // Set its radius and height to 30.
775
+ * cylinder(30);
776
+ * }
777
+ * </code>
778
+ * </div>
779
+ *
780
+ * <div>
781
+ * <code>
782
+ * // Click and drag the mouse to view the scene from different angles.
783
+ *
784
+ * function setup() {
785
+ * createCanvas(100, 100, WEBGL);
786
+ *
787
+ * describe('A white cylinder on a gray background.');
788
+ * }
789
+ *
790
+ * function draw() {
791
+ * background(200);
792
+ *
793
+ * // Enable orbiting with the mouse.
794
+ * orbitControl();
795
+ *
796
+ * // Draw the cylinder.
797
+ * // Set its radius to 30 and height to 50.
798
+ * cylinder(30, 50);
799
+ * }
800
+ * </code>
801
+ * </div>
802
+ *
803
+ * <div>
804
+ * <code>
805
+ * // Click and drag the mouse to view the scene from different angles.
806
+ *
807
+ * function setup() {
808
+ * createCanvas(100, 100, WEBGL);
809
+ *
810
+ * describe('A white box on a gray background.');
811
+ * }
812
+ *
813
+ * function draw() {
814
+ * background(200);
815
+ *
816
+ * // Enable orbiting with the mouse.
817
+ * orbitControl();
818
+ *
819
+ * // Draw the cylinder.
820
+ * // Set its radius to 30 and height to 50.
821
+ * // Set its detailX to 5.
822
+ * cylinder(30, 50, 5);
823
+ * }
824
+ * </code>
825
+ * </div>
826
+ *
827
+ * <div>
828
+ * <code>
829
+ * // Click and drag the mouse to view the scene from different angles.
830
+ *
831
+ * function setup() {
832
+ * createCanvas(100, 100, WEBGL);
833
+ *
834
+ * describe('A white cylinder on a gray background.');
835
+ * }
836
+ *
837
+ * function draw() {
838
+ * background(200);
839
+ *
840
+ * // Enable orbiting with the mouse.
841
+ * orbitControl();
842
+ *
843
+ * // Draw the cylinder.
844
+ * // Set its radius to 30 and height to 50.
845
+ * // Set its detailX to 24 and detailY to 2.
846
+ * cylinder(30, 50, 24, 2);
847
+ * }
848
+ * </code>
849
+ * </div>
850
+ *
851
+ * <div>
852
+ * <code>
853
+ * // Click and drag the mouse to view the scene from different angles.
854
+ *
855
+ * function setup() {
856
+ * createCanvas(100, 100, WEBGL);
857
+ *
858
+ * describe('A white cylinder on a gray background. Its top is missing.');
859
+ * }
860
+ *
861
+ * function draw() {
862
+ * background(200);
863
+ *
864
+ * // Enable orbiting with the mouse.
865
+ * orbitControl();
866
+ *
867
+ * // Draw the cylinder.
868
+ * // Set its radius to 30 and height to 50.
869
+ * // Set its detailX to 24 and detailY to 1.
870
+ * // Don't draw its bottom.
871
+ * cylinder(30, 50, 24, 1, false);
872
+ * }
873
+ * </code>
874
+ * </div>
875
+ *
876
+ * <div>
877
+ * <code>
878
+ * // Click and drag the mouse to view the scene from different angles.
879
+ *
880
+ * function setup() {
881
+ * createCanvas(100, 100, WEBGL);
882
+ *
883
+ * describe('A white cylinder on a gray background. Its top and bottom are missing.');
884
+ * }
885
+ *
886
+ * function draw() {
887
+ * background(200);
888
+ *
889
+ * // Enable orbiting with the mouse.
890
+ * orbitControl();
891
+ *
892
+ * // Draw the cylinder.
893
+ * // Set its radius to 30 and height to 50.
894
+ * // Set its detailX to 24 and detailY to 1.
895
+ * // Don't draw its bottom or top.
896
+ * cylinder(30, 50, 24, 1, false, false);
897
+ * }
898
+ * </code>
899
+ * </div>
900
+ */
901
+ function cylinder(radius?: number, height?: number, detailX?: number, detailY?: number, bottomCap?: boolean, topCap?: boolean): void;
902
+
903
+ /**
904
+ * Draws a cone.A cone is a 3D shape with triangular faces that connect a flat bottom to a
905
+ * single point. Cones with few faces look like pyramids. Cones with many
906
+ * faces have smooth surfaces.The first parameter, `radius`, is optional. If a `Number` is passed, as in
907
+ * `cone(20)`, it sets the radius of the cone’s base. By default, `radius` is
908
+ * 50.The second parameter, `height`, is also optional. If a `Number` is passed,
909
+ * as in `cone(20, 30)`, it sets the cone’s height. By default, `height` is
910
+ * set to the cone’s `radius`.The third parameter, `detailX`, is also optional. If a `Number` is passed,
911
+ * as in `cone(20, 30, 5)`, it sets the number of edges used to form the
912
+ * cone's base. Using more edges makes the base look more like a circle. By
913
+ * default, `detailX` is 24.The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
914
+ * as in `cone(20, 30, 5, 7)`, it sets the number of triangle subdivisions to
915
+ * use along the y-axis connecting the base to the tip. All 3D shapes are made
916
+ * by connecting triangles to form their surfaces. By default, `detailY` is 1.The fifth parameter, `cap`, is also optional. If a `false` is passed, as
917
+ * in `cone(20, 30, 5, 7, false)` the cone’s base won’t be drawn. By default,
918
+ * `cap` is `true`.Note: `cone()` can only be used in WebGL mode.
919
+ *
920
+ * @param radius of the cone's base. Defaults to 50.
921
+ * @param height of the cone. Defaults to the value of `radius`.
922
+ * @param number of edges used to draw the base. Defaults to 24.
923
+ * @param number of triangle subdivisions along the y-axis. Defaults to 1.
924
+ * @param whether to draw the cone's base. Defaults to `true`.
925
+ * @example <div>
926
+ * <code>
927
+ * // Click and drag the mouse to view the scene from different angles.
928
+ *
929
+ * function setup() {
930
+ * createCanvas(100, 100, WEBGL);
931
+ *
932
+ * describe('A white cone on a gray background.');
933
+ * }
934
+ *
935
+ * function draw() {
936
+ * background(200);
937
+ *
938
+ * // Enable orbiting with the mouse.
939
+ * orbitControl();
940
+ *
941
+ * // Draw the cone.
942
+ * cone();
943
+ * }
944
+ * </code>
945
+ * </div>
946
+ *
947
+ * <div>
948
+ * <code>
949
+ * // Click and drag the mouse to view the scene from different angles.
950
+ *
951
+ * function setup() {
952
+ * createCanvas(100, 100, WEBGL);
953
+ *
954
+ * describe('A white cone on a gray background.');
955
+ * }
956
+ *
957
+ * function draw() {
958
+ * background(200);
959
+ *
960
+ * // Enable orbiting with the mouse.
961
+ * orbitControl();
962
+ *
963
+ * // Draw the cone.
964
+ * // Set its radius and height to 30.
965
+ * cone(30);
966
+ * }
967
+ * </code>
968
+ * </div>
969
+ *
970
+ * <div>
971
+ * <code>
972
+ * // Click and drag the mouse to view the scene from different angles.
973
+ *
974
+ * function setup() {
975
+ * createCanvas(100, 100, WEBGL);
976
+ *
977
+ * describe('A white cone on a gray background.');
978
+ * }
979
+ *
980
+ * function draw() {
981
+ * background(200);
982
+ *
983
+ * // Enable orbiting with the mouse.
984
+ * orbitControl();
985
+ *
986
+ * // Draw the cone.
987
+ * // Set its radius to 30 and height to 50.
988
+ * cone(30, 50);
989
+ * }
990
+ * </code>
991
+ * </div>
992
+ *
993
+ * <div>
994
+ * <code>
995
+ * // Click and drag the mouse to view the scene from different angles.
996
+ *
997
+ * function setup() {
998
+ * createCanvas(100, 100, WEBGL);
999
+ *
1000
+ * describe('A white cone on a gray background.');
1001
+ * }
1002
+ *
1003
+ * function draw() {
1004
+ * background(200);
1005
+ *
1006
+ * // Enable orbiting with the mouse.
1007
+ * orbitControl();
1008
+ *
1009
+ * // Draw the cone.
1010
+ * // Set its radius to 30 and height to 50.
1011
+ * // Set its detailX to 5.
1012
+ * cone(30, 50, 5);
1013
+ * }
1014
+ * </code>
1015
+ * </div>
1016
+ *
1017
+ * <div>
1018
+ * <code>
1019
+ * // Click and drag the mouse to view the scene from different angles.
1020
+ *
1021
+ * function setup() {
1022
+ * createCanvas(100, 100, WEBGL);
1023
+ *
1024
+ * describe('A white pyramid on a gray background.');
1025
+ * }
1026
+ *
1027
+ * function draw() {
1028
+ * background(200);
1029
+ *
1030
+ * // Enable orbiting with the mouse.
1031
+ * orbitControl();
1032
+ *
1033
+ * // Draw the cone.
1034
+ * // Set its radius to 30 and height to 50.
1035
+ * // Set its detailX to 5.
1036
+ * cone(30, 50, 5);
1037
+ * }
1038
+ * </code>
1039
+ * </div>
1040
+ *
1041
+ * <div>
1042
+ * <code>
1043
+ * // Click and drag the mouse to view the scene from different angles.
1044
+ *
1045
+ * function setup() {
1046
+ * createCanvas(100, 100, WEBGL);
1047
+ *
1048
+ * describe('A white cone on a gray background.');
1049
+ * }
1050
+ *
1051
+ * function draw() {
1052
+ * background(200);
1053
+ *
1054
+ * // Enable orbiting with the mouse.
1055
+ * orbitControl();
1056
+ *
1057
+ * // Draw the cone.
1058
+ * // Set its radius to 30 and height to 50.
1059
+ * // Set its detailX to 24 and detailY to 2.
1060
+ * cone(30, 50, 24, 2);
1061
+ * }
1062
+ * </code>
1063
+ * </div>
1064
+ *
1065
+ * <div>
1066
+ * <code>
1067
+ * // Click and drag the mouse to view the scene from different angles.
1068
+ *
1069
+ * function setup() {
1070
+ * createCanvas(100, 100, WEBGL);
1071
+ *
1072
+ * describe('A white cone on a gray background. Its base is missing.');
1073
+ * }
1074
+ *
1075
+ * function draw() {
1076
+ * background(200);
1077
+ *
1078
+ * // Enable orbiting with the mouse.
1079
+ * orbitControl();
1080
+ *
1081
+ * // Draw the cone.
1082
+ * // Set its radius to 30 and height to 50.
1083
+ * // Set its detailX to 24 and detailY to 1.
1084
+ * // Don't draw its base.
1085
+ * cone(30, 50, 24, 1, false);
1086
+ * }
1087
+ * </code>
1088
+ * </div>
1089
+ */
1090
+ function cone(radius?: number, height?: number, detailX?: number, detailY?: number, cap?: boolean): void;
1091
+
1092
+ /**
1093
+ * Draws an ellipsoid.An ellipsoid is a 3D shape with triangular faces that connect to form a
1094
+ * round surface. Ellipsoids with few faces look like crystals. Ellipsoids
1095
+ * with many faces have smooth surfaces and look like eggs. `ellipsoid()`
1096
+ * defines a shape by its radii. This is different from
1097
+ * ellipse() which uses diameters
1098
+ * (width and height).The first parameter, `radiusX`, is optional. If a `Number` is passed, as in
1099
+ * `ellipsoid(20)`, it sets the radius of the ellipsoid along the x-axis. By
1100
+ * default, `radiusX` is 50.The second parameter, `radiusY`, is also optional. If a `Number` is passed,
1101
+ * as in `ellipsoid(20, 30)`, it sets the ellipsoid’s radius along the y-axis.
1102
+ * By default, `radiusY` is set to the ellipsoid’s `radiusX`.The third parameter, `radiusZ`, is also optional. If a `Number` is passed,
1103
+ * as in `ellipsoid(20, 30, 40)`, it sets the ellipsoid’s radius along the
1104
+ * z-axis. By default, `radiusZ` is set to the ellipsoid’s `radiusY`.The fourth parameter, `detailX`, is also optional. If a `Number` is passed,
1105
+ * as in `ellipsoid(20, 30, 40, 5)`, it sets the number of triangle
1106
+ * subdivisions to use along the x-axis. All 3D shapes are made by connecting
1107
+ * triangles to form their surfaces. By default, `detailX` is 24.The fifth parameter, `detailY`, is also optional. If a `Number` is passed,
1108
+ * as in `ellipsoid(20, 30, 40, 5, 7)`, it sets the number of triangle
1109
+ * subdivisions to use along the y-axis. All 3D shapes are made by connecting
1110
+ * triangles to form their surfaces. By default, `detailY` is 16.Note: `ellipsoid()` can only be used in WebGL mode.
1111
+ *
1112
+ * @param radius of the ellipsoid along the x-axis. Defaults to 50.
1113
+ * @param radius of the ellipsoid along the y-axis. Defaults to `radiusX`.
1114
+ * @param radius of the ellipsoid along the z-axis. Defaults to `radiusY`.
1115
+ * @param number of triangle subdivisions along the x-axis. Defaults to 24.
1116
+ * @param number of triangle subdivisions along the y-axis. Defaults to 16.
1117
+ * @example <div>
1118
+ * <code>
1119
+ * // Click and drag the mouse to view the scene from different angles.
1120
+ *
1121
+ * function setup() {
1122
+ * createCanvas(100, 100, WEBGL);
1123
+ *
1124
+ * describe('A white sphere on a gray background.');
1125
+ * }
1126
+ *
1127
+ * function draw() {
1128
+ * background(200);
1129
+ *
1130
+ * // Enable orbiting with the mouse.
1131
+ * orbitControl();
1132
+ *
1133
+ * // Draw the ellipsoid.
1134
+ * // Set its radiusX to 30.
1135
+ * ellipsoid(30);
1136
+ * }
1137
+ * </code>
1138
+ * </div>
1139
+ *
1140
+ * <div>
1141
+ * <code>
1142
+ * // Click and drag the mouse to view the scene from different angles.
1143
+ *
1144
+ * function setup() {
1145
+ * createCanvas(100, 100, WEBGL);
1146
+ *
1147
+ * describe('A white ellipsoid on a gray background.');
1148
+ * }
1149
+ *
1150
+ * function draw() {
1151
+ * background(200);
1152
+ *
1153
+ * // Enable orbiting with the mouse.
1154
+ * orbitControl();
1155
+ *
1156
+ * // Draw the ellipsoid.
1157
+ * // Set its radiusX to 30.
1158
+ * // Set its radiusY to 40.
1159
+ * ellipsoid(30, 40);
1160
+ * }
1161
+ * </code>
1162
+ * </div>
1163
+ *
1164
+ * <div>
1165
+ * <code>
1166
+ * // Click and drag the mouse to view the scene from different angles.
1167
+ *
1168
+ * function setup() {
1169
+ * createCanvas(100, 100, WEBGL);
1170
+ *
1171
+ * describe('A white ellipsoid on a gray background.');
1172
+ * }
1173
+ *
1174
+ * function draw() {
1175
+ * background(200);
1176
+ *
1177
+ * // Enable orbiting with the mouse.
1178
+ * orbitControl();
1179
+ *
1180
+ * // Draw the ellipsoid.
1181
+ * // Set its radiusX to 30.
1182
+ * // Set its radiusY to 40.
1183
+ * // Set its radiusZ to 50.
1184
+ * ellipsoid(30, 40, 50);
1185
+ * }
1186
+ * </code>
1187
+ * </div>
1188
+ *
1189
+ * <div>
1190
+ * <code>
1191
+ * // Click and drag the mouse to view the scene from different angles.
1192
+ *
1193
+ * function setup() {
1194
+ * createCanvas(100, 100, WEBGL);
1195
+ *
1196
+ * describe('A white ellipsoid on a gray background.');
1197
+ * }
1198
+ *
1199
+ * function draw() {
1200
+ * background(200);
1201
+ *
1202
+ * // Enable orbiting with the mouse.
1203
+ * orbitControl();
1204
+ *
1205
+ * // Draw the ellipsoid.
1206
+ * // Set its radiusX to 30.
1207
+ * // Set its radiusY to 40.
1208
+ * // Set its radiusZ to 50.
1209
+ * // Set its detailX to 4.
1210
+ * ellipsoid(30, 40, 50, 4);
1211
+ * }
1212
+ * </code>
1213
+ * </div>
1214
+ *
1215
+ * <div>
1216
+ * <code>
1217
+ * // Click and drag the mouse to view the scene from different angles.
1218
+ *
1219
+ * function setup() {
1220
+ * createCanvas(100, 100, WEBGL);
1221
+ *
1222
+ * describe('A white ellipsoid on a gray background.');
1223
+ * }
1224
+ *
1225
+ * function draw() {
1226
+ * background(200);
1227
+ *
1228
+ * // Enable orbiting with the mouse.
1229
+ * orbitControl();
1230
+ *
1231
+ * // Draw the ellipsoid.
1232
+ * // Set its radiusX to 30.
1233
+ * // Set its radiusY to 40.
1234
+ * // Set its radiusZ to 50.
1235
+ * // Set its detailX to 4.
1236
+ * // Set its detailY to 3.
1237
+ * ellipsoid(30, 40, 50, 4, 3);
1238
+ * }
1239
+ * </code>
1240
+ * </div>
1241
+ */
1242
+ function ellipsoid(radiusX?: number, radiusY?: number, radiusZ?: number, detailX?: number, detailY?: number): void;
1243
+
1244
+ /**
1245
+ * Draws a torus.A torus is a 3D shape with triangular faces that connect to form a ring.
1246
+ * Toruses with few faces look flattened. Toruses with many faces have smooth
1247
+ * surfaces.The first parameter, `radius`, is optional. If a `Number` is passed, as in
1248
+ * `torus(30)`, it sets the radius of the ring. By default, `radius` is 50.The second parameter, `tubeRadius`, is also optional. If a `Number` is
1249
+ * passed, as in `torus(30, 15)`, it sets the radius of the tube. By default,
1250
+ * `tubeRadius` is 10.The third parameter, `detailX`, is also optional. If a `Number` is passed,
1251
+ * as in `torus(30, 15, 5)`, it sets the number of edges used to draw the hole
1252
+ * of the torus. Using more edges makes the hole look more like a circle. By
1253
+ * default, `detailX` is 24.The fourth parameter, `detailY`, is also optional. If a `Number` is passed,
1254
+ * as in `torus(30, 15, 5, 7)`, it sets the number of triangle subdivisions to
1255
+ * use while filling in the torus’ height. By default, `detailY` is 16.Note: `torus()` can only be used in WebGL mode.
1256
+ *
1257
+ * @param radius of the torus. Defaults to 50.
1258
+ * @param radius of the tube. Defaults to 10.
1259
+ * @param number of edges that form the hole. Defaults to 24.
1260
+ * @param number of triangle subdivisions along the y-axis. Defaults to 16.
1261
+ * @example <div>
1262
+ * <code>
1263
+ * // Click and drag the mouse to view the scene from different angles.
1264
+ *
1265
+ * function setup() {
1266
+ * createCanvas(100, 100, WEBGL);
1267
+ *
1268
+ * describe('A white torus on a gray background.');
1269
+ * }
1270
+ *
1271
+ * function draw() {
1272
+ * background(200);
1273
+ *
1274
+ * // Enable orbiting with the mouse.
1275
+ * orbitControl();
1276
+ *
1277
+ * // Draw the torus.
1278
+ * torus();
1279
+ * }
1280
+ * </code>
1281
+ * </div>
1282
+ *
1283
+ * <div>
1284
+ * <code>
1285
+ * // Click and drag the mouse to view the scene from different angles.
1286
+ *
1287
+ * function setup() {
1288
+ * createCanvas(100, 100, WEBGL);
1289
+ *
1290
+ * describe('A white torus on a gray background.');
1291
+ * }
1292
+ *
1293
+ * function draw() {
1294
+ * background(200);
1295
+ *
1296
+ * // Enable orbiting with the mouse.
1297
+ * orbitControl();
1298
+ *
1299
+ * // Draw the torus.
1300
+ * // Set its radius to 30.
1301
+ * torus(30);
1302
+ * }
1303
+ * </code>
1304
+ * </div>
1305
+ *
1306
+ * <div>
1307
+ * <code>
1308
+ * // Click and drag the mouse to view the scene from different angles.
1309
+ *
1310
+ * function setup() {
1311
+ * createCanvas(100, 100, WEBGL);
1312
+ *
1313
+ * describe('A white torus on a gray background.');
1314
+ * }
1315
+ *
1316
+ * function draw() {
1317
+ * background(200);
1318
+ *
1319
+ * // Enable orbiting with the mouse.
1320
+ * orbitControl();
1321
+ *
1322
+ * // Draw the torus.
1323
+ * // Set its radius to 30 and tubeRadius to 15.
1324
+ * torus(30, 15);
1325
+ * }
1326
+ * </code>
1327
+ * </div>
1328
+ *
1329
+ * <div>
1330
+ * <code>
1331
+ * // Click and drag the mouse to view the scene from different angles.
1332
+ *
1333
+ * function setup() {
1334
+ * createCanvas(100, 100, WEBGL);
1335
+ *
1336
+ * describe('A white torus on a gray background.');
1337
+ * }
1338
+ *
1339
+ * function draw() {
1340
+ * background(200);
1341
+ *
1342
+ * // Enable orbiting with the mouse.
1343
+ * orbitControl();
1344
+ *
1345
+ * // Draw the torus.
1346
+ * // Set its radius to 30 and tubeRadius to 15.
1347
+ * // Set its detailX to 5.
1348
+ * torus(30, 15, 5);
1349
+ * }
1350
+ * </code>
1351
+ * </div>
1352
+ *
1353
+ * <div>
1354
+ * <code>
1355
+ * // Click and drag the mouse to view the scene from different angles.
1356
+ *
1357
+ * function setup() {
1358
+ * createCanvas(100, 100, WEBGL);
1359
+ *
1360
+ * describe('A white torus on a gray background.');
1361
+ * }
1362
+ *
1363
+ * function draw() {
1364
+ * background(200);
1365
+ *
1366
+ * // Enable orbiting with the mouse.
1367
+ * orbitControl();
1368
+ *
1369
+ * // Draw the torus.
1370
+ * // Set its radius to 30 and tubeRadius to 15.
1371
+ * // Set its detailX to 5.
1372
+ * // Set its detailY to 3.
1373
+ * torus(30, 15, 5, 3);
1374
+ * }
1375
+ * </code>
1376
+ * </div>
1377
+ */
1378
+ function torus(radius?: number, tubeRadius?: number, detailX?: number, detailY?: number): void;
1379
+
1380
+ /**
1381
+ * Sets the number of segments used to draw spline curves in WebGL mode.In WebGL mode, smooth shapes are drawn using many flat segments. Adding
1382
+ * more flat segments makes shapes appear smoother.The parameter, `detail`, is the density of segments to use while drawing a
1383
+ * spline curve.Note: `curveDetail()` has no effect in 2D mode.
1384
+ *
1385
+ * @param number of segments to use. Default is 1/4
1386
+ * @example <div>
1387
+ * <code>
1388
+ * function setup() {
1389
+ * createCanvas(100, 100, WEBGL);
1390
+ *
1391
+ * background(200);
1392
+ *
1393
+ * // Set the curveDetail() to 0.5
1394
+ * curveDetail(0.5);
1395
+ *
1396
+ * // Do not show all the vertices
1397
+ * splineProperty('ends', EXCLUDE)
1398
+ *
1399
+ * // Draw a black spline curve.
1400
+ * noFill();
1401
+ * strokeWeight(1);
1402
+ * stroke(0);
1403
+ * spline(-45, -24, 0, 23, -26, 0, 23, 11, 0, -35, 15, 0);
1404
+ *
1405
+ * // Draw red spline curves from the anchor points to the control points.
1406
+ * spline(255, 0, 0);
1407
+ * spline(-45, -24, 0, -45, -24, 0, 23, -26, 0, 23, 11, 0);
1408
+ * spline(23, -26, 0, 23, 11, 0, -35, 15, 0, -35, 15, 0);
1409
+ *
1410
+ * // Draw the anchor points in black.
1411
+ * strokeWeight(5);
1412
+ * stroke(0);
1413
+ * point(23, -26);
1414
+ * point(23, 11);
1415
+ *
1416
+ * // Draw the control points in red.
1417
+ * stroke(255, 0, 0);
1418
+ * point(-45, -24);
1419
+ * point(-35, 15);
1420
+ *
1421
+ * describe(
1422
+ * 'A gray square with a jagged curve drawn in three segments. The curve is a sideways U shape with red segments on top and bottom, and a black segment on the right. The endpoints of all the segments are marked with dots.'
1423
+ * );
1424
+ * }
1425
+ * </code>
1426
+ * </div>
1427
+ */
1428
+ function curveDetail(resolution: number): void;
1429
+
1430
+ }
1431
+
1432
+ export default function 3d_primitives(p5: any, fn: any): void;