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,481 @@
1
+ // This file is auto-generated from JSDoc documentation
2
+
3
+ import p5 from 'p5';
4
+
5
+ declare module 'p5' {
6
+ /**
7
+ * Creates a canvas element on the web page.`createCanvas()` creates the main drawing canvas for a sketch. It should
8
+ * only be called once at the beginning of setup().
9
+ * Calling `createCanvas()` more than once causes unpredictable behavior.The first two parameters, `width` and `height`, are optional. They set the
10
+ * dimensions of the canvas and the values of the
11
+ * width and height system
12
+ * variables. For example, calling `createCanvas(900, 500)` creates a canvas
13
+ * that's 900×500 pixels. By default, `width` and `height` are both 100.The third parameter is also optional. If either of the constants `P2D` or
14
+ * `WEBGL` is passed, as in `createCanvas(900, 500, WEBGL)`, then it will set
15
+ * the sketch's rendering mode. If an existing
16
+ * HTMLCanvasElement
17
+ * is passed, as in `createCanvas(900, 500, myCanvas)`, then it will be used
18
+ * by the sketch.The fourth parameter is also optional. If an existing
19
+ * HTMLCanvasElement
20
+ * is passed, as in `createCanvas(900, 500, WEBGL, myCanvas)`, then it will be
21
+ * used by the sketch.Note: In WebGL mode, the canvas will use a WebGL2 context if it's supported
22
+ * by the browser. Check the webglVersion
23
+ * system variable to check what version is being used, or call
24
+ * `setAttributes({ version: 1 })` to create a WebGL1 context.
25
+ *
26
+ * @param width of the canvas. Defaults to 100.
27
+ * @param height of the canvas. Defaults to 100.
28
+ * @param either P2D or WEBGL. Defaults to `P2D`.
29
+ * @param existing canvas element that should be used for the sketch.
30
+ * @return new `p5.Renderer` that holds the canvas.
31
+ * @example <div>
32
+ * <code>
33
+ * function setup() {
34
+ * createCanvas(100, 100);
35
+ *
36
+ * background(200);
37
+ *
38
+ * // Draw a diagonal line.
39
+ * line(0, 0, width, height);
40
+ *
41
+ * describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
42
+ * }
43
+ * </code>
44
+ * </div>
45
+ *
46
+ * <div>
47
+ * <code>
48
+ * function setup() {
49
+ * createCanvas(100, 50);
50
+ *
51
+ * background(200);
52
+ *
53
+ * // Draw a diagonal line.
54
+ * line(0, 0, width, height);
55
+ *
56
+ * describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
57
+ * }
58
+ * </code>
59
+ * </div>
60
+ *
61
+ * <div>
62
+ * <code>
63
+ * // Use WebGL mode.
64
+ *
65
+ * function setup() {
66
+ * createCanvas(100, 100, WEBGL);
67
+ *
68
+ * background(200);
69
+ *
70
+ * // Draw a diagonal line.
71
+ * line(-width / 2, -height / 2, width / 2, height / 2);
72
+ *
73
+ * describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
74
+ * }
75
+ * </code>
76
+ * </div>
77
+ *
78
+ * <div>
79
+ * <code>
80
+ * function setup() {
81
+ * // Create a p5.Render object.
82
+ * let cnv = createCanvas(50, 50);
83
+ *
84
+ * // Position the canvas.
85
+ * cnv.position(10, 20);
86
+ *
87
+ * background(200);
88
+ *
89
+ * // Draw a diagonal line.
90
+ * line(0, 0, width, height);
91
+ *
92
+ * describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
93
+ * }
94
+ * </code>
95
+ * </div>
96
+ */
97
+ function createCanvas(width?: number, height?: number, renderer?: P2D | WEBGL | P2DHDR, canvas?: HTMLCanvasElement): p5.Renderer;
98
+
99
+ /**
100
+ */
101
+ function createCanvas(width?: number, height?: number, canvas?: HTMLCanvasElement): p5.Renderer;
102
+
103
+ /**
104
+ * Resizes the canvas to a given width and height.`resizeCanvas()` immediately clears the canvas and calls
105
+ * redraw(). It's common to call `resizeCanvas()`
106
+ * within the body of windowResized() like
107
+ * so:`function windowResized() {
108
+ * resizeCanvas(windowWidth, windowHeight);
109
+ * }`The first two parameters, `width` and `height`, set the dimensions of the
110
+ * canvas. They also the values of the width and
111
+ * height system variables. For example, calling
112
+ * `resizeCanvas(300, 500)` resizes the canvas to 300×500 pixels, then sets
113
+ * width to 300 and
114
+ * height 500.The third parameter, `noRedraw`, is optional. If `true` is passed, as in
115
+ * `resizeCanvas(300, 500, true)`, then the canvas will be canvas to 300×500
116
+ * pixels but the redraw() function won't be called
117
+ * immediately. By default, redraw() is called
118
+ * immediately when `resizeCanvas()` finishes executing.
119
+ *
120
+ * @param width of the canvas.
121
+ * @param height of the canvas.
122
+ * @param whether to delay calling
123
+ * <a href="#/p5/redraw">redraw()</a>. Defaults
124
+ * to `false`.
125
+ * @example <div>
126
+ * <code>
127
+ * // Double-click to resize the canvas.
128
+ *
129
+ * function setup() {
130
+ * createCanvas(100, 100);
131
+ *
132
+ * describe(
133
+ * 'A white circle drawn on a gray background. The canvas shrinks by half the first time the user double-clicks.'
134
+ * );
135
+ * }
136
+ *
137
+ * function draw() {
138
+ * background(200);
139
+ *
140
+ * // Draw a circle at the center of the canvas.
141
+ * circle(width / 2, height / 2, 20);
142
+ * }
143
+ *
144
+ * // Resize the canvas when the user double-clicks.
145
+ * function doubleClicked() {
146
+ * resizeCanvas(50, 50);
147
+ * }
148
+ * </code>
149
+ * </div>
150
+ *
151
+ * <div>
152
+ * <code>
153
+ * // Resize the web browser to change the canvas size.
154
+ *
155
+ * function setup() {
156
+ * createCanvas(windowWidth, windowHeight);
157
+ *
158
+ * describe('A white circle drawn on a gray background.');
159
+ * }
160
+ *
161
+ * function draw() {
162
+ * background(200);
163
+ *
164
+ * // Draw a circle at the center of the canvas.
165
+ * circle(width / 2, height / 2, 20);
166
+ * }
167
+ *
168
+ * // Always resize the canvas to fill the browser window.
169
+ * function windowResized() {
170
+ * resizeCanvas(windowWidth, windowHeight);
171
+ * }
172
+ * </code>
173
+ * </div>
174
+ */
175
+ function resizeCanvas(width: number, height: number, noRedraw?: boolean): void;
176
+
177
+ /**
178
+ * Removes the default canvas.By default, a 100×100 pixels canvas is created without needing to call
179
+ * createCanvas(). `noCanvas()` removes the
180
+ * default canvas for sketches that don't need it.
181
+ *
182
+ * @example <div>
183
+ * <code>
184
+ * function setup() {
185
+ * noCanvas();
186
+ * }
187
+ * </code>
188
+ * </div>
189
+ */
190
+ function noCanvas(): void;
191
+
192
+ /**
193
+ * Creates a p5.Graphics object.`createGraphics()` creates an offscreen drawing canvas (graphics buffer)
194
+ * and returns it as a p5.Graphics object. Drawing
195
+ * to a separate graphics buffer can be helpful for performance and for
196
+ * organizing code.The first two parameters, `width` and `height`, are optional. They set the
197
+ * dimensions of the p5.Graphics object. For
198
+ * example, calling `createGraphics(900, 500)` creates a graphics buffer
199
+ * that's 900×500 pixels.The third parameter is also optional. If either of the constants `P2D` or
200
+ * `WEBGL` is passed, as in `createGraphics(900, 500, WEBGL)`, then it will set
201
+ * the p5.Graphics object's rendering mode. If an
202
+ * existing
203
+ * HTMLCanvasElement
204
+ * is passed, as in `createGraphics(900, 500, myCanvas)`, then it will be used
205
+ * by the graphics buffer.The fourth parameter is also optional. If an existing
206
+ * HTMLCanvasElement
207
+ * is passed, as in `createGraphics(900, 500, WEBGL, myCanvas)`, then it will be
208
+ * used by the graphics buffer.Note: In WebGL mode, the p5.Graphics object
209
+ * will use a WebGL2 context if it's supported by the browser. Check the
210
+ * webglVersion system variable to check what
211
+ * version is being used, or call `setAttributes({ version: 1 })` to create a
212
+ * WebGL1 context.
213
+ *
214
+ * @param width of the graphics buffer.
215
+ * @param height of the graphics buffer.
216
+ * @param either P2D or WEBGL. Defaults to P2D.
217
+ * @param existing canvas element that should be
218
+ * used for the graphics buffer..
219
+ * @return new graphics buffer.
220
+ * @example <div>
221
+ * <code>
222
+ * // Double-click to draw the contents of the graphics buffer.
223
+ *
224
+ * let pg;
225
+ *
226
+ * function setup() {
227
+ * createCanvas(100, 100);
228
+ *
229
+ * background(200);
230
+ *
231
+ * // Create the p5.Graphics object.
232
+ * pg = createGraphics(50, 50);
233
+ *
234
+ * // Draw to the graphics buffer.
235
+ * pg.background(100);
236
+ * pg.circle(pg.width / 2, pg.height / 2, 20);
237
+ *
238
+ * describe('A gray square. A smaller, darker square with a white circle at its center appears when the user double-clicks.');
239
+ * }
240
+ *
241
+ * // Display the graphics buffer when the user double-clicks.
242
+ * function doubleClicked() {
243
+ * if (mouseX > 0 && mouseX < 100 && mouseY > 0 && mouseY < 100) {
244
+ * image(pg, 25, 25);
245
+ * }
246
+ * }
247
+ * </code>
248
+ * </div>
249
+ *
250
+ * <div>
251
+ * <code>
252
+ * // Double-click to draw the contents of the graphics buffer.
253
+ *
254
+ * let pg;
255
+ *
256
+ * function setup() {
257
+ * createCanvas(100, 100);
258
+ *
259
+ * background(200);
260
+ *
261
+ * // Create the p5.Graphics object in WebGL mode.
262
+ * pg = createGraphics(50, 50, WEBGL);
263
+ *
264
+ * // Draw to the graphics buffer.
265
+ * pg.background(100);
266
+ * pg.lights();
267
+ * pg.noStroke();
268
+ * pg.rotateX(QUARTER_PI);
269
+ * pg.rotateY(QUARTER_PI);
270
+ * pg.torus(15, 5);
271
+ *
272
+ * describe('A gray square. A smaller, darker square with a white torus at its center appears when the user double-clicks.');
273
+ * }
274
+ *
275
+ * // Display the graphics buffer when the user double-clicks.
276
+ * function doubleClicked() {
277
+ * if (mouseX > 0 && mouseX < 100 && mouseY > 0 && mouseY < 100) {
278
+ * image(pg, 25, 25);
279
+ * }
280
+ * }
281
+ * </code>
282
+ * </div>
283
+ */
284
+ function createGraphics(width: number, height: number, renderer?: P2D | WEBGL, canvas?: HTMLCanvasElement): p5.Graphics;
285
+
286
+ /**
287
+ */
288
+ function createGraphics(width: number, height: number, canvas?: HTMLCanvasElement): p5.Graphics;
289
+
290
+ /**
291
+ * Creates and a new p5.Framebuffer object.p5.Framebuffer objects are separate drawing
292
+ * surfaces that can be used as textures in WebGL mode. They're similar to
293
+ * p5.Graphics objects and generally run much
294
+ * faster when used as textures.The parameter, `options`, is optional. An object can be passed to configure
295
+ * the p5.Framebuffer object. The available
296
+ * properties are:If the `width`, `height`, or `density` attributes are set, they won't automatically match the main canvas and must be changed manually.Note: `createFramebuffer()` can only be used in WebGL mode.
297
+ *
298
+ * @param configuration options.
299
+ * @return new framebuffer.
300
+ * @example <div>
301
+ * <code>
302
+ * let myBuffer;
303
+ *
304
+ * function setup() {
305
+ * createCanvas(100, 100, WEBGL);
306
+ *
307
+ * // Create a p5.Framebuffer object.
308
+ * myBuffer = createFramebuffer();
309
+ *
310
+ * describe('A grid of white toruses rotating against a dark gray background.');
311
+ * }
312
+ *
313
+ * function draw() {
314
+ * background(50);
315
+ *
316
+ * // Start drawing to the p5.Framebuffer object.
317
+ * myBuffer.begin();
318
+ *
319
+ * // Clear the drawing surface.
320
+ * clear();
321
+ *
322
+ * // Turn on the lights.
323
+ * lights();
324
+ *
325
+ * // Rotate the coordinate system.
326
+ * rotateX(frameCount * 0.01);
327
+ * rotateY(frameCount * 0.01);
328
+ *
329
+ * // Style the torus.
330
+ * noStroke();
331
+ *
332
+ * // Draw the torus.
333
+ * torus(20);
334
+ *
335
+ * // Stop drawing to the p5.Framebuffer object.
336
+ * myBuffer.end();
337
+ *
338
+ * // Iterate from left to right.
339
+ * for (let x = -50; x < 50; x += 25) {
340
+ * // Iterate from top to bottom.
341
+ * for (let y = -50; y < 50; y += 25) {
342
+ * // Draw the p5.Framebuffer object to the canvas.
343
+ * image(myBuffer, x, y, 25, 25);
344
+ * }
345
+ * }
346
+ * }
347
+ * </code>
348
+ * </div>
349
+ *
350
+ * <div>
351
+ * <code>
352
+ * let myBuffer;
353
+ *
354
+ * function setup() {
355
+ * createCanvas(100, 100, WEBGL);
356
+ *
357
+ * // Create an options object.
358
+ * let options = { width: 25, height: 25 };
359
+ *
360
+ * // Create a p5.Framebuffer object.
361
+ * // Use options for configuration.
362
+ * myBuffer = createFramebuffer(options);
363
+ *
364
+ * describe('A grid of white toruses rotating against a dark gray background.');
365
+ * }
366
+ *
367
+ * function draw() {
368
+ * background(50);
369
+ *
370
+ * // Start drawing to the p5.Framebuffer object.
371
+ * myBuffer.begin();
372
+ *
373
+ * // Clear the drawing surface.
374
+ * clear();
375
+ *
376
+ * // Turn on the lights.
377
+ * lights();
378
+ *
379
+ * // Rotate the coordinate system.
380
+ * rotateX(frameCount * 0.01);
381
+ * rotateY(frameCount * 0.01);
382
+ *
383
+ * // Style the torus.
384
+ * noStroke();
385
+ *
386
+ * // Draw the torus.
387
+ * torus(5, 2.5);
388
+ *
389
+ * // Stop drawing to the p5.Framebuffer object.
390
+ * myBuffer.end();
391
+ *
392
+ * // Iterate from left to right.
393
+ * for (let x = -50; x < 50; x += 25) {
394
+ * // Iterate from top to bottom.
395
+ * for (let y = -50; y < 50; y += 25) {
396
+ * // Draw the p5.Framebuffer object to the canvas.
397
+ * image(myBuffer, x, y);
398
+ * }
399
+ * }
400
+ * }
401
+ * </code>
402
+ * </div>
403
+ */
404
+ function createFramebuffer(options?: object): p5.Framebuffer;
405
+
406
+ /**
407
+ * Clears the depth buffer in WebGL mode.`clearDepth()` clears information about how far objects are from the camera
408
+ * in 3D space. This information is stored in an object called the
409
+ * . Clearing the depth buffer ensures new objects aren't drawn
410
+ * behind old ones. Doing so can be useful for feedback effects in which the
411
+ * previous frame serves as the background for the current frame.The parameter, `depth`, is optional. If a number is passed, as in
412
+ * `clearDepth(0.5)`, it determines the range of objects to clear from the
413
+ * depth buffer. 0 doesn't clear any depth information, 0.5 clears depth
414
+ * information halfway between the near and far clipping planes, and 1 clears
415
+ * depth information all the way to the far clipping plane. By default,
416
+ * `depth` is 1.Note: `clearDepth()` can only be used in WebGL mode.
417
+ *
418
+ * @param amount of the depth buffer to clear between 0
419
+ * (none) and 1 (far clipping plane). Defaults to 1.
420
+ * @example <div>
421
+ * <code>
422
+ * let previous;
423
+ * let current;
424
+ *
425
+ * function setup() {
426
+ * createCanvas(100, 100, WEBGL);
427
+ *
428
+ * // Create the p5.Framebuffer objects.
429
+ * previous = createFramebuffer({ format: FLOAT });
430
+ * current = createFramebuffer({ format: FLOAT });
431
+ *
432
+ * describe(
433
+ * 'A multicolor box drifts from side to side on a white background. It leaves a trail that fades over time.'
434
+ * );
435
+ * }
436
+ *
437
+ * function draw() {
438
+ * // Swap the previous p5.Framebuffer and the
439
+ * // current one so it can be used as a texture.
440
+ * [previous, current] = [current, previous];
441
+ *
442
+ * // Start drawing to the current p5.Framebuffer.
443
+ * current.begin();
444
+ *
445
+ * // Paint the background.
446
+ * background(255);
447
+ *
448
+ * // Draw the previous p5.Framebuffer.
449
+ * // Clear the depth buffer so the previous
450
+ * // frame doesn't block the current one.
451
+ * push();
452
+ * tint(255, 250);
453
+ * image(previous, -50, -50);
454
+ * clearDepth();
455
+ * pop();
456
+ *
457
+ * // Draw the box on top of the previous frame.
458
+ * push();
459
+ * let x = 25 * sin(frameCount * 0.01);
460
+ * let y = 25 * sin(frameCount * 0.02);
461
+ * translate(x, y, 0);
462
+ * rotateX(frameCount * 0.01);
463
+ * rotateY(frameCount * 0.01);
464
+ * normalMaterial();
465
+ * box(12);
466
+ * pop();
467
+ *
468
+ * // Stop drawing to the current p5.Framebuffer.
469
+ * current.end();
470
+ *
471
+ * // Display the current p5.Framebuffer.
472
+ * image(current, -50, -50);
473
+ * }
474
+ * </code>
475
+ * </div>
476
+ */
477
+ function clearDepth(depth?: number): void;
478
+
479
+ }
480
+
481
+ export default function rendering(p5: any, fn: any): void;