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
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"node ./utils/sample-linter.mjs"
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
|
-
"version": "2.0.
|
|
26
|
+
"version": "2.0.3",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@davepagurek/bezier-path": "^0.0.2",
|
|
29
29
|
"@japont/unicode-range": "^1.0.0",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"@vitest/browser": "^2.1.5",
|
|
52
52
|
"all-contributors-cli": "^6.19.0",
|
|
53
53
|
"concurrently": "^8.2.2",
|
|
54
|
-
"dayjs": "^1.11.10",
|
|
55
54
|
"documentation": "^14.0.3",
|
|
56
55
|
"eslint": "^8.54.0",
|
|
57
56
|
"glob": "^11.0.1",
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a screen reader-accessible description of the canvas.The first parameter, `text`, is the description of the canvas.The second parameter, `display`, is optional. It determines how the
|
|
8
|
+
* description is displayed. If `LABEL` is passed, as in
|
|
9
|
+
* `describe('A description.', LABEL)`, the description will be visible in
|
|
10
|
+
* a div element next to the canvas. If `FALLBACK` is passed, as in
|
|
11
|
+
* `describe('A description.', FALLBACK)`, the description will only be
|
|
12
|
+
* visible to screen readers. This is the default mode.Read
|
|
13
|
+
* Writing accessible canvas descriptions
|
|
14
|
+
* to learn more about making sketches accessible.
|
|
15
|
+
*
|
|
16
|
+
* @param description of the canvas.
|
|
17
|
+
* @param either LABEL or FALLBACK.
|
|
18
|
+
* @example <div>
|
|
19
|
+
* <code>
|
|
20
|
+
* function setup() {
|
|
21
|
+
* background('pink');
|
|
22
|
+
*
|
|
23
|
+
* // Draw a heart.
|
|
24
|
+
* fill('red');
|
|
25
|
+
* noStroke();
|
|
26
|
+
* circle(67, 67, 20);
|
|
27
|
+
* circle(83, 67, 20);
|
|
28
|
+
* triangle(91, 73, 75, 95, 59, 73);
|
|
29
|
+
*
|
|
30
|
+
* // Add a general description of the canvas.
|
|
31
|
+
* describe('A pink square with a red heart in the bottom-right corner.');
|
|
32
|
+
* }
|
|
33
|
+
* </code>
|
|
34
|
+
* </div>
|
|
35
|
+
*
|
|
36
|
+
* <div>
|
|
37
|
+
* <code>
|
|
38
|
+
* function setup() {
|
|
39
|
+
* background('pink');
|
|
40
|
+
*
|
|
41
|
+
* // Draw a heart.
|
|
42
|
+
* fill('red');
|
|
43
|
+
* noStroke();
|
|
44
|
+
* circle(67, 67, 20);
|
|
45
|
+
* circle(83, 67, 20);
|
|
46
|
+
* triangle(91, 73, 75, 95, 59, 73);
|
|
47
|
+
*
|
|
48
|
+
* // Add a general description of the canvas
|
|
49
|
+
* // and display it for debugging.
|
|
50
|
+
* describe('A pink square with a red heart in the bottom-right corner.', LABEL);
|
|
51
|
+
* }
|
|
52
|
+
* </code>
|
|
53
|
+
* </div>
|
|
54
|
+
*
|
|
55
|
+
* <div>
|
|
56
|
+
* <code>
|
|
57
|
+
*
|
|
58
|
+
* function setup(){
|
|
59
|
+
* createCanvas(100, 100);
|
|
60
|
+
* };
|
|
61
|
+
*
|
|
62
|
+
* function draw() {
|
|
63
|
+
* background(200);
|
|
64
|
+
*
|
|
65
|
+
* // The expression
|
|
66
|
+
* // frameCount % 100
|
|
67
|
+
* // causes x to increase from 0
|
|
68
|
+
* // to 99, then restart from 0.
|
|
69
|
+
* let x = frameCount % 100;
|
|
70
|
+
*
|
|
71
|
+
* // Draw the circle.
|
|
72
|
+
* fill(0, 255, 0);
|
|
73
|
+
* circle(x, 50, 40);
|
|
74
|
+
*
|
|
75
|
+
* // Add a general description of the canvas.
|
|
76
|
+
* describe(`A green circle at (${x}, 50) moves from left to right on a gray square.`);
|
|
77
|
+
* }
|
|
78
|
+
* </code>
|
|
79
|
+
* </div>
|
|
80
|
+
*
|
|
81
|
+
* <div>
|
|
82
|
+
* <code>
|
|
83
|
+
*
|
|
84
|
+
* function setup(){
|
|
85
|
+
* createCanvas(100, 100);
|
|
86
|
+
* }
|
|
87
|
+
*
|
|
88
|
+
* function draw() {
|
|
89
|
+
* background(200);
|
|
90
|
+
*
|
|
91
|
+
* // The expression
|
|
92
|
+
* // frameCount % 100
|
|
93
|
+
* // causes x to increase from 0
|
|
94
|
+
* // to 99, then restart from 0.
|
|
95
|
+
* let x = frameCount % 100;
|
|
96
|
+
*
|
|
97
|
+
* // Draw the circle.
|
|
98
|
+
* fill(0, 255, 0);
|
|
99
|
+
* circle(x, 50, 40);
|
|
100
|
+
*
|
|
101
|
+
* // Add a general description of the canvas
|
|
102
|
+
* // and display it for debugging.
|
|
103
|
+
* describe(`A green circle at (${x}, 50) moves from left to right on a gray square.`, LABEL);
|
|
104
|
+
* }
|
|
105
|
+
* </code>
|
|
106
|
+
* </div>
|
|
107
|
+
*/
|
|
108
|
+
function describe(text: string, display?: FALLBACK | LABEL): void;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Creates a screen reader-accessible description of elements in the canvas.Elements are shapes or groups of shapes that create meaning together. For
|
|
112
|
+
* example, a few overlapping circles could make an "eye" element.The first parameter, `name`, is the name of the element.The second parameter, `text`, is the description of the element.The third parameter, `display`, is optional. It determines how the
|
|
113
|
+
* description is displayed. If `LABEL` is passed, as in
|
|
114
|
+
* `describe('A description.', LABEL)`, the description will be visible in
|
|
115
|
+
* a div element next to the canvas. Using `LABEL` creates unhelpful
|
|
116
|
+
* duplicates for screen readers. Only use `LABEL` during development. If
|
|
117
|
+
* `FALLBACK` is passed, as in `describe('A description.', FALLBACK)`, the
|
|
118
|
+
* description will only be visible to screen readers. This is the default
|
|
119
|
+
* mode.Read
|
|
120
|
+
* Writing accessible canvas descriptions
|
|
121
|
+
* to learn more about making sketches accessible.
|
|
122
|
+
*
|
|
123
|
+
* @param name of the element.
|
|
124
|
+
* @param description of the element.
|
|
125
|
+
* @param either LABEL or FALLBACK.
|
|
126
|
+
* @example <div>
|
|
127
|
+
* <code>
|
|
128
|
+
* function setup() {
|
|
129
|
+
* background('pink');
|
|
130
|
+
*
|
|
131
|
+
* // Describe the first element
|
|
132
|
+
* // and draw it.
|
|
133
|
+
* describeElement('Circle', 'A yellow circle in the top-left corner.');
|
|
134
|
+
* noStroke();
|
|
135
|
+
* fill('yellow');
|
|
136
|
+
* circle(25, 25, 40);
|
|
137
|
+
*
|
|
138
|
+
* // Describe the second element
|
|
139
|
+
* // and draw it.
|
|
140
|
+
* describeElement('Heart', 'A red heart in the bottom-right corner.');
|
|
141
|
+
* fill('red');
|
|
142
|
+
* circle(66.6, 66.6, 20);
|
|
143
|
+
* circle(83.2, 66.6, 20);
|
|
144
|
+
* triangle(91.2, 72.6, 75, 95, 58.6, 72.6);
|
|
145
|
+
*
|
|
146
|
+
* // Add a general description of the canvas.
|
|
147
|
+
* describe('A red heart and yellow circle over a pink background.');
|
|
148
|
+
* }
|
|
149
|
+
* </code>
|
|
150
|
+
* </div>
|
|
151
|
+
*
|
|
152
|
+
* <div>
|
|
153
|
+
* <code>
|
|
154
|
+
* function setup() {
|
|
155
|
+
* background('pink');
|
|
156
|
+
*
|
|
157
|
+
* // Describe the first element
|
|
158
|
+
* // and draw it. Display the
|
|
159
|
+
* // description for debugging.
|
|
160
|
+
* describeElement('Circle', 'A yellow circle in the top-left corner.', LABEL);
|
|
161
|
+
* noStroke();
|
|
162
|
+
* fill('yellow');
|
|
163
|
+
* circle(25, 25, 40);
|
|
164
|
+
*
|
|
165
|
+
* // Describe the second element
|
|
166
|
+
* // and draw it. Display the
|
|
167
|
+
* // description for debugging.
|
|
168
|
+
* describeElement('Heart', 'A red heart in the bottom-right corner.', LABEL);
|
|
169
|
+
* fill('red');
|
|
170
|
+
* circle(66.6, 66.6, 20);
|
|
171
|
+
* circle(83.2, 66.6, 20);
|
|
172
|
+
* triangle(91.2, 72.6, 75, 95, 58.6, 72.6);
|
|
173
|
+
*
|
|
174
|
+
* // Add a general description of the canvas.
|
|
175
|
+
* describe('A red heart and yellow circle over a pink background.');
|
|
176
|
+
* }
|
|
177
|
+
* </code>
|
|
178
|
+
* </div>
|
|
179
|
+
*/
|
|
180
|
+
function describeElement(name: string, text: string, display?: FALLBACK | LABEL): void;
|
|
181
|
+
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export default function describe(p5: any, fn: any): void;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a screen reader-accessible description of shapes on the canvas.`textOutput()` adds a general description, list of shapes, and
|
|
8
|
+
* table of shapes to the web page. The general description includes the
|
|
9
|
+
* canvas size, canvas color, and number of shapes. For example,
|
|
10
|
+
* `Your output is a, 100 by 100 pixels, gray canvas containing the following 2 shapes:`.A list of shapes follows the general description. The list describes the
|
|
11
|
+
* color, location, and area of each shape. For example,
|
|
12
|
+
* `a red circle at middle covering 3% of the canvas`. Each shape can be
|
|
13
|
+
* selected to get more details.`textOutput()` uses its table of shapes as a list. The table describes the
|
|
14
|
+
* shape, color, location, coordinates and area. For example,
|
|
15
|
+
* `red circle location = middle area = 3%`. This is different from
|
|
16
|
+
* gridOutput(), which uses its table as a grid.The `display` parameter is optional. It determines how the description is
|
|
17
|
+
* displayed. If `LABEL` is passed, as in `textOutput(LABEL)`, the description
|
|
18
|
+
* will be visible in a div element next to the canvas. Using `LABEL` creates
|
|
19
|
+
* unhelpful duplicates for screen readers. Only use `LABEL` during
|
|
20
|
+
* development. If `FALLBACK` is passed, as in `textOutput(FALLBACK)`, the
|
|
21
|
+
* description will only be visible to screen readers. This is the default
|
|
22
|
+
* mode.Read
|
|
23
|
+
* Writing accessible canvas descriptions
|
|
24
|
+
* to learn more about making sketches accessible.
|
|
25
|
+
*
|
|
26
|
+
* @param either FALLBACK or LABEL.
|
|
27
|
+
* @example <div>
|
|
28
|
+
* <code>
|
|
29
|
+
* function setup() {
|
|
30
|
+
* // Add the text description.
|
|
31
|
+
* textOutput();
|
|
32
|
+
*
|
|
33
|
+
* // Draw a couple of shapes.
|
|
34
|
+
* background(200);
|
|
35
|
+
* fill(255, 0, 0);
|
|
36
|
+
* circle(20, 20, 20);
|
|
37
|
+
* fill(0, 0, 255);
|
|
38
|
+
* square(50, 50, 50);
|
|
39
|
+
*
|
|
40
|
+
* // Add a general description of the canvas.
|
|
41
|
+
* describe('A red circle and a blue square on a gray background.');
|
|
42
|
+
* }
|
|
43
|
+
* </code>
|
|
44
|
+
* </div>
|
|
45
|
+
*
|
|
46
|
+
* <div>
|
|
47
|
+
* <code>
|
|
48
|
+
* function setup() {
|
|
49
|
+
* // Add the text description and
|
|
50
|
+
* // display it for debugging.
|
|
51
|
+
* textOutput(LABEL);
|
|
52
|
+
*
|
|
53
|
+
* // Draw a couple of shapes.
|
|
54
|
+
* background(200);
|
|
55
|
+
* fill(255, 0, 0);
|
|
56
|
+
* circle(20, 20, 20);
|
|
57
|
+
* fill(0, 0, 255);
|
|
58
|
+
* square(50, 50, 50);
|
|
59
|
+
*
|
|
60
|
+
* // Add a general description of the canvas.
|
|
61
|
+
* describe('A red circle and a blue square on a gray background.');
|
|
62
|
+
* }
|
|
63
|
+
* </code>
|
|
64
|
+
* </div>
|
|
65
|
+
*
|
|
66
|
+
* <div>
|
|
67
|
+
* <code>
|
|
68
|
+
*
|
|
69
|
+
* function setup(){
|
|
70
|
+
* createCanvas(100, 100);
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* function draw() {
|
|
74
|
+
* // Add the text description.
|
|
75
|
+
* textOutput();
|
|
76
|
+
*
|
|
77
|
+
* // Draw a moving circle.
|
|
78
|
+
* background(200);
|
|
79
|
+
* let x = frameCount * 0.1;
|
|
80
|
+
* fill(255, 0, 0);
|
|
81
|
+
* circle(x, 20, 20);
|
|
82
|
+
* fill(0, 0, 255);
|
|
83
|
+
* square(50, 50, 50);
|
|
84
|
+
*
|
|
85
|
+
* // Add a general description of the canvas.
|
|
86
|
+
* describe('A red circle moves from left to right above a blue square.');
|
|
87
|
+
* }
|
|
88
|
+
* </code>
|
|
89
|
+
* </div>
|
|
90
|
+
*
|
|
91
|
+
* <div>
|
|
92
|
+
* <code>
|
|
93
|
+
*
|
|
94
|
+
* function setup(){
|
|
95
|
+
* createCanvas(100, 100);
|
|
96
|
+
* }
|
|
97
|
+
*
|
|
98
|
+
* function draw() {
|
|
99
|
+
* // Add the text description and
|
|
100
|
+
* // display it for debugging.
|
|
101
|
+
* textOutput(LABEL);
|
|
102
|
+
*
|
|
103
|
+
* // Draw a moving circle.
|
|
104
|
+
* background(200);
|
|
105
|
+
* let x = frameCount * 0.1;
|
|
106
|
+
* fill(255, 0, 0);
|
|
107
|
+
* circle(x, 20, 20);
|
|
108
|
+
* fill(0, 0, 255);
|
|
109
|
+
* square(50, 50, 50);
|
|
110
|
+
*
|
|
111
|
+
* // Add a general description of the canvas.
|
|
112
|
+
* describe('A red circle moves from left to right above a blue square.');
|
|
113
|
+
* }
|
|
114
|
+
* </code>
|
|
115
|
+
* </div>
|
|
116
|
+
*/
|
|
117
|
+
function textOutput(display?: FALLBACK | LABEL): void;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Creates a screen reader-accessible description of shapes on the canvas.`gridOutput()` adds a general description, table of shapes, and list of
|
|
121
|
+
* shapes to the web page. The general description includes the canvas size,
|
|
122
|
+
* canvas color, and number of shapes. For example,
|
|
123
|
+
* `gray canvas, 100 by 100 pixels, contains 2 shapes: 1 circle 1 square`.`gridOutput()` uses its table of shapes as a grid. Each shape in the grid
|
|
124
|
+
* is placed in a cell whose row and column correspond to the shape's location
|
|
125
|
+
* on the canvas. The grid cells describe the color and type of shape at that
|
|
126
|
+
* location. For example, `red circle`. These descriptions can be selected
|
|
127
|
+
* individually to get more details. This is different from
|
|
128
|
+
* textOutput(), which uses its table as a list.A list of shapes follows the table. The list describes the color, type,
|
|
129
|
+
* location, and area of each shape. For example,
|
|
130
|
+
* `red circle, location = middle, area = 3 %`.The `display` parameter is optional. It determines how the description is
|
|
131
|
+
* displayed. If `LABEL` is passed, as in `gridOutput(LABEL)`, the description
|
|
132
|
+
* will be visible in a div element next to the canvas. Using `LABEL` creates
|
|
133
|
+
* unhelpful duplicates for screen readers. Only use `LABEL` during
|
|
134
|
+
* development. If `FALLBACK` is passed, as in `gridOutput(FALLBACK)`, the
|
|
135
|
+
* description will only be visible to screen readers. This is the default
|
|
136
|
+
* mode.Read
|
|
137
|
+
* Writing accessible canvas descriptions
|
|
138
|
+
* to learn more about making sketches accessible.
|
|
139
|
+
*
|
|
140
|
+
* @param either FALLBACK or LABEL.
|
|
141
|
+
* @example <div>
|
|
142
|
+
* <code>
|
|
143
|
+
* function setup() {
|
|
144
|
+
* // Add the grid description.
|
|
145
|
+
* gridOutput();
|
|
146
|
+
*
|
|
147
|
+
* // Draw a couple of shapes.
|
|
148
|
+
* background(200);
|
|
149
|
+
* fill(255, 0, 0);
|
|
150
|
+
* circle(20, 20, 20);
|
|
151
|
+
* fill(0, 0, 255);
|
|
152
|
+
* square(50, 50, 50);
|
|
153
|
+
*
|
|
154
|
+
* // Add a general description of the canvas.
|
|
155
|
+
* describe('A red circle and a blue square on a gray background.');
|
|
156
|
+
* }
|
|
157
|
+
* </code>
|
|
158
|
+
* </div>
|
|
159
|
+
*
|
|
160
|
+
* <div>
|
|
161
|
+
* <code>
|
|
162
|
+
* function setup() {
|
|
163
|
+
* // Add the grid description and
|
|
164
|
+
* // display it for debugging.
|
|
165
|
+
* gridOutput(LABEL);
|
|
166
|
+
*
|
|
167
|
+
* // Draw a couple of shapes.
|
|
168
|
+
* background(200);
|
|
169
|
+
* fill(255, 0, 0);
|
|
170
|
+
* circle(20, 20, 20);
|
|
171
|
+
* fill(0, 0, 255);
|
|
172
|
+
* square(50, 50, 50);
|
|
173
|
+
*
|
|
174
|
+
* // Add a general description of the canvas.
|
|
175
|
+
* describe('A red circle and a blue square on a gray background.');
|
|
176
|
+
* }
|
|
177
|
+
* </code>
|
|
178
|
+
* </div>
|
|
179
|
+
*
|
|
180
|
+
* <div>
|
|
181
|
+
* <code>
|
|
182
|
+
*
|
|
183
|
+
* function setup() {
|
|
184
|
+
* createCanvas(100, 100);
|
|
185
|
+
* }
|
|
186
|
+
*
|
|
187
|
+
* function draw() {
|
|
188
|
+
* // Add the grid description.
|
|
189
|
+
* gridOutput();
|
|
190
|
+
*
|
|
191
|
+
* // Draw a moving circle.
|
|
192
|
+
* background(200);
|
|
193
|
+
* let x = frameCount * 0.1;
|
|
194
|
+
* fill(255, 0, 0);
|
|
195
|
+
* circle(x, 20, 20);
|
|
196
|
+
* fill(0, 0, 255);
|
|
197
|
+
* square(50, 50, 50);
|
|
198
|
+
*
|
|
199
|
+
* // Add a general description of the canvas.
|
|
200
|
+
* describe('A red circle moves from left to right above a blue square.');
|
|
201
|
+
* }
|
|
202
|
+
* </code>
|
|
203
|
+
* </div>
|
|
204
|
+
*
|
|
205
|
+
* <div>
|
|
206
|
+
* <code>
|
|
207
|
+
*
|
|
208
|
+
* function setup(){
|
|
209
|
+
* createCanvas(100, 100);
|
|
210
|
+
* }
|
|
211
|
+
*
|
|
212
|
+
* function draw() {
|
|
213
|
+
* // Add the grid description and
|
|
214
|
+
* // display it for debugging.
|
|
215
|
+
* gridOutput(LABEL);
|
|
216
|
+
*
|
|
217
|
+
* // Draw a moving circle.
|
|
218
|
+
* background(200);
|
|
219
|
+
* let x = frameCount * 0.1;
|
|
220
|
+
* fill(255, 0, 0);
|
|
221
|
+
* circle(x, 20, 20);
|
|
222
|
+
* fill(0, 0, 255);
|
|
223
|
+
* square(50, 50, 50);
|
|
224
|
+
*
|
|
225
|
+
* // Add a general description of the canvas.
|
|
226
|
+
* describe('A red circle moves from left to right above a blue square.');
|
|
227
|
+
* }
|
|
228
|
+
* </code>
|
|
229
|
+
* </div>
|
|
230
|
+
*/
|
|
231
|
+
function gridOutput(display?: FALLBACK | LABEL): void;
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export default function outputs(p5: any, fn: any): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// This file is auto-generated from JSDoc documentation
|
|
2
|
+
|
|
3
|
+
import p5 from 'p5';
|
|
4
|
+
|
|
5
|
+
declare module 'p5' {
|
|
6
|
+
/**
|
|
7
|
+
* Convert an HSBA array to HSLA.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
function _hsbaToHSLA(hsba: any): void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Convert an HSBA array to RGBA.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
function _hsbaToRGBA(hsba: any): void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Convert an HSLA array to HSBA.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
function _hslaToHSBA(hsla: any): void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Convert an HSLA array to RGBA.We need to change basis from HSLA to something that can be more easily be
|
|
26
|
+
* projected onto RGBA. We will choose hue and brightness as our first two
|
|
27
|
+
* components, and pick a convenient third one ('zest') so that we don't need
|
|
28
|
+
* to calculate formal HSBA saturation.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
function _hslaToRGBA(hsla: any): void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Convert an RGBA array to HSBA.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
function _rgbaToHSBA(rgba: any): void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Convert an RGBA array to HSLA.
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
function _rgbaToHSLA(rgba: any): void;
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default function color_conversion(p5: any, fn: any): void;
|