@@ -13,14 +13,15 @@ slug: learn/
13
13
14
14
<h1 >{{ #i18n " labeling-canvases-title" }} {{ /i18n }} </h1 >
15
15
16
- <p >{{ #i18n " labeling-canvases-intro-1" }} {{ /i18n }} <a class = " code" href =" {{ root }} /reference/#/p5/describe" >describe()</a >,
17
- <a class = " code" href =" {{ root }} /reference/#/p5/describeElement" >describeElement()</a >, <a class = " code" href =" {{ root }} /reference/#/p5/gridOutput" >gridOutput()</a >,
18
- {{ #i18n " labeling-canvases-intro-2" }} {{ /i18n }} <a class = " code" href =" {{ root }} /reference/#/p5/textOutput" >textOutput()</a > {{ #i18n " labeling-canvases-intro-3" }} {{ /i18n }} </p >
16
+ <h2 >{{ #i18n " labeling-canvases-intro" }} {{ /i18n }} </h2 >
17
+ <p >{{ #i18n " labeling-canvases-intro-1" }} {{ /i18n }} </p >
19
18
20
19
<h2 >{{ #i18n " labeling-canvases-what-is-labeling" }} {{ /i18n }} </h2 >
21
20
<p >{{ #i18n " labeling-canvases-what-is-labeling-1" }} {{ /i18n }} </p >
22
- <p >{{ #i18n " labeling-canvases-what-is-labeling-2" }} {{ /i18n }} </p >
23
- <p >{{ #i18n " labeling-canvases-what-is-labeling-3" }} {{ /i18n }} <a href =" {{ root }} /learn/p5-screen-reader.html" >Using p5 with a screen reader</a >.</p >
21
+
22
+ <h2 >{{ #i18n " labeling-canvases-why-labeling-matters" }} {{ /i18n }} </h2 >
23
+ <p >{{ #i18n " labeling-canvases-why-labeling-matters-1" }} {{ /i18n }} </p >
24
+ <p >{{ #i18n " labeling-canvases-why-labeling-matters-2" }} {{ /i18n }} </p >
24
25
25
26
<h2 >{{ #i18n " labeling-canvases-available-labels" }} {{ /i18n }} </h2 >
26
27
<p >{{ #i18n " labeling-canvases-available-labels-1" }} {{ /i18n }} :</p >
@@ -31,130 +32,107 @@ slug: learn/
31
32
<li >{{ #i18n " labeling-canvases-available-labels-li-4" }} {{ /i18n }} </li >
32
33
</ul >
33
34
34
- <h2 >{{ #i18n " labeling-canvases-best-practices" }} {{ /i18n }} </h2 >
35
-
36
- <h3 >{{ #i18n " labeling-canvases-best-practices-what-requires-labeling" }} {{ /i18n }} </h3 >
37
- <p >{{ #i18n " labeling-canvases-best-practices-what-requires-labeling-1" }} {{ /i18n }} </p >
38
- <p >{{ #i18n " labeling-canvases-best-practices-what-requires-labeling-2" }} {{ /i18n }} </p >
39
-
40
-
41
- <!-- Code example below copied from Reference page: https://p5js.org/reference/#/p5/describe-->
35
+ <h2 >{{ #i18n " labeling-canvases-prerequisites" }} {{ /i18n }} </h2 >
36
+ <p >{{ #i18n " labeling-canvases-prerequisites-1" }} {{ /i18n }} </p >
37
+ <p >{{ #i18n " labeling-canvases-prerequisites-2" }} {{ /i18n }} </p >
42
38
43
39
<script type =" text/p5" data-p5-version =" {{ version }} " >
44
40
function setup () {
45
41
createCanvas (100 , 100 );
42
+ describe (" A blue square in the center of a black canvas." );
46
43
}
47
44
48
45
function draw () {
49
- background (255 , 192 , 203 );
46
+ background (250 );
50
47
noStroke ();
51
48
fill (200 ,0 ,0 );
52
49
53
- describeElement (" Heart" ," Red heart in the bottom right corner." );
54
- ellipse (67 , 67 , 20 , 20 );
55
- ellipse (83 , 67 , 20 , 20 );
56
- triangle (91 , 73 , 75 , 95 , 59 , 73 );
50
+ rect (67 , 67 , 20 , 20 );
57
51
}
58
52
</script >
59
53
60
- <p >{{ #i18n " labeling-canvases-best-practices-what-requires-labeling-3" }} {{ /i18n }} </p >
61
- <p >{{ #i18n " labeling-canvases-best-practices-what-requires-labeling-4" }} {{ /i18n }} </p >
54
+ <h2 >{{ #i18n " labeling-canvases-steps-for-labeling" }} {{ /i18n }} </h2 >
55
+
56
+ <h3 >{{ #i18n " labeling-canvases-steps-for-labeling-step-1" }} {{ /i18n }} </h3 >
57
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-1" }} {{ /i18n }} </p >
58
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-2" }} {{ /i18n }} </p >
59
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-3" }} {{ /i18n }} </p >
62
60
63
61
<script type =" text/p5" data-p5-version =" {{ version }} " >
64
62
function setup () {
65
63
createCanvas (100 , 100 );
64
+ describe (" A red heart in the bottom right corner of a white background." );
66
65
}
67
66
68
67
function draw () {
69
- background (255 , 192 , 203 );
68
+ background (250 );
70
69
noStroke ();
71
70
fill (200 ,0 ,0 );
72
71
73
- textSize (12 );
74
- textStyle (NORMAL );
75
- describeElement (" Text" , " The text 'Hello world!' in the upper left corner of a pink canvas.'" );
76
- text (' Hello world!' , 5 , 30 );
72
+ ellipse (67 , 67 , 20 , 20 );
73
+ ellipse (83 , 67 , 20 , 20 );
74
+ triangle (91 , 73 , 75 , 95 , 59 , 73 );
77
75
}
78
76
</script >
79
77
80
- <p >{{ #i18n " labeling-canvases-best-practices-what-requires-labeling-5" }} {{ /i18n }} </p >
78
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-4" }} {{ /i18n }} </p >
79
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-5" }} {{ /i18n }} </p >
80
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-6" }} {{ /i18n }} </p >
81
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-7" }} {{ /i18n }} </p >
81
82
82
- <h3 >{{ #i18n " labeling-canvases-best-practices-dont-label" }} {{ /i18n }} </h3 >
83
- <p >{{ #i18n " labeling-canvases-best-practices-dont-label-1" }} {{ /i18n }} </p >
84
- <p >{{ #i18n " labeling-canvases-best-practices-dont-label-2" }} {{ /i18n }} </p >
85
-
86
- <h3 >{{ #i18n " labeling-canvases-best-practices-using-labels" }} {{ /i18n }} </h3 >
83
+ <h4 >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-complex" }} {{ /i18n }} </h4 >
84
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-complex-1" }} {{ /i18n }} </p >
85
+ <ul class =" list_view" >
86
+ <li >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-complex-li-1" }} {{ /i18n }} </li >
87
+ <li >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-complex-li-2" }} {{ /i18n }} </li >
88
+ <li >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-complex-li-3" }} {{ /i18n }} </li >
89
+ <li >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-complex-li-4" }} {{ /i18n }} </li >
90
+ </ul >
91
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-1-complex-2" }} {{ /i18n }} </p >
87
92
88
- <h4 >{{ #i18n " labeling-canvases-best-practices-using-labels-all-canvases" }} {{ /i18n }} </h4 >
89
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-all-canvases-1" }} {{ /i18n }} </p >
93
+ <h3 >{{ #i18n " labeling-canvases-steps-for-labeling-step-2" }} {{ /i18n }} </h3 >
94
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-1" }} {{ /i18n }} </p >
95
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-2" }} {{ /i18n }} </p >
96
+ <h4 >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-de" }} {{ /i18n }} </h4 >
97
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-de-1" }} {{ /i18n }} </p >
98
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-de-2" }} {{ /i18n }} </p >
99
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-de-3" }} {{ /i18n }} </p >
100
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-de-4" }} {{ /i18n }} </p >
90
101
91
102
<script type =" text/p5" data-p5-version =" {{ version }} " >
92
103
function setup () {
93
104
createCanvas (100 , 100 );
105
+ // pProvides an overall description of the canvas.
106
+ describe (" Text in the top right corner with red heart in the bottom right corner on a white background." );
94
107
}
95
108
96
109
function draw () {
97
110
background (250 );
98
111
noStroke ();
112
+ fill (200 , 0 , 0 );
99
113
100
- describe (" Flower with red petals and a green stem on a white canvas." );
101
-
102
- fill (" #0DCC23" );
103
- rect (48 , 50 , 5 , 50 );
104
-
105
- fill (200 ,0 ,0 );
106
- ellipse (40 , 55 , 18 );
107
- ellipse (40 , 45 , 18 );
108
- ellipse (50 , 40 , 18 );
109
- ellipse (60 , 55 , 18 );
110
- ellipse (60 , 45 , 18 );
111
- ellipse (50 , 60 , 18 );
112
-
113
- fill (" #FFE200" );
114
- ellipse (50 ,50 ,15 );
115
- }
116
- </script >
117
-
118
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-all-canvases-2" }} {{ /i18n }} </p >
119
-
120
- <h4 >{{ #i18n " labeling-canvases-best-practices-using-labels-simple" }} {{ /i18n }} </h4 >
121
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-simple-1" }} {{ /i18n }} </p >
122
-
123
- <script type =" text/p5" data-p5-version =" {{ version }} " >
124
- function setup () {
125
- createCanvas (100 , 100 );
126
- }
114
+ textSize (12 );
115
+ textStyle (NORMAL );
116
+ // Specific label for text.
117
+ describeElement (" Text" , " The text 'Hello world!' in the upper left corner of a white canvas." );
118
+ text (' Hello world!' , 5 , 30 );
127
119
128
- function draw () {
129
- background ( 250 );
130
- noStroke ( );
131
-
132
- textOutput ( LABEL );
120
+ // Specific label for the heart.
121
+ describeElement ( " Heart " , " A red heart in the bottom right corner. " );
122
+ ellipse ( 67 , 67 , 20 , 20 );
123
+ ellipse ( 83 , 67 , 20 , 20 );
124
+ triangle ( 91 , 73 , 75 , 95 , 59 , 73 );
133
125
134
- fill (" #0DCC23" );
135
- rect (48 , 50 , 5 , 50 );
136
-
137
- fill (200 ,0 ,0 );
138
- ellipse (40 , 55 , 18 );
139
- ellipse (40 , 45 , 18 );
140
- ellipse (50 , 40 , 18 );
141
- ellipse (60 , 55 , 18 );
142
- ellipse (60 , 45 , 18 );
143
- ellipse (50 , 60 , 18 );
144
-
145
- fill (" #FFE200" );
146
- ellipse (50 ,50 ,15 );
147
126
}
148
127
</script >
149
128
150
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-simple-2" }} {{ /i18n }} </p >
151
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-simple-3" }} {{ /i18n }} </p >
152
-
153
- <h4 >{{ #i18n " labeling-canvases-best-practices-using-labels-interactive" }} {{ /i18n }} </h4 >
154
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-interactive-1" }} {{ /i18n }} </p >
129
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-de-5" }} {{ /i18n }} </p >
130
+ <h4 >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-go-to" }} {{ /i18n }} </h4 >
131
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-using-go-to-1" }} {{ /i18n }} </p >
132
+ <h4 >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-animated" }} {{ /i18n }} </h4 >
133
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-animated-1" }} {{ /i18n }} </p >
134
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-animated-2" }} {{ /i18n }} </p >
155
135
156
- <!-- Code example below copied from Reference page: https://p5js.org/reference/#/p5/describe-->
157
-
158
136
<script type =" text/p5" data-p5-version =" {{ version }} " >
159
137
let x = 0 ;
160
138
@@ -170,58 +148,46 @@ function draw() {
170
148
fill (0 , 255 , 0 );
171
149
ellipse (x, 50 , 40 , 40 );
172
150
x = x + 0.1 ;
173
- describe (' green circle at x pos ' + round (x) + ' moving to the right' , LABEL );
151
+ // Label updates with shape’s translation.
152
+ describe (" A green circle at x position " + round (x) + " , moving to the right" , LABEL );
174
153
}
175
154
</script >
176
155
177
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-interactive-2" }} {{ /i18n }} </p >
178
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-interactive-3" }} {{ /i18n }} </p >
179
-
180
- <h4 >{{ #i18n " labeling-canvases-best-practices-using-labels-complex" }} {{ /i18n }} </h4 >
181
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-complex-1" }} {{ /i18n }} </p >
182
-
183
- <ul class =" list_view" >
184
- <li >{{ #i18n " labeling-canvases-best-practices-using-labels-complex-ul-1" }} {{ /i18n }} </li >
185
- <li >{{ #i18n " labeling-canvases-best-practices-using-labels-complex-ul-2" }} {{ /i18n }} </li >
186
- <li >{{ #i18n " labeling-canvases-best-practices-using-labels-complex-ul-3" }} {{ /i18n }} </li >
187
- </ul >
188
- <p >{{ #i18n " labeling-canvases-best-practices-using-labels-complex-2" }} {{ /i18n }} </p >
189
-
190
- <h3 >{{ #i18n " labeling-canvases-how-not-to-use-labels" }} {{ /i18n }} </h3 >
156
+ <h4 >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-do-donts" }} {{ /i18n }} </h4 >
157
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-do-donts-1" }} {{ /i18n }} </p >
158
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-2-do-donts-2" }} {{ /i18n }} </p >
191
159
192
- <h4 >{{ #i18n " labeling-canvases-how-not-to-use-labels-sub " }} {{ /i18n }} </h4 >
193
- <p >{{ #i18n " labeling-canvases-how-not-to-use-labels-sub -1" }} {{ /i18n }} </p >
160
+ <h3 >{{ #i18n " labeling-canvases-steps-for-labeling-step-3 " }} {{ /i18n }} </h3 >
161
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-3 -1" }} {{ /i18n }} </p >
194
162
195
- <h4 >{{ #i18n " labeling-canvases-how-not-to-use-labels-info-overkill" }} {{ /i18n }} </h4 >
196
- <p >{{ #i18n " labeling-canvases-how-not-to-use-labels-info-overkill-1" }} {{ /i18n }} </p >
197
- <p >{{ #i18n " labeling-canvases-how-not-to-use-labels-info-overkill-2" }} {{ /i18n }} </p >
198
- <p >{{ #i18n " labeling-canvases-how-not-to-use-labels-info-overkill-3" }} {{ /i18n }} </p >
199
-
200
- <h2 >{{ #i18n " labeling-canvases-testing-labels" }} {{ /i18n }} </h2 >
201
- <p >{{ #i18n " labeling-canvases-testing-labels-1" }} {{ /i18n }} </p >
202
-
203
- <script type =" text/p5" data-p5-version =" {{ version }} " >
163
+ <script type =" text/p5" data-p5-version =" {{ version }} " >
204
164
function setup () {
205
165
createCanvas (100 , 100 );
206
166
}
207
167
208
168
function draw () {
169
+
170
+ // LABEL shows the label next to the canvas.
209
171
gridOutput (LABEL );
210
172
211
- background (255 , 192 , 203 );
173
+ background (250 );
212
174
noStroke ();
213
- fill (200 ,0 , 0 );
175
+ fill (200 , 0 , 0 );
214
176
215
177
ellipse (67 , 67 , 20 , 20 );
216
178
ellipse (83 , 67 , 20 , 20 );
217
179
triangle (91 , 73 , 75 , 95 , 59 , 73 );
218
180
}
219
181
</script >
220
182
221
- <p >{{ #i18n " labeling-canvases-testing-labels-2" }} {{ /i18n }} </p >
222
- <p >{{ #i18n " labeling-canvases-testing-labels-3" }} {{ /i18n }} </p >
223
- <br >
224
- <p >{{ #i18n " labeling-canvases-note" }} {{ /i18n }} </p >
183
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-3-2" }} {{ /i18n }} </p >
184
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-3-3" }} {{ /i18n }} </p >
185
+ <p >{{ #i18n " labeling-canvases-steps-for-labeling-step-3-4" }} {{ /i18n }} </p >
186
+
187
+ <h2 >{{ #i18n " labeling-canvases-conclusion" }} {{ /i18n }} </h2 >
188
+ <p >{{ #i18n " labeling-canvases-conclusion-1" }} {{ /i18n }} </p >
189
+ <p >{{ #i18n " labeling-canvases-conclusion-2" }} {{ /i18n }} </p >
190
+ <p >{{ #i18n " labeling-canvases-conclusion-3" }} {{ /i18n }} </p >
225
191
226
192
<!-- this script only needs to get added once even if there are multiple widget instances -->
227
193
<script src =" //toolness.github.io/p5.js-widget/p5-widget.js" ></script >
0 commit comments