p5 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accessibility/color_namer.js +5 -5
- package/dist/accessibility/describe.js +10 -0
- package/dist/accessibility/index.js +5 -5
- package/dist/accessibility/outputs.js +21 -0
- package/dist/app.js +5 -5
- package/dist/color/color_conversion.js +5 -5
- package/dist/color/creating_reading.js +1 -1
- package/dist/color/index.js +2 -2
- package/dist/color/p5.Color.js +1 -1
- package/dist/color/setting.js +2 -2
- package/dist/{constants-C-g_eAdC.js → constants-BRcElHU3.js} +19 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +6 -5
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +46 -93
- package/dist/core/friendly_errors/sketch_reader.js +5 -5
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/friendly_errors/validate_params.js +5 -5
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -5
- package/dist/core/legacy.js +5 -5
- package/dist/core/main.js +5 -5
- package/dist/core/p5.Graphics.js +4 -4
- package/dist/core/p5.Renderer.js +3 -3
- package/dist/core/p5.Renderer2D.js +5 -5
- package/dist/core/rendering.js +4 -4
- package/dist/{creating_reading-D4AAKRbx.js → creating_reading-Cr8L2Jnm.js} +2 -2
- package/dist/dom/dom.js +10 -10
- package/dist/dom/index.js +2 -2
- package/dist/dom/p5.Element.js +2 -2
- package/dist/dom/p5.MediaElement.js +2 -2
- package/dist/events/acceleration.js +24 -24
- package/dist/events/keyboard.js +11 -6
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -4
- package/dist/image/image.js +4 -4
- package/dist/image/index.js +4 -4
- package/dist/image/loading_displaying.js +4 -4
- package/dist/image/p5.Image.js +3 -3
- package/dist/image/pixels.js +1 -0
- package/dist/io/files.js +4 -4
- package/dist/io/index.js +4 -4
- package/dist/io/p5.TableRow.js +2 -2
- package/dist/{main-s72KWcUy.js → main-BKN5yFoS.js} +12 -9
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/index.js +1 -1
- package/dist/math/math.js +1 -1
- package/dist/math/p5.Matrix.js +1 -1
- package/dist/math/p5.Vector.js +1 -1
- package/dist/math/trigonometry.js +1 -1
- package/dist/{p5.Renderer-CwAYZOC2.js → p5.Renderer-R23xoC7s.js} +5 -5
- package/dist/{rendering--aAe5aq3.js → rendering-CvUVN-Vb.js} +101 -66
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +2 -2
- package/dist/shape/index.js +2 -2
- package/dist/type/index.js +3 -3
- package/dist/type/p5.Font.js +3 -5
- package/dist/type/textCore.js +4 -4
- package/dist/webgl/3d_primitives.js +4 -4
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/index.js +4 -4
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +4 -4
- package/dist/webgl/loading.js +5 -4
- package/dist/webgl/material.js +4 -4
- package/dist/webgl/p5.Camera.js +4 -4
- package/dist/webgl/p5.Framebuffer.js +4 -4
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +4 -4
- package/dist/webgl/p5.Shader.js +4 -4
- package/dist/webgl/p5.Texture.js +4 -4
- package/dist/webgl/text.js +32 -34
- package/lib/p5.esm.js +289 -247
- package/lib/p5.js +289 -247
- package/lib/p5.min.js +1 -1
- package/package.json +1 -2
- package/types/accessibility/color_namer.d.ts +8 -0
- package/types/accessibility/describe.d.ts +184 -0
- package/types/accessibility/gridOutput.d.ts +8 -0
- package/types/accessibility/outputs.d.ts +235 -0
- package/types/accessibility/textOutput.d.ts +8 -0
- package/types/color/color_conversion.d.ts +47 -0
- package/types/color/creating_reading.d.ts +1348 -0
- package/types/color/p5.Color.d.ts +1070 -0
- package/types/color/setting.d.ts +2085 -0
- package/types/core/constants.d.ts +341 -0
- package/types/core/environment.d.ts +668 -0
- package/types/core/friendly_errors/fes_core.d.ts +8 -0
- package/types/core/friendly_errors/file_errors.d.ts +8 -0
- package/types/core/friendly_errors/param_validator.d.ts +30 -0
- package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
- package/types/core/friendly_errors/stacktrace.d.ts +11 -0
- package/types/core/friendly_errors/validate_params.d.ts +8 -0
- package/types/core/helpers.d.ts +8 -0
- package/types/core/legacy.d.ts +8 -0
- package/types/core/main.d.ts +5999 -0
- package/types/core/p5.Graphics.d.ts +484 -0
- package/types/core/p5.Renderer.d.ts +14 -0
- package/types/core/reference.d.ts +8 -0
- package/types/core/rendering.d.ts +481 -0
- package/types/core/structure.d.ts +492 -0
- package/types/core/transform.d.ts +1638 -0
- package/types/data/local_storage.d.ts +323 -0
- package/types/dom/dom.d.ts +1295 -0
- package/types/dom/p5.Element.d.ts +2011 -0
- package/types/dom/p5.File.d.ts +13 -0
- package/types/dom/p5.MediaElement.d.ts +1249 -0
- package/types/events/acceleration.d.ts +193 -0
- package/types/events/keyboard.d.ts +501 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5544 -0
- package/types/image/filterRenderer2D.d.ts +54 -0
- package/types/image/image.d.ts +326 -0
- package/types/image/loading_displaying.d.ts +580 -0
- package/types/image/p5.Image.d.ts +5882 -0
- package/types/image/pixels.d.ts +832 -0
- package/types/io/files.d.ts +1447 -0
- package/types/io/p5.Table.d.ts +1247 -0
- package/types/io/p5.TableRow.d.ts +343 -0
- package/types/io/p5.XML.d.ts +1188 -0
- package/types/math/Matrices/Matrix.d.ts +1029 -0
- package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
- package/types/math/calculation.d.ts +923 -0
- package/types/math/math.d.ts +90 -0
- package/types/math/noise.d.ts +311 -0
- package/types/math/p5.Matrix.d.ts +8 -0
- package/types/math/p5.Vector.d.ts +3416 -0
- package/types/math/random.d.ts +267 -0
- package/types/math/trigonometry.d.ts +663 -0
- package/types/p5.d.ts +6666 -0
- package/types/shape/2d_primitives.d.ts +1033 -0
- package/types/shape/attributes.d.ts +466 -0
- package/types/shape/curves.d.ts +740 -0
- package/types/shape/custom_shapes.d.ts +888 -0
- package/types/shape/vertex.d.ts +1141 -0
- package/types/type/p5.Font.d.ts +575 -0
- package/types/type/textCore.d.ts +1198 -0
- package/types/utilities/conversion.d.ts +894 -0
- package/types/utilities/time_date.d.ts +295 -0
- package/types/utilities/utility_functions.d.ts +587 -0
- package/types/webgl/3d_primitives.d.ts +1432 -0
- package/types/webgl/ShaderGenerator.d.ts +8 -0
- package/types/webgl/interaction.d.ts +371 -0
- package/types/webgl/light.d.ts +1184 -0
- package/types/webgl/loading.d.ts +482 -0
- package/types/webgl/material.d.ts +2656 -0
- package/types/webgl/p5.Camera.d.ts +3023 -0
- package/types/webgl/p5.DataArray.d.ts +61 -0
- package/types/webgl/p5.Framebuffer.d.ts +760 -0
- package/types/webgl/p5.Geometry.d.ts +1191 -0
- package/types/webgl/p5.Quat.d.ts +45 -0
- package/types/webgl/p5.RendererGL.d.ts +234 -0
- package/types/webgl/p5.Shader.d.ts +660 -0
- package/types/webgl/p5.Texture.d.ts +61 -0
- package/types/webgl/text.d.ts +74 -0
|
@@ -0,0 +1,888 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* Influences the shape of the Bézier curve segment in a custom shape.
|
|
8
|
+
* By default, this is 3; the other possible parameter is 2. This
|
|
9
|
+
* results in quadratic Bézier curves.`bezierVertex()` adds a curved segment to custom shapes. The Bézier curves
|
|
10
|
+
* it creates are defined like those made by the
|
|
11
|
+
* bezier() function. `bezierVertex()` must be
|
|
12
|
+
* called between the
|
|
13
|
+
* beginShape() and
|
|
14
|
+
* endShape() functions. There must be at least
|
|
15
|
+
* one call to bezierVertex(), before
|
|
16
|
+
* a number of `bezierVertex()` calls that is a multiple of the parameter
|
|
17
|
+
* set by bezierOrder(...) (default 3).Each curve of order 3 requires three calls to `bezierVertex`, so
|
|
18
|
+
* 2 curves would need 7 calls to `bezierVertex()`:
|
|
19
|
+
* (1 one initial anchor point, two sets of 3 curves describing the curves)
|
|
20
|
+
* With `bezierOrder(2)`, two curves would need 5 calls: 1 + 2 + 2.Bézier curves can also be drawn in 3D using WebGL mode.Note: `bezierVertex()` won’t work when an argument is passed to
|
|
21
|
+
* beginShape().
|
|
22
|
+
*
|
|
23
|
+
* @param The new order to set. Can be either 2 or 3, by default 3
|
|
24
|
+
* @example <div>
|
|
25
|
+
* <code>
|
|
26
|
+
* function setup() {
|
|
27
|
+
* createCanvas(100, 100);
|
|
28
|
+
*
|
|
29
|
+
* background(200);
|
|
30
|
+
*
|
|
31
|
+
* // Style the shape.
|
|
32
|
+
* noFill();
|
|
33
|
+
*
|
|
34
|
+
* // Start drawing the shape.
|
|
35
|
+
* beginShape();
|
|
36
|
+
*
|
|
37
|
+
* // set the order to 2 for a quadratic Bézier curve
|
|
38
|
+
* bezierOrder(2);
|
|
39
|
+
*
|
|
40
|
+
* // Add the first anchor point.
|
|
41
|
+
* bezierVertex(30, 20);
|
|
42
|
+
*
|
|
43
|
+
* // Add the Bézier vertex.
|
|
44
|
+
* bezierVertex(80, 20);
|
|
45
|
+
* bezierVertex(50, 50);
|
|
46
|
+
*
|
|
47
|
+
* // Stop drawing the shape.
|
|
48
|
+
* endShape();
|
|
49
|
+
*
|
|
50
|
+
* describe('A black curve drawn on a gray square. The curve starts at the top-left corner and ends at the center.');
|
|
51
|
+
* }
|
|
52
|
+
* </code>
|
|
53
|
+
* </div>
|
|
54
|
+
*/
|
|
55
|
+
function bezierOrder(order: number): void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @returns The current Bézier order.
|
|
59
|
+
*/
|
|
60
|
+
function bezierOrder(): number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Adds a spline curve segment to a custom shape.`splineVertex()` adds a curved segment to custom shapes. The spline curves
|
|
64
|
+
* it creates are defined like those made by the
|
|
65
|
+
* curve() function. `splineVertex()` must be called
|
|
66
|
+
* between the beginShape() and
|
|
67
|
+
* endShape() functions.Spline curves can form shapes and curves that slope gently. They’re like
|
|
68
|
+
* cables that are attached to a set of points. Splines are defined by two
|
|
69
|
+
* anchor points and two control points. `splineVertex()` must be called at
|
|
70
|
+
* least four times between
|
|
71
|
+
* beginShape() and
|
|
72
|
+
* endShape() in order to draw a curve:`beginShape();
|
|
73
|
+
*
|
|
74
|
+
* // Add the first control point.
|
|
75
|
+
* splineVertex(84, 91);
|
|
76
|
+
*
|
|
77
|
+
* // Add the anchor points to draw between.
|
|
78
|
+
* splineVertex(68, 19);
|
|
79
|
+
* splineVertex(21, 17);
|
|
80
|
+
*
|
|
81
|
+
* // Add the second control point.
|
|
82
|
+
* splineVertex(32, 91);
|
|
83
|
+
*
|
|
84
|
+
* endShape();`The code snippet above would only draw the curve between the anchor points,
|
|
85
|
+
* similar to the curve() function. The segments
|
|
86
|
+
* between the control and anchor points can be drawn by calling
|
|
87
|
+
* `splineVertex()` with the coordinates of the control points:`beginShape();
|
|
88
|
+
*
|
|
89
|
+
* // Add the first control point and draw a segment to it.
|
|
90
|
+
* splineVertex(84, 91);
|
|
91
|
+
* splineVertex(84, 91);
|
|
92
|
+
*
|
|
93
|
+
* // Add the anchor points to draw between.
|
|
94
|
+
* splineVertex(68, 19);
|
|
95
|
+
* splineVertex(21, 17);
|
|
96
|
+
*
|
|
97
|
+
* // Add the second control point.
|
|
98
|
+
* splineVertex(32, 91);
|
|
99
|
+
*
|
|
100
|
+
* // Uncomment the next line to draw the segment to the second control point.
|
|
101
|
+
* // splineVertex(32, 91);
|
|
102
|
+
*
|
|
103
|
+
* endShape();`The first two parameters, `x` and `y`, set the vertex’s location. For
|
|
104
|
+
* example, calling `splineVertex(10, 10)` adds a point to the curve at
|
|
105
|
+
* `(10, 10)`.Spline curves can also be drawn in 3D using WebGL mode. The 3D version of
|
|
106
|
+
* `splineVertex()` has three arguments because each point has x-, y-, and
|
|
107
|
+
* z-coordinates. By default, the vertex’s z-coordinate is set to 0.Note: `splineVertex()` won’t work when an argument is passed to
|
|
108
|
+
* beginShape().
|
|
109
|
+
*
|
|
110
|
+
* @param x-coordinate of the vertex
|
|
111
|
+
* @param y-coordinate of the vertex
|
|
112
|
+
* @example <div>
|
|
113
|
+
* <code>
|
|
114
|
+
* function setup() {
|
|
115
|
+
* createCanvas(100, 100);
|
|
116
|
+
*
|
|
117
|
+
* background(200);
|
|
118
|
+
*
|
|
119
|
+
* // Style the shape.
|
|
120
|
+
* noFill();
|
|
121
|
+
* strokeWeight(1);
|
|
122
|
+
*
|
|
123
|
+
* // Start drawing the shape.
|
|
124
|
+
* beginShape();
|
|
125
|
+
*
|
|
126
|
+
* // Add the first control point.
|
|
127
|
+
* splineVertex(32, 91);
|
|
128
|
+
*
|
|
129
|
+
* // Add the anchor points.
|
|
130
|
+
* splineVertex(21, 17);
|
|
131
|
+
* splineVertex(68, 19);
|
|
132
|
+
*
|
|
133
|
+
* // Add the second control point.
|
|
134
|
+
* splineVertex(84, 91);
|
|
135
|
+
*
|
|
136
|
+
* // Stop drawing the shape.
|
|
137
|
+
* endShape();
|
|
138
|
+
*
|
|
139
|
+
* // Style the anchor and control points.
|
|
140
|
+
* strokeWeight(5);
|
|
141
|
+
*
|
|
142
|
+
* // Draw the anchor points in black.
|
|
143
|
+
* stroke(0);
|
|
144
|
+
* point(21, 17);
|
|
145
|
+
* point(68, 19);
|
|
146
|
+
*
|
|
147
|
+
* // Draw the control points in red.
|
|
148
|
+
* stroke(255, 0, 0);
|
|
149
|
+
* point(32, 91);
|
|
150
|
+
* point(84, 91);
|
|
151
|
+
*
|
|
152
|
+
* describe(
|
|
153
|
+
* 'A black curve drawn on a gray background. The curve has black dots at its ends. Two red dots appear near the bottom of the canvas.'
|
|
154
|
+
* );
|
|
155
|
+
* }
|
|
156
|
+
* </code>
|
|
157
|
+
* </div>
|
|
158
|
+
*
|
|
159
|
+
* <div>
|
|
160
|
+
* <code>
|
|
161
|
+
* function setup() {
|
|
162
|
+
* createCanvas(100, 100);
|
|
163
|
+
*
|
|
164
|
+
* background(200);
|
|
165
|
+
*
|
|
166
|
+
* // Style the shape.
|
|
167
|
+
* noFill();
|
|
168
|
+
* strokeWeight(1);
|
|
169
|
+
*
|
|
170
|
+
* // Start drawing the shape.
|
|
171
|
+
* beginShape();
|
|
172
|
+
*
|
|
173
|
+
* // Add the first control point and draw a segment to it.
|
|
174
|
+
* splineVertex(32, 91);
|
|
175
|
+
* splineVertex(32, 91);
|
|
176
|
+
*
|
|
177
|
+
* // Add the anchor points.
|
|
178
|
+
* splineVertex(21, 17);
|
|
179
|
+
* splineVertex(68, 19);
|
|
180
|
+
*
|
|
181
|
+
* // Add the second control point.
|
|
182
|
+
* splineVertex(84, 91);
|
|
183
|
+
*
|
|
184
|
+
* // Stop drawing the shape.
|
|
185
|
+
* endShape();
|
|
186
|
+
*
|
|
187
|
+
* // Style the anchor and control points.
|
|
188
|
+
* strokeWeight(5);
|
|
189
|
+
*
|
|
190
|
+
* // Draw the anchor points in black.
|
|
191
|
+
* stroke(0);
|
|
192
|
+
* point(21, 17);
|
|
193
|
+
* point(68, 19);
|
|
194
|
+
*
|
|
195
|
+
* // Draw the control points in red.
|
|
196
|
+
* stroke(255, 0, 0);
|
|
197
|
+
* point(32, 91);
|
|
198
|
+
* point(84, 91);
|
|
199
|
+
*
|
|
200
|
+
* describe(
|
|
201
|
+
* 'A black curve drawn on a gray background. The curve passes through one red dot and two black dots. Another red dot appears near the bottom of the canvas.'
|
|
202
|
+
* );
|
|
203
|
+
* }
|
|
204
|
+
* </code>
|
|
205
|
+
* </div>
|
|
206
|
+
*
|
|
207
|
+
* <div>
|
|
208
|
+
* <code>
|
|
209
|
+
* function setup() {
|
|
210
|
+
* createCanvas(100, 100);
|
|
211
|
+
*
|
|
212
|
+
* background(200);
|
|
213
|
+
*
|
|
214
|
+
* // Style the shape.
|
|
215
|
+
* noFill();
|
|
216
|
+
* strokeWeight(1);
|
|
217
|
+
*
|
|
218
|
+
* // Start drawing the shape.
|
|
219
|
+
* beginShape();
|
|
220
|
+
*
|
|
221
|
+
* // Add the first control point and draw a segment to it.
|
|
222
|
+
* splineVertex(32, 91);
|
|
223
|
+
* splineVertex(32, 91);
|
|
224
|
+
*
|
|
225
|
+
* // Add the anchor points.
|
|
226
|
+
* splineVertex(21, 17);
|
|
227
|
+
* splineVertex(68, 19);
|
|
228
|
+
*
|
|
229
|
+
* // Add the second control point and draw a segment to it.
|
|
230
|
+
* splineVertex(84, 91);
|
|
231
|
+
* splineVertex(84, 91);
|
|
232
|
+
*
|
|
233
|
+
* // Stop drawing the shape.
|
|
234
|
+
* endShape();
|
|
235
|
+
*
|
|
236
|
+
* // Style the anchor and control points.
|
|
237
|
+
* strokeWeight(5);
|
|
238
|
+
*
|
|
239
|
+
* // Draw the anchor points in black.
|
|
240
|
+
* stroke(0);
|
|
241
|
+
* point(21, 17);
|
|
242
|
+
* point(68, 19);
|
|
243
|
+
*
|
|
244
|
+
* // Draw the control points in red.
|
|
245
|
+
* stroke(255, 0, 0);
|
|
246
|
+
* point(32, 91);
|
|
247
|
+
* point(84, 91);
|
|
248
|
+
*
|
|
249
|
+
* describe(
|
|
250
|
+
* 'A black U curve drawn upside down on a gray background. The curve passes from one red dot through two black dots and ends at another red dot.'
|
|
251
|
+
* );
|
|
252
|
+
* }
|
|
253
|
+
* </code>
|
|
254
|
+
* </div>
|
|
255
|
+
*
|
|
256
|
+
* <div>
|
|
257
|
+
* <code>
|
|
258
|
+
* // Click the mouse near the red dot in the bottom-left corner
|
|
259
|
+
* // and drag to change the curve's shape.
|
|
260
|
+
*
|
|
261
|
+
* let x1 = 32;
|
|
262
|
+
* let y1 = 91;
|
|
263
|
+
* let isChanging = false;
|
|
264
|
+
*
|
|
265
|
+
* function setup() {
|
|
266
|
+
* createCanvas(100, 100);
|
|
267
|
+
*
|
|
268
|
+
* describe(
|
|
269
|
+
* 'A black U curve drawn upside down on a gray background. The curve passes from one red dot through two black dots and ends at another red dot.'
|
|
270
|
+
* );
|
|
271
|
+
* }
|
|
272
|
+
*
|
|
273
|
+
* function draw() {
|
|
274
|
+
* background(200);
|
|
275
|
+
*
|
|
276
|
+
* // Style the shape.
|
|
277
|
+
* noFill();
|
|
278
|
+
* stroke(0);
|
|
279
|
+
* strokeWeight(1);
|
|
280
|
+
*
|
|
281
|
+
* // Start drawing the shape.
|
|
282
|
+
* beginShape();
|
|
283
|
+
*
|
|
284
|
+
* // Add the first control point and draw a segment to it.
|
|
285
|
+
* splineVertex(x1, y1);
|
|
286
|
+
* splineVertex(x1, y1);
|
|
287
|
+
*
|
|
288
|
+
* // Add the anchor points.
|
|
289
|
+
* splineVertex(21, 17);
|
|
290
|
+
* splineVertex(68, 19);
|
|
291
|
+
*
|
|
292
|
+
* // Add the second control point and draw a segment to it.
|
|
293
|
+
* splineVertex(84, 91);
|
|
294
|
+
* splineVertex(84, 91);
|
|
295
|
+
*
|
|
296
|
+
* // Stop drawing the shape.
|
|
297
|
+
* endShape();
|
|
298
|
+
*
|
|
299
|
+
* // Style the anchor and control points.
|
|
300
|
+
* strokeWeight(5);
|
|
301
|
+
*
|
|
302
|
+
* // Draw the anchor points in black.
|
|
303
|
+
* stroke(0);
|
|
304
|
+
* point(21, 17);
|
|
305
|
+
* point(68, 19);
|
|
306
|
+
*
|
|
307
|
+
* // Draw the control points in red.
|
|
308
|
+
* stroke(255, 0, 0);
|
|
309
|
+
* point(x1, y1);
|
|
310
|
+
* point(84, 91);
|
|
311
|
+
* }
|
|
312
|
+
*
|
|
313
|
+
* // Start changing the first control point if the user clicks near it.
|
|
314
|
+
* function mousePressed() {
|
|
315
|
+
* if (dist(mouseX, mouseY, x1, y1) < 20) {
|
|
316
|
+
* isChanging = true;
|
|
317
|
+
* }
|
|
318
|
+
* }
|
|
319
|
+
*
|
|
320
|
+
* // Stop changing the first control point when the user releases the mouse.
|
|
321
|
+
* function mouseReleased() {
|
|
322
|
+
* isChanging = false;
|
|
323
|
+
* }
|
|
324
|
+
*
|
|
325
|
+
* // Update the first control point while the user drags the mouse.
|
|
326
|
+
* function mouseDragged() {
|
|
327
|
+
* if (isChanging === true) {
|
|
328
|
+
* x1 = mouseX;
|
|
329
|
+
* y1 = mouseY;
|
|
330
|
+
* }
|
|
331
|
+
* }
|
|
332
|
+
* </code>
|
|
333
|
+
* </div>
|
|
334
|
+
*
|
|
335
|
+
* <div>
|
|
336
|
+
* <code>
|
|
337
|
+
* function setup() {
|
|
338
|
+
* createCanvas(100, 100);
|
|
339
|
+
*
|
|
340
|
+
* background(200);
|
|
341
|
+
*
|
|
342
|
+
* // Start drawing the shape.
|
|
343
|
+
* beginShape();
|
|
344
|
+
*
|
|
345
|
+
* // Add the first control point and draw a segment to it.
|
|
346
|
+
* splineVertex(32, 91);
|
|
347
|
+
* splineVertex(32, 91);
|
|
348
|
+
*
|
|
349
|
+
* // Add the anchor points.
|
|
350
|
+
* splineVertex(21, 17);
|
|
351
|
+
* splineVertex(68, 19);
|
|
352
|
+
*
|
|
353
|
+
* // Add the second control point.
|
|
354
|
+
* splineVertex(84, 91);
|
|
355
|
+
* splineVertex(84, 91);
|
|
356
|
+
*
|
|
357
|
+
* // Stop drawing the shape.
|
|
358
|
+
* endShape();
|
|
359
|
+
*
|
|
360
|
+
* describe('A ghost shape drawn in white on a gray background.');
|
|
361
|
+
* }
|
|
362
|
+
* </code>
|
|
363
|
+
* </div>
|
|
364
|
+
*/
|
|
365
|
+
function splineVertex(x: number, y: number): void;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @param z-coordinate of the vertex.
|
|
369
|
+
* @example <div>
|
|
370
|
+
* <code>
|
|
371
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
372
|
+
*
|
|
373
|
+
* function setup() {
|
|
374
|
+
* createCanvas(100, 100, WEBGL);
|
|
375
|
+
*
|
|
376
|
+
* describe('A ghost shape drawn in white on a blue background. When the user drags the mouse, the scene rotates to reveal the outline of a second ghost.');
|
|
377
|
+
* }
|
|
378
|
+
*
|
|
379
|
+
* function draw() {
|
|
380
|
+
* background('midnightblue');
|
|
381
|
+
*
|
|
382
|
+
* // Enable orbiting with the mouse.
|
|
383
|
+
* orbitControl();
|
|
384
|
+
*
|
|
385
|
+
* // Draw the first ghost.
|
|
386
|
+
* noStroke();
|
|
387
|
+
* fill('ghostwhite');
|
|
388
|
+
*
|
|
389
|
+
* beginShape();
|
|
390
|
+
* splineVertex(-28, 41, 0);
|
|
391
|
+
* splineVertex(-28, 41, 0);
|
|
392
|
+
* splineVertex(-29, -33, 0);
|
|
393
|
+
* splineVertex(18, -31, 0);
|
|
394
|
+
* splineVertex(34, 41, 0);
|
|
395
|
+
* splineVertex(34, 41, 0);
|
|
396
|
+
* endShape();
|
|
397
|
+
*
|
|
398
|
+
* // Draw the second ghost.
|
|
399
|
+
* noFill();
|
|
400
|
+
* stroke('ghostwhite');
|
|
401
|
+
*
|
|
402
|
+
* beginShape();
|
|
403
|
+
* splineVertex(-28, 41, -20);
|
|
404
|
+
* splineVertex(-28, 41, -20);
|
|
405
|
+
* splineVertex(-29, -33, -20);
|
|
406
|
+
* splineVertex(18, -31, -20);
|
|
407
|
+
* splineVertex(34, 41, -20);
|
|
408
|
+
* splineVertex(34, 41, -20);
|
|
409
|
+
* endShape();
|
|
410
|
+
* }
|
|
411
|
+
* </code>
|
|
412
|
+
* </div>
|
|
413
|
+
*/
|
|
414
|
+
function splineVertex(x: number, y: number, z?: number): void;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
*/
|
|
418
|
+
function splineVertex(x: number, y: number, u: number, v: number): void;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
*/
|
|
422
|
+
function splineVertex(x: number, y: number, z: number, u: number, v: number): void;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Sets the property of a curve.For example, set tightness,
|
|
426
|
+
* use `splineProperty('tightness', t)`, with `t` between 0 and 1,
|
|
427
|
+
* at 0 as default.Spline curves are like cables that are attached to a set of points.
|
|
428
|
+
* Adjusting tightness adjusts how tightly the cable is
|
|
429
|
+
* attached to the points. The parameter, tightness, determines
|
|
430
|
+
* how the curve fits to the vertex points. By default,
|
|
431
|
+
* tightness is set to 0. Setting tightness to 1, as in
|
|
432
|
+
* `splineProperty('tightness', 1)`, connects the curve's points
|
|
433
|
+
* using straight lines. Values in the range from –5 to 5
|
|
434
|
+
* deform curves while leaving them recognizable.This function can also be used to set 'ends' property
|
|
435
|
+
* (see also: the curveDetail() example),
|
|
436
|
+
* such as: `splineProperty('ends', EXCLUDE)` to exclude
|
|
437
|
+
* vertices, or `splineProperty('ends', INCLUDE)` to include them.
|
|
438
|
+
*
|
|
439
|
+
* @param Value to set the given property to.
|
|
440
|
+
* @example <div>
|
|
441
|
+
* <code>
|
|
442
|
+
* // Move the mouse left and right to see the curve change.
|
|
443
|
+
*
|
|
444
|
+
* function setup() {
|
|
445
|
+
* createCanvas(100, 100);
|
|
446
|
+
* describe('A black curve forms a sideways U shape. The curve deforms as the user moves the mouse from left to right');
|
|
447
|
+
* }
|
|
448
|
+
*
|
|
449
|
+
* function draw() {
|
|
450
|
+
* background(200);
|
|
451
|
+
*
|
|
452
|
+
* // Set the curve's tightness using the mouse.
|
|
453
|
+
* let t = map(mouseX, 0, 100, -5, 5, true);
|
|
454
|
+
* splineProperty('tightness', t);
|
|
455
|
+
*
|
|
456
|
+
* // Draw the curve.
|
|
457
|
+
* noFill();
|
|
458
|
+
* beginShape();
|
|
459
|
+
* splineVertex(10, 26);
|
|
460
|
+
* splineVertex(10, 26);
|
|
461
|
+
* splineVertex(83, 24);
|
|
462
|
+
* splineVertex(83, 61);
|
|
463
|
+
* splineVertex(25, 65);
|
|
464
|
+
* splineVertex(25, 65);
|
|
465
|
+
* endShape();
|
|
466
|
+
* }
|
|
467
|
+
* </code>
|
|
468
|
+
* </div>
|
|
469
|
+
*/
|
|
470
|
+
function splineProperty(property: string, value: any): void;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* @returns The current value for the given property.
|
|
474
|
+
*/
|
|
475
|
+
function splineProperty(property: string): void;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Get or set multiple spline properties at once.Similar to splineProperty():
|
|
479
|
+
* `splineProperty('tightness', t)` is the same as
|
|
480
|
+
* `splineProperties({'tightness': t})`
|
|
481
|
+
*
|
|
482
|
+
* @param An object containing key-value pairs to set.
|
|
483
|
+
*/
|
|
484
|
+
function splineProperties(properties: object): void;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* @returns The current spline properties.
|
|
488
|
+
*/
|
|
489
|
+
function splineProperties(): object;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Adds a vertex to a custom shape.`vertex()` sets the coordinates of vertices drawn between the
|
|
493
|
+
* beginShape() and
|
|
494
|
+
* endShape() functions.The first two parameters, `x` and `y`, set the x- and y-coordinates of the
|
|
495
|
+
* vertex.The third parameter, `z`, is optional. It sets the z-coordinate of the
|
|
496
|
+
* vertex in WebGL mode. By default, `z` is 0.The fourth and fifth parameters, `u` and `v`, are also optional. They set
|
|
497
|
+
* the u- and v-coordinates for the vertex’s texture when used with
|
|
498
|
+
* endShape(). By default, `u` and `v` are both 0.
|
|
499
|
+
*
|
|
500
|
+
* @param x-coordinate of the vertex.
|
|
501
|
+
* @param y-coordinate of the vertex.
|
|
502
|
+
* @example <div>
|
|
503
|
+
* <code>
|
|
504
|
+
* function setup() {
|
|
505
|
+
* createCanvas(100, 100);
|
|
506
|
+
*
|
|
507
|
+
* background(200);
|
|
508
|
+
*
|
|
509
|
+
* // Style the shape.
|
|
510
|
+
* strokeWeight(3);
|
|
511
|
+
*
|
|
512
|
+
* // Start drawing the shape.
|
|
513
|
+
* // Only draw the vertices.
|
|
514
|
+
* beginShape(POINTS);
|
|
515
|
+
*
|
|
516
|
+
* // Add the vertices.
|
|
517
|
+
* vertex(30, 20);
|
|
518
|
+
* vertex(85, 20);
|
|
519
|
+
* vertex(85, 75);
|
|
520
|
+
* vertex(30, 75);
|
|
521
|
+
*
|
|
522
|
+
* // Stop drawing the shape.
|
|
523
|
+
* endShape();
|
|
524
|
+
*
|
|
525
|
+
* describe('Four black dots that form a square are drawn on a gray background.');
|
|
526
|
+
* }
|
|
527
|
+
* </code>
|
|
528
|
+
* </div>
|
|
529
|
+
*
|
|
530
|
+
* <div>
|
|
531
|
+
* <code>
|
|
532
|
+
* function setup() {
|
|
533
|
+
* createCanvas(100, 100);
|
|
534
|
+
*
|
|
535
|
+
* background(200);
|
|
536
|
+
*
|
|
537
|
+
* // Start drawing the shape.
|
|
538
|
+
* beginShape();
|
|
539
|
+
*
|
|
540
|
+
* // Add vertices.
|
|
541
|
+
* vertex(30, 20);
|
|
542
|
+
* vertex(85, 20);
|
|
543
|
+
* vertex(85, 75);
|
|
544
|
+
* vertex(30, 75);
|
|
545
|
+
*
|
|
546
|
+
* // Stop drawing the shape.
|
|
547
|
+
* endShape(CLOSE);
|
|
548
|
+
*
|
|
549
|
+
* describe('A white square on a gray background.');
|
|
550
|
+
* }
|
|
551
|
+
* </code>
|
|
552
|
+
* </div>
|
|
553
|
+
*
|
|
554
|
+
* <div>
|
|
555
|
+
* <code>
|
|
556
|
+
* function setup() {
|
|
557
|
+
* createCanvas(100, 100, WEBGL);
|
|
558
|
+
*
|
|
559
|
+
* background(200);
|
|
560
|
+
*
|
|
561
|
+
* // Start drawing the shape.
|
|
562
|
+
* beginShape();
|
|
563
|
+
*
|
|
564
|
+
* // Add vertices.
|
|
565
|
+
* vertex(-20, -30, 0);
|
|
566
|
+
* vertex(35, -30, 0);
|
|
567
|
+
* vertex(35, 25, 0);
|
|
568
|
+
* vertex(-20, 25, 0);
|
|
569
|
+
*
|
|
570
|
+
* // Stop drawing the shape.
|
|
571
|
+
* endShape(CLOSE);
|
|
572
|
+
*
|
|
573
|
+
* describe('A white square on a gray background.');
|
|
574
|
+
* }
|
|
575
|
+
* </code>
|
|
576
|
+
* </div>
|
|
577
|
+
*
|
|
578
|
+
* <div>
|
|
579
|
+
* <code>
|
|
580
|
+
* function setup() {
|
|
581
|
+
* createCanvas(100, 100, WEBGL);
|
|
582
|
+
*
|
|
583
|
+
* describe('A white square spins around slowly on a gray background.');
|
|
584
|
+
* }
|
|
585
|
+
*
|
|
586
|
+
* function draw() {
|
|
587
|
+
* background(200);
|
|
588
|
+
*
|
|
589
|
+
* // Rotate around the y-axis.
|
|
590
|
+
* rotateY(frameCount * 0.01);
|
|
591
|
+
*
|
|
592
|
+
* // Start drawing the shape.
|
|
593
|
+
* beginShape();
|
|
594
|
+
*
|
|
595
|
+
* // Add vertices.
|
|
596
|
+
* vertex(-20, -30, 0);
|
|
597
|
+
* vertex(35, -30, 0);
|
|
598
|
+
* vertex(35, 25, 0);
|
|
599
|
+
* vertex(-20, 25, 0);
|
|
600
|
+
*
|
|
601
|
+
* // Stop drawing the shape.
|
|
602
|
+
* endShape(CLOSE);
|
|
603
|
+
* }
|
|
604
|
+
* </code>
|
|
605
|
+
* </div>
|
|
606
|
+
*
|
|
607
|
+
* <div>
|
|
608
|
+
* <code>
|
|
609
|
+
* let img;
|
|
610
|
+
*
|
|
611
|
+
* async function setup() {
|
|
612
|
+
* // Load an image to apply as a texture.
|
|
613
|
+
* img = await loadImage('assets/laDefense.jpg');
|
|
614
|
+
*
|
|
615
|
+
* createCanvas(100, 100, WEBGL);
|
|
616
|
+
*
|
|
617
|
+
* describe('A photograph of a ceiling rotates slowly against a gray background.');
|
|
618
|
+
* }
|
|
619
|
+
*
|
|
620
|
+
* function draw() {
|
|
621
|
+
* background(200);
|
|
622
|
+
*
|
|
623
|
+
* // Rotate around the y-axis.
|
|
624
|
+
* rotateY(frameCount * 0.01);
|
|
625
|
+
*
|
|
626
|
+
* // Style the shape.
|
|
627
|
+
* noStroke();
|
|
628
|
+
*
|
|
629
|
+
* // Apply the texture.
|
|
630
|
+
* texture(img);
|
|
631
|
+
* textureMode(NORMAL);
|
|
632
|
+
*
|
|
633
|
+
* // Start drawing the shape
|
|
634
|
+
* beginShape();
|
|
635
|
+
*
|
|
636
|
+
* // Add vertices.
|
|
637
|
+
* vertex(-20, -30, 0, 0, 0);
|
|
638
|
+
* vertex(35, -30, 0, 1, 0);
|
|
639
|
+
* vertex(35, 25, 0, 1, 1);
|
|
640
|
+
* vertex(-20, 25, 0, 0, 1);
|
|
641
|
+
*
|
|
642
|
+
* // Stop drawing the shape.
|
|
643
|
+
* endShape();
|
|
644
|
+
* }
|
|
645
|
+
* </code>
|
|
646
|
+
* </div>
|
|
647
|
+
*
|
|
648
|
+
* <div>
|
|
649
|
+
* <code>
|
|
650
|
+
* let vid;
|
|
651
|
+
* function setup() {
|
|
652
|
+
* // Load a video and create a p5.MediaElement object.
|
|
653
|
+
* vid = createVideo('/assets/fingers.mov');
|
|
654
|
+
* createCanvas(100, 100, WEBGL);
|
|
655
|
+
*
|
|
656
|
+
* // Hide the video.
|
|
657
|
+
* vid.hide();
|
|
658
|
+
*
|
|
659
|
+
* // Set the video to loop.
|
|
660
|
+
* vid.loop();
|
|
661
|
+
*
|
|
662
|
+
* describe('A rectangle with video as texture');
|
|
663
|
+
* }
|
|
664
|
+
*
|
|
665
|
+
* function draw() {
|
|
666
|
+
* background(0);
|
|
667
|
+
*
|
|
668
|
+
* // Rotate around the y-axis.
|
|
669
|
+
* rotateY(frameCount * 0.01);
|
|
670
|
+
*
|
|
671
|
+
* // Set the texture mode.
|
|
672
|
+
* textureMode(NORMAL);
|
|
673
|
+
*
|
|
674
|
+
* // Apply the video as a texture.
|
|
675
|
+
* texture(vid);
|
|
676
|
+
*
|
|
677
|
+
* // Draw a custom shape using uv coordinates.
|
|
678
|
+
* beginShape();
|
|
679
|
+
* vertex(-40, -40, 0, 0);
|
|
680
|
+
* vertex(40, -40, 1, 0);
|
|
681
|
+
* vertex(40, 40, 1, 1);
|
|
682
|
+
* vertex(-40, 40, 0, 1);
|
|
683
|
+
* endShape();
|
|
684
|
+
* }
|
|
685
|
+
* </code>
|
|
686
|
+
* </div>
|
|
687
|
+
*/
|
|
688
|
+
function vertex(x: number, y: number): void;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* @param u-coordinate of the vertex's texture.
|
|
692
|
+
* @param v-coordinate of the vertex's texture.
|
|
693
|
+
*/
|
|
694
|
+
function vertex(x: number, y: number, u: number, v: number): void;
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* @param u-coordinate of the vertex's texture.
|
|
698
|
+
* @param v-coordinate of the vertex's texture.
|
|
699
|
+
*/
|
|
700
|
+
function vertex(x: number, y: number, z: number, u: number, v: number): void;
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Begins creating a hole within a flat shape.The `beginContour()` and endContour()
|
|
704
|
+
* functions allow for creating negative space within custom shapes that are
|
|
705
|
+
* flat. `beginContour()` begins adding vertices to a negative space and
|
|
706
|
+
* endContour() stops adding them.
|
|
707
|
+
* `beginContour()` and endContour() must be
|
|
708
|
+
* called between beginShape() and
|
|
709
|
+
* endShape().Transformations such as translate(),
|
|
710
|
+
* rotate(), and scale()
|
|
711
|
+
* don't work between `beginContour()` and
|
|
712
|
+
* endContour(). It's also not possible to use
|
|
713
|
+
* other shapes, such as ellipse() or
|
|
714
|
+
* rect(), between `beginContour()` and
|
|
715
|
+
* endContour().Note: The vertices that define a negative space must "wind" in the opposite
|
|
716
|
+
* direction from the outer shape. First, draw vertices for the outer shape
|
|
717
|
+
* clockwise order. Then, draw vertices for the negative space in
|
|
718
|
+
* counter-clockwise order.
|
|
719
|
+
*
|
|
720
|
+
* @example <div>
|
|
721
|
+
* <code>
|
|
722
|
+
* function setup() {
|
|
723
|
+
* createCanvas(100, 100);
|
|
724
|
+
*
|
|
725
|
+
* background(200);
|
|
726
|
+
*
|
|
727
|
+
* // Start drawing the shape.
|
|
728
|
+
* beginShape();
|
|
729
|
+
*
|
|
730
|
+
* // Exterior vertices, clockwise winding.
|
|
731
|
+
* vertex(10, 10);
|
|
732
|
+
* vertex(90, 10);
|
|
733
|
+
* vertex(90, 90);
|
|
734
|
+
* vertex(10, 90);
|
|
735
|
+
*
|
|
736
|
+
* // Interior vertices, counter-clockwise winding.
|
|
737
|
+
* beginContour();
|
|
738
|
+
* vertex(30, 30);
|
|
739
|
+
* vertex(30, 70);
|
|
740
|
+
* vertex(70, 70);
|
|
741
|
+
* vertex(70, 30);
|
|
742
|
+
* endContour(CLOSE);
|
|
743
|
+
*
|
|
744
|
+
* // Stop drawing the shape.
|
|
745
|
+
* endShape(CLOSE);
|
|
746
|
+
*
|
|
747
|
+
* describe('A white square with a square hole in its center drawn on a gray background.');
|
|
748
|
+
* }
|
|
749
|
+
* </code>
|
|
750
|
+
* </div>
|
|
751
|
+
*
|
|
752
|
+
* <div>
|
|
753
|
+
* <code>
|
|
754
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
755
|
+
*
|
|
756
|
+
* function setup() {
|
|
757
|
+
* createCanvas(100, 100, WEBGL);
|
|
758
|
+
*
|
|
759
|
+
* describe('A white square with a square hole in its center drawn on a gray background.');
|
|
760
|
+
* }
|
|
761
|
+
*
|
|
762
|
+
* function draw() {
|
|
763
|
+
* background(200);
|
|
764
|
+
*
|
|
765
|
+
* // Enable orbiting with the mouse.
|
|
766
|
+
* orbitControl();
|
|
767
|
+
*
|
|
768
|
+
* // Start drawing the shape.
|
|
769
|
+
* beginShape();
|
|
770
|
+
*
|
|
771
|
+
* // Exterior vertices, clockwise winding.
|
|
772
|
+
* vertex(-40, -40);
|
|
773
|
+
* vertex(40, -40);
|
|
774
|
+
* vertex(40, 40);
|
|
775
|
+
* vertex(-40, 40);
|
|
776
|
+
*
|
|
777
|
+
* // Interior vertices, counter-clockwise winding.
|
|
778
|
+
* beginContour();
|
|
779
|
+
* vertex(-20, -20);
|
|
780
|
+
* vertex(-20, 20);
|
|
781
|
+
* vertex(20, 20);
|
|
782
|
+
* vertex(20, -20);
|
|
783
|
+
* endContour(CLOSE);
|
|
784
|
+
*
|
|
785
|
+
* // Stop drawing the shape.
|
|
786
|
+
* endShape(CLOSE);
|
|
787
|
+
* }
|
|
788
|
+
* </code>
|
|
789
|
+
* </div>
|
|
790
|
+
*/
|
|
791
|
+
function beginContour(): void;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Stops creating a hole within a flat shape.The beginContour() and `endContour()`
|
|
795
|
+
* functions allow for creating negative space within custom shapes that are
|
|
796
|
+
* flat. beginContour() begins adding vertices
|
|
797
|
+
* to a negative space and `endContour()` stops adding them.
|
|
798
|
+
* beginContour() and `endContour()` must be
|
|
799
|
+
* called between beginShape() and
|
|
800
|
+
* endShape().By default,
|
|
801
|
+
* the controur has an `OPEN` end, and to close it,
|
|
802
|
+
* call `endContour(CLOSE)`. The CLOSE contour mode closes splines smoothly.Transformations such as translate(),
|
|
803
|
+
* rotate(), and scale()
|
|
804
|
+
* don't work between beginContour() and
|
|
805
|
+
* `endContour()`. It's also not possible to use other shapes, such as
|
|
806
|
+
* ellipse() or rect(),
|
|
807
|
+
* between beginContour() and `endContour()`.Note: The vertices that define a negative space must "wind" in the opposite
|
|
808
|
+
* direction from the outer shape. First, draw vertices for the outer shape
|
|
809
|
+
* clockwise order. Then, draw vertices for the negative space in
|
|
810
|
+
* counter-clockwise order.
|
|
811
|
+
*
|
|
812
|
+
* @param By default, the value is OPEN
|
|
813
|
+
* @example <div>
|
|
814
|
+
* <code>
|
|
815
|
+
* function setup() {
|
|
816
|
+
* createCanvas(100, 100);
|
|
817
|
+
*
|
|
818
|
+
* background(200);
|
|
819
|
+
*
|
|
820
|
+
* // Start drawing the shape.
|
|
821
|
+
* beginShape();
|
|
822
|
+
*
|
|
823
|
+
* // Exterior vertices, clockwise winding.
|
|
824
|
+
* vertex(10, 10);
|
|
825
|
+
* vertex(90, 10);
|
|
826
|
+
* vertex(90, 90);
|
|
827
|
+
* vertex(10, 90);
|
|
828
|
+
*
|
|
829
|
+
* // Interior vertices, counter-clockwise winding.
|
|
830
|
+
* beginContour();
|
|
831
|
+
* vertex(30, 30);
|
|
832
|
+
* vertex(30, 70);
|
|
833
|
+
* vertex(70, 70);
|
|
834
|
+
* vertex(70, 30);
|
|
835
|
+
* endContour(CLOSE);
|
|
836
|
+
*
|
|
837
|
+
* // Stop drawing the shape.
|
|
838
|
+
* endShape(CLOSE);
|
|
839
|
+
*
|
|
840
|
+
* describe('A white square with a square hole in its center drawn on a gray background.');
|
|
841
|
+
* }
|
|
842
|
+
* </code>
|
|
843
|
+
* </div>
|
|
844
|
+
*
|
|
845
|
+
* <div>
|
|
846
|
+
* <code>
|
|
847
|
+
* // Click and drag the mouse to view the scene from different angles.
|
|
848
|
+
*
|
|
849
|
+
* function setup() {
|
|
850
|
+
* createCanvas(100, 100, WEBGL);
|
|
851
|
+
*
|
|
852
|
+
* describe('A white square with a square hole in its center drawn on a gray background.');
|
|
853
|
+
* }
|
|
854
|
+
*
|
|
855
|
+
* function draw() {
|
|
856
|
+
* background(200);
|
|
857
|
+
*
|
|
858
|
+
* // Enable orbiting with the mouse.
|
|
859
|
+
* orbitControl();
|
|
860
|
+
*
|
|
861
|
+
* // Start drawing the shape.
|
|
862
|
+
* beginShape();
|
|
863
|
+
*
|
|
864
|
+
* // Exterior vertices, clockwise winding.
|
|
865
|
+
* vertex(-40, -40);
|
|
866
|
+
* vertex(40, -40);
|
|
867
|
+
* vertex(40, 40);
|
|
868
|
+
* vertex(-40, 40);
|
|
869
|
+
*
|
|
870
|
+
* // Interior vertices, counter-clockwise winding.
|
|
871
|
+
* beginContour();
|
|
872
|
+
* vertex(-20, -20);
|
|
873
|
+
* vertex(-20, 20);
|
|
874
|
+
* vertex(20, 20);
|
|
875
|
+
* vertex(20, -20);
|
|
876
|
+
* endContour(CLOSE);
|
|
877
|
+
*
|
|
878
|
+
* // Stop drawing the shape.
|
|
879
|
+
* endShape(CLOSE);
|
|
880
|
+
* }
|
|
881
|
+
* </code>
|
|
882
|
+
* </div>
|
|
883
|
+
*/
|
|
884
|
+
function endContour(mode: OPEN | CLOSE): void;
|
|
885
|
+
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
export default function custom_shapes(p5: any, fn: any): void;
|