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.
- 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-tYr0tCl8.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 +41 -75
- 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 +1 -2
- 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-CAxvgiOV.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-Swjl9HQO.js} +5 -5
- package/dist/{rendering--aAe5aq3.js → rendering-B5TRR7aY.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 +4 -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 +273 -225
- package/lib/p5.js +273 -225
- 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 +5996 -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 +499 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5542 -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 +6663 -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 +481 -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,466 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* Changes where ellipses, circles, and arcs are drawn.By default, the first two parameters of
|
|
8
|
+
* ellipse(), circle(),
|
|
9
|
+
* and arc()
|
|
10
|
+
* are the x- and y-coordinates of the shape's center. The next parameters set
|
|
11
|
+
* the shape's width and height. This is the same as calling
|
|
12
|
+
* `ellipseMode(CENTER)`.`ellipseMode(RADIUS)` also uses the first two parameters to set the x- and
|
|
13
|
+
* y-coordinates of the shape's center. The next parameters are half of the
|
|
14
|
+
* shapes's width and height. Calling `ellipse(0, 0, 10, 15)` draws a shape
|
|
15
|
+
* with a width of 20 and height of 30.`ellipseMode(CORNER)` uses the first two parameters as the upper-left
|
|
16
|
+
* corner of the shape. The next parameters are its width and height.`ellipseMode(CORNERS)` uses the first two parameters as the location of one
|
|
17
|
+
* corner of the ellipse's bounding box. The next parameters are the location
|
|
18
|
+
* of the opposite corner.The argument passed to `ellipseMode()` must be written in ALL CAPS because
|
|
19
|
+
* the constants `CENTER`, `RADIUS`, `CORNER`, and `CORNERS` are defined this
|
|
20
|
+
* way. JavaScript is a case-sensitive language.
|
|
21
|
+
*
|
|
22
|
+
* @param either CENTER, RADIUS, CORNER, or CORNERS
|
|
23
|
+
* @example <div>
|
|
24
|
+
* <code>
|
|
25
|
+
* function setup() {
|
|
26
|
+
* createCanvas(100, 100);
|
|
27
|
+
*
|
|
28
|
+
* background(200);
|
|
29
|
+
*
|
|
30
|
+
* // White ellipse.
|
|
31
|
+
* ellipseMode(RADIUS);
|
|
32
|
+
* fill(255);
|
|
33
|
+
* ellipse(50, 50, 30, 30);
|
|
34
|
+
*
|
|
35
|
+
* // Gray ellipse.
|
|
36
|
+
* ellipseMode(CENTER);
|
|
37
|
+
* fill(100);
|
|
38
|
+
* ellipse(50, 50, 30, 30);
|
|
39
|
+
*
|
|
40
|
+
* describe('A white circle with a gray circle at its center. Both circles have black outlines.');
|
|
41
|
+
* }
|
|
42
|
+
* </code>
|
|
43
|
+
* </div>
|
|
44
|
+
*
|
|
45
|
+
* <div>
|
|
46
|
+
* <code>
|
|
47
|
+
* function setup() {
|
|
48
|
+
* createCanvas(100, 100);
|
|
49
|
+
*
|
|
50
|
+
* background(200);
|
|
51
|
+
*
|
|
52
|
+
* // White ellipse.
|
|
53
|
+
* ellipseMode(CORNER);
|
|
54
|
+
* fill(255);
|
|
55
|
+
* ellipse(25, 25, 50, 50);
|
|
56
|
+
*
|
|
57
|
+
* // Gray ellipse.
|
|
58
|
+
* ellipseMode(CORNERS);
|
|
59
|
+
* fill(100);
|
|
60
|
+
* ellipse(25, 25, 50, 50);
|
|
61
|
+
*
|
|
62
|
+
* describe('A white circle with a gray circle at its top-left corner. Both circles have black outlines.');
|
|
63
|
+
* }
|
|
64
|
+
* </code>
|
|
65
|
+
* </div>
|
|
66
|
+
*/
|
|
67
|
+
function ellipseMode(mode: CENTER | RADIUS | CORNER | CORNERS): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Draws certain features with jagged (aliased) edges.smooth() is active by default. In 2D mode,
|
|
71
|
+
* `noSmooth()` is helpful for scaling up images without blurring. The
|
|
72
|
+
* functions don't affect shapes or fonts.In WebGL mode, `noSmooth()` causes all shapes to be drawn with jagged
|
|
73
|
+
* (aliased) edges. The functions don't affect images or fonts.
|
|
74
|
+
*
|
|
75
|
+
* @example <div>
|
|
76
|
+
* <code>
|
|
77
|
+
* let heart;
|
|
78
|
+
*
|
|
79
|
+
* async function setup() {
|
|
80
|
+
* // Load a pixelated heart image from an image data string.
|
|
81
|
+
* heart = await loadImage('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAAXNSR0IArs4c6QAAAEZJREFUGFd9jcsNACAIQ9tB2MeR3YdBMBBq8CIXPi2vBICIiOwkOedatllqWO6Y8yOWoyuNf1GZwgmf+RRG2YXr+xVFmA8HZ9Mx/KGPMtcAAAAASUVORK5CYII=');
|
|
82
|
+
* createCanvas(100, 100);
|
|
83
|
+
*
|
|
84
|
+
* background(50);
|
|
85
|
+
*
|
|
86
|
+
* // Antialiased hearts.
|
|
87
|
+
* image(heart, 10, 10);
|
|
88
|
+
* image(heart, 20, 10, 16, 16);
|
|
89
|
+
* image(heart, 40, 10, 32, 32);
|
|
90
|
+
*
|
|
91
|
+
* // Aliased hearts.
|
|
92
|
+
* noSmooth();
|
|
93
|
+
* image(heart, 10, 60);
|
|
94
|
+
* image(heart, 20, 60, 16, 16);
|
|
95
|
+
* image(heart, 40, 60, 32, 32);
|
|
96
|
+
* }
|
|
97
|
+
* </code>
|
|
98
|
+
* </div>
|
|
99
|
+
*
|
|
100
|
+
* <div>
|
|
101
|
+
* <code>
|
|
102
|
+
* function setup() {
|
|
103
|
+
* createCanvas(100, 100, WEBGL);
|
|
104
|
+
*
|
|
105
|
+
* background(200);
|
|
106
|
+
*
|
|
107
|
+
* circle(0, 0, 80);
|
|
108
|
+
*
|
|
109
|
+
* describe('A white circle on a gray background.');
|
|
110
|
+
* }
|
|
111
|
+
* </code>
|
|
112
|
+
* </div>
|
|
113
|
+
*
|
|
114
|
+
* <div>
|
|
115
|
+
* <code>
|
|
116
|
+
* function setup() {
|
|
117
|
+
* createCanvas(100, 100, WEBGL);
|
|
118
|
+
*
|
|
119
|
+
* // Disable smoothing.
|
|
120
|
+
* noSmooth();
|
|
121
|
+
*
|
|
122
|
+
* background(200);
|
|
123
|
+
*
|
|
124
|
+
* circle(0, 0, 80);
|
|
125
|
+
*
|
|
126
|
+
* describe('A pixelated white circle on a gray background.');
|
|
127
|
+
* }
|
|
128
|
+
* </code>
|
|
129
|
+
* </div>
|
|
130
|
+
*/
|
|
131
|
+
function noSmooth(): void;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Changes where rectangles and squares are drawn.By default, the first two parameters of
|
|
135
|
+
* rect() and square(),
|
|
136
|
+
* are the x- and y-coordinates of the shape's upper left corner. The next parameters set
|
|
137
|
+
* the shape's width and height. This is the same as calling
|
|
138
|
+
* `rectMode(CORNER)`.`rectMode(CORNERS)` also uses the first two parameters as the location of
|
|
139
|
+
* one of the corners. The next parameters are the location of the opposite
|
|
140
|
+
* corner. This mode only works for rect().`rectMode(CENTER)` uses the first two parameters as the x- and
|
|
141
|
+
* y-coordinates of the shape's center. The next parameters are its width and
|
|
142
|
+
* height.`rectMode(RADIUS)` also uses the first two parameters as the x- and
|
|
143
|
+
* y-coordinates of the shape's center. The next parameters are
|
|
144
|
+
* half of the shape's width and height.The argument passed to `rectMode()` must be written in ALL CAPS because the
|
|
145
|
+
* constants `CENTER`, `RADIUS`, `CORNER`, and `CORNERS` are defined this way.
|
|
146
|
+
* JavaScript is a case-sensitive language.
|
|
147
|
+
*
|
|
148
|
+
* @param either CORNER, CORNERS, CENTER, or RADIUS
|
|
149
|
+
* @example <div>
|
|
150
|
+
* <code>
|
|
151
|
+
* function setup() {
|
|
152
|
+
* createCanvas(100, 100);
|
|
153
|
+
*
|
|
154
|
+
* background(200);
|
|
155
|
+
*
|
|
156
|
+
* rectMode(CORNER);
|
|
157
|
+
* fill(255);
|
|
158
|
+
* rect(25, 25, 50, 50);
|
|
159
|
+
*
|
|
160
|
+
* rectMode(CORNERS);
|
|
161
|
+
* fill(100);
|
|
162
|
+
* rect(25, 25, 50, 50);
|
|
163
|
+
*
|
|
164
|
+
* describe('A small gray square drawn at the top-left corner of a white square.');
|
|
165
|
+
* }
|
|
166
|
+
* </code>
|
|
167
|
+
* </div>
|
|
168
|
+
*
|
|
169
|
+
* <div>
|
|
170
|
+
* <code>
|
|
171
|
+
* function setup() {
|
|
172
|
+
* createCanvas(100, 100);
|
|
173
|
+
*
|
|
174
|
+
* background(200);
|
|
175
|
+
*
|
|
176
|
+
* rectMode(RADIUS);
|
|
177
|
+
* fill(255);
|
|
178
|
+
* rect(50, 50, 30, 30);
|
|
179
|
+
*
|
|
180
|
+
* rectMode(CENTER);
|
|
181
|
+
* fill(100);
|
|
182
|
+
* rect(50, 50, 30, 30);
|
|
183
|
+
*
|
|
184
|
+
* describe('A small gray square drawn at the center of a white square.');
|
|
185
|
+
* }
|
|
186
|
+
* </code>
|
|
187
|
+
* </div>
|
|
188
|
+
*
|
|
189
|
+
* <div>
|
|
190
|
+
* <code>
|
|
191
|
+
* function setup() {
|
|
192
|
+
* createCanvas(100, 100);
|
|
193
|
+
*
|
|
194
|
+
* background(200);
|
|
195
|
+
*
|
|
196
|
+
* rectMode(CORNER);
|
|
197
|
+
* fill(255);
|
|
198
|
+
* square(25, 25, 50);
|
|
199
|
+
*
|
|
200
|
+
* describe('A white square.');
|
|
201
|
+
* }
|
|
202
|
+
* </code>
|
|
203
|
+
* </div>
|
|
204
|
+
*
|
|
205
|
+
* <div>
|
|
206
|
+
* <code>
|
|
207
|
+
* function setup() {
|
|
208
|
+
* createCanvas(100, 100);
|
|
209
|
+
*
|
|
210
|
+
* background(200);
|
|
211
|
+
*
|
|
212
|
+
* rectMode(RADIUS);
|
|
213
|
+
* fill(255);
|
|
214
|
+
* square(50, 50, 30);
|
|
215
|
+
*
|
|
216
|
+
* rectMode(CENTER);
|
|
217
|
+
* fill(100);
|
|
218
|
+
* square(50, 50, 30);
|
|
219
|
+
*
|
|
220
|
+
* describe('A small gray square drawn at the center of a white square.');
|
|
221
|
+
* }
|
|
222
|
+
* </code>
|
|
223
|
+
* </div>
|
|
224
|
+
*/
|
|
225
|
+
function rectMode(mode: CENTER | RADIUS | CORNER | CORNERS): void;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Draws certain features with smooth (antialiased) edges.`smooth()` is active by default. In 2D mode,
|
|
229
|
+
* noSmooth() is helpful for scaling up images
|
|
230
|
+
* without blurring. The functions don't affect shapes or fonts.In WebGL mode, noSmooth() causes all shapes to
|
|
231
|
+
* be drawn with jagged (aliased) edges. The functions don't affect images or
|
|
232
|
+
* fonts.
|
|
233
|
+
*
|
|
234
|
+
* @example <div>
|
|
235
|
+
* <code>
|
|
236
|
+
* let heart;
|
|
237
|
+
*
|
|
238
|
+
* async function setup() {
|
|
239
|
+
* // Load a pixelated heart image from an image data string.
|
|
240
|
+
* heart = await loadImage('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAAXNSR0IArs4c6QAAAEZJREFUGFd9jcsNACAIQ9tB2MeR3YdBMBBq8CIXPi2vBICIiOwkOedatllqWO6Y8yOWoyuNf1GZwgmf+RRG2YXr+xVFmA8HZ9Mx/KGPMtcAAAAASUVORK5CYII=');
|
|
241
|
+
*
|
|
242
|
+
* createCanvas(100, 100);
|
|
243
|
+
*
|
|
244
|
+
* background(50);
|
|
245
|
+
*
|
|
246
|
+
* // Antialiased hearts.
|
|
247
|
+
* image(heart, 10, 10);
|
|
248
|
+
* image(heart, 20, 10, 16, 16);
|
|
249
|
+
* image(heart, 40, 10, 32, 32);
|
|
250
|
+
*
|
|
251
|
+
* // Aliased hearts.
|
|
252
|
+
* noSmooth();
|
|
253
|
+
* image(heart, 10, 60);
|
|
254
|
+
* image(heart, 20, 60, 16, 16);
|
|
255
|
+
* image(heart, 40, 60, 32, 32);
|
|
256
|
+
* }
|
|
257
|
+
* </code>
|
|
258
|
+
* </div>
|
|
259
|
+
*
|
|
260
|
+
* <div>
|
|
261
|
+
* <code>
|
|
262
|
+
* function setup() {
|
|
263
|
+
* createCanvas(100, 100, WEBGL);
|
|
264
|
+
*
|
|
265
|
+
* background(200);
|
|
266
|
+
*
|
|
267
|
+
* circle(0, 0, 80);
|
|
268
|
+
*
|
|
269
|
+
* describe('A white circle on a gray background.');
|
|
270
|
+
* }
|
|
271
|
+
* </code>
|
|
272
|
+
* </div>
|
|
273
|
+
*
|
|
274
|
+
* <div>
|
|
275
|
+
* <code>
|
|
276
|
+
* function setup() {
|
|
277
|
+
* createCanvas(100, 100, WEBGL);
|
|
278
|
+
*
|
|
279
|
+
* // Disable smoothing.
|
|
280
|
+
* noSmooth();
|
|
281
|
+
*
|
|
282
|
+
* background(200);
|
|
283
|
+
*
|
|
284
|
+
* circle(0, 0, 80);
|
|
285
|
+
*
|
|
286
|
+
* describe('A pixelated white circle on a gray background.');
|
|
287
|
+
* }
|
|
288
|
+
* </code>
|
|
289
|
+
* </div>
|
|
290
|
+
*/
|
|
291
|
+
function smooth(): void;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Sets the style for rendering the ends of lines.The caps for line endings are either rounded (`ROUND`), squared
|
|
295
|
+
* (`SQUARE`), or extended (`PROJECT`). The default cap is `ROUND`.The argument passed to `strokeCap()` must be written in ALL CAPS because
|
|
296
|
+
* the constants `ROUND`, `SQUARE`, and `PROJECT` are defined this way.
|
|
297
|
+
* JavaScript is a case-sensitive language.
|
|
298
|
+
*
|
|
299
|
+
* @param either ROUND, SQUARE, or PROJECT
|
|
300
|
+
* @example <div>
|
|
301
|
+
* <code>
|
|
302
|
+
* function setup() {
|
|
303
|
+
* createCanvas(100, 100);
|
|
304
|
+
*
|
|
305
|
+
* background(200);
|
|
306
|
+
*
|
|
307
|
+
* strokeWeight(12);
|
|
308
|
+
*
|
|
309
|
+
* // Top.
|
|
310
|
+
* strokeCap(ROUND);
|
|
311
|
+
* line(20, 30, 80, 30);
|
|
312
|
+
*
|
|
313
|
+
* // Middle.
|
|
314
|
+
* strokeCap(SQUARE);
|
|
315
|
+
* line(20, 50, 80, 50);
|
|
316
|
+
*
|
|
317
|
+
* // Bottom.
|
|
318
|
+
* strokeCap(PROJECT);
|
|
319
|
+
* line(20, 70, 80, 70);
|
|
320
|
+
*
|
|
321
|
+
* describe(
|
|
322
|
+
* 'Three horizontal lines. The top line has rounded ends, the middle line has squared ends, and the bottom line has longer, squared ends.'
|
|
323
|
+
* );
|
|
324
|
+
* }
|
|
325
|
+
* </code>
|
|
326
|
+
* </div>
|
|
327
|
+
*/
|
|
328
|
+
function strokeCap(cap: ROUND | SQUARE | PROJECT): void;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Sets the style of the joints that connect line segments.Joints are either mitered (`MITER`), beveled (`BEVEL`), or rounded
|
|
332
|
+
* (`ROUND`). The default joint is `MITER` in 2D mode and `ROUND` in WebGL
|
|
333
|
+
* mode.The argument passed to `strokeJoin()` must be written in ALL CAPS because
|
|
334
|
+
* the constants `MITER`, `BEVEL`, and `ROUND` are defined this way.
|
|
335
|
+
* JavaScript is a case-sensitive language.
|
|
336
|
+
*
|
|
337
|
+
* @param either MITER, BEVEL, or ROUND
|
|
338
|
+
* @example <div>
|
|
339
|
+
* <code>
|
|
340
|
+
* function setup() {
|
|
341
|
+
* createCanvas(100, 100);
|
|
342
|
+
*
|
|
343
|
+
* background(200);
|
|
344
|
+
*
|
|
345
|
+
* // Style the line.
|
|
346
|
+
* noFill();
|
|
347
|
+
* strokeWeight(10);
|
|
348
|
+
* strokeJoin(MITER);
|
|
349
|
+
*
|
|
350
|
+
* // Draw the line.
|
|
351
|
+
* beginShape();
|
|
352
|
+
* vertex(35, 20);
|
|
353
|
+
* vertex(65, 50);
|
|
354
|
+
* vertex(35, 80);
|
|
355
|
+
* endShape();
|
|
356
|
+
*
|
|
357
|
+
* describe('A right-facing arrowhead shape with a pointed tip in center of canvas.');
|
|
358
|
+
* }
|
|
359
|
+
* </code>
|
|
360
|
+
* </div>
|
|
361
|
+
*
|
|
362
|
+
* <div>
|
|
363
|
+
* <code>
|
|
364
|
+
* function setup() {
|
|
365
|
+
* createCanvas(100, 100);
|
|
366
|
+
*
|
|
367
|
+
* background(200);
|
|
368
|
+
*
|
|
369
|
+
* // Style the line.
|
|
370
|
+
* noFill();
|
|
371
|
+
* strokeWeight(10);
|
|
372
|
+
* strokeJoin(BEVEL);
|
|
373
|
+
*
|
|
374
|
+
* // Draw the line.
|
|
375
|
+
* beginShape();
|
|
376
|
+
* vertex(35, 20);
|
|
377
|
+
* vertex(65, 50);
|
|
378
|
+
* vertex(35, 80);
|
|
379
|
+
* endShape();
|
|
380
|
+
*
|
|
381
|
+
* describe('A right-facing arrowhead shape with a flat tip in center of canvas.');
|
|
382
|
+
* }
|
|
383
|
+
* </code>
|
|
384
|
+
* </div>
|
|
385
|
+
*
|
|
386
|
+
* <div>
|
|
387
|
+
* <code>
|
|
388
|
+
* function setup() {
|
|
389
|
+
* createCanvas(100, 100);
|
|
390
|
+
*
|
|
391
|
+
* background(200);
|
|
392
|
+
*
|
|
393
|
+
* // Style the line.
|
|
394
|
+
* noFill();
|
|
395
|
+
* strokeWeight(10);
|
|
396
|
+
* strokeJoin(ROUND);
|
|
397
|
+
*
|
|
398
|
+
* // Draw the line.
|
|
399
|
+
* beginShape();
|
|
400
|
+
* vertex(35, 20);
|
|
401
|
+
* vertex(65, 50);
|
|
402
|
+
* vertex(35, 80);
|
|
403
|
+
* endShape();
|
|
404
|
+
*
|
|
405
|
+
* describe('A right-facing arrowhead shape with a rounded tip in center of canvas.');
|
|
406
|
+
* }
|
|
407
|
+
* </code>
|
|
408
|
+
* </div>
|
|
409
|
+
*/
|
|
410
|
+
function strokeJoin(join: MITER | BEVEL | ROUND): void;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Sets the width of the stroke used for points, lines, and the outlines of
|
|
414
|
+
* shapes.Note: `strokeWeight()` is affected by transformations, especially calls to
|
|
415
|
+
* scale().
|
|
416
|
+
*
|
|
417
|
+
* @param the weight of the stroke (in pixels).
|
|
418
|
+
* @example <div>
|
|
419
|
+
* <code>
|
|
420
|
+
* function setup() {
|
|
421
|
+
* createCanvas(100, 100);
|
|
422
|
+
*
|
|
423
|
+
* background(200);
|
|
424
|
+
*
|
|
425
|
+
* // Top.
|
|
426
|
+
* line(20, 20, 80, 20);
|
|
427
|
+
*
|
|
428
|
+
* // Middle.
|
|
429
|
+
* strokeWeight(4);
|
|
430
|
+
* line(20, 40, 80, 40);
|
|
431
|
+
*
|
|
432
|
+
* // Bottom.
|
|
433
|
+
* strokeWeight(10);
|
|
434
|
+
* line(20, 70, 80, 70);
|
|
435
|
+
*
|
|
436
|
+
* describe('Three horizontal black lines. The top line is thin, the middle is medium, and the bottom is thick.');
|
|
437
|
+
* }
|
|
438
|
+
* </code>
|
|
439
|
+
* </div>
|
|
440
|
+
*
|
|
441
|
+
* <div>
|
|
442
|
+
* <code>
|
|
443
|
+
* function setup() {
|
|
444
|
+
* createCanvas(100, 100);
|
|
445
|
+
*
|
|
446
|
+
* background(200);
|
|
447
|
+
*
|
|
448
|
+
* // Top.
|
|
449
|
+
* line(20, 20, 80, 20);
|
|
450
|
+
*
|
|
451
|
+
* // Scale by a factor of 5.
|
|
452
|
+
* scale(5);
|
|
453
|
+
*
|
|
454
|
+
* // Bottom. Coordinates are adjusted for scaling.
|
|
455
|
+
* line(4, 8, 16, 8);
|
|
456
|
+
*
|
|
457
|
+
* describe('Two horizontal black lines. The top line is thin and the bottom is five times thicker than the top.');
|
|
458
|
+
* }
|
|
459
|
+
* </code>
|
|
460
|
+
* </div>
|
|
461
|
+
*/
|
|
462
|
+
function strokeWeight(weight: number): void;
|
|
463
|
+
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export default function attributes(p5: any, fn: any): void;
|