Skip to content

Commit 800015d

Browse files
authored
Merge pull request #5593 from Zearin/issue-5139/events
docs(src/events): Use `describe()` over `@alt`
2 parents f2152b3 + 5b27da2 commit 800015d

File tree

5 files changed

+95
-158
lines changed

5 files changed

+95
-158
lines changed

src/data/local_storage.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ import p5 from '../core/main';
3939
* if (myText === null) {
4040
* myText = '';
4141
* }
42+
* describe(`When you type the key name is displayed as black text on white background.
43+
* If you reload the page, the last letter typed is still displaying.`);
4244
* }
4345
*
4446
* function draw() {
@@ -52,10 +54,6 @@ import p5 from '../core/main';
5254
* storeItem('myText', myText);
5355
* }
5456
* </code></div>
55-
*
56-
* @alt
57-
* When you type the key name is displayed as black text on white background.
58-
* If you reload the page, the last letter typed is still displaying.
5957
*/
6058
p5.prototype.storeItem = function(key, value) {
6159
if (typeof key !== 'string') {
@@ -127,18 +125,16 @@ p5.prototype.storeItem = function(key, value) {
127125
* if (myColor !== null) {
128126
* background(myColor);
129127
* }
128+
* describe(`If you click, the canvas changes to a random color.·
129+
* If you reload the page, the canvas is still the color it was when the
130+
* page was previously loaded.`);
130131
* }
131132
*
132133
* function mousePressed() {
133134
* myColor = color(random(255), random(255), random(255));
134135
* storeItem('myColor', myColor);
135136
* }
136137
* </code></div>
137-
*
138-
* @alt
139-
* If you click, the canvas changes to a random color.
140-
* If you reload the page, the canvas is still the color it
141-
* was when the page was previously loaded.
142138
*/
143139
p5.prototype.getItem = function(key) {
144140
let value = localStorage.getItem(key);

src/events/acceleration.js

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ p5.prototype.deviceOrientation =
3535
* background(220, 50);
3636
* fill('magenta');
3737
* ellipse(width / 2, height / 2, accelerationX);
38+
* describe('Magnitude of device acceleration is displayed as ellipse size.');
3839
* }
3940
* </code>
4041
* </div>
41-
* @alt
42-
* Magnitude of device acceleration is displayed as ellipse size
4342
*/
4443
p5.prototype.accelerationX = 0;
4544

@@ -58,11 +57,10 @@ p5.prototype.accelerationX = 0;
5857
* background(220, 50);
5958
* fill('magenta');
6059
* ellipse(width / 2, height / 2, accelerationY);
60+
* describe('Magnitude of device acceleration is displayed as ellipse size');
6161
* }
6262
* </code>
6363
* </div>
64-
* @alt
65-
* Magnitude of device acceleration is displayed as ellipse size
6664
*/
6765
p5.prototype.accelerationY = 0;
6866

@@ -82,12 +80,10 @@ p5.prototype.accelerationY = 0;
8280
* background(220, 50);
8381
* fill('magenta');
8482
* ellipse(width / 2, height / 2, accelerationZ);
83+
* describe('Magnitude of device acceleration is displayed as ellipse size');
8584
* }
8685
* </code>
8786
* </div>
88-
*
89-
* @alt
90-
* Magnitude of device acceleration is displayed as ellipse size
9187
*/
9288
p5.prototype.accelerationZ = 0;
9389

@@ -157,11 +153,11 @@ p5.prototype._updatePAccelerations = function() {
157153
* rotateX(radians(rotationX));
158154
* //rotateY(radians(rotationY));
159155
* box(200, 200, 200);
156+
* describe(`red horizontal line right, green vertical line bottom.
157+
* black background.`);
160158
* }
161159
* </code>
162160
* </div>
163-
* @alt
164-
* red horizontal line right, green vertical line bottom. black background.
165161
*/
166162
p5.prototype.rotationX = 0;
167163

@@ -190,11 +186,11 @@ p5.prototype.rotationX = 0;
190186
* //rotateX(radians(rotationX));
191187
* rotateY(radians(rotationY));
192188
* box(200, 200, 200);
189+
* describe(`red horizontal line right, green vertical line bottom.
190+
* black background.`);
193191
* }
194192
* </code>
195193
* </div>
196-
* @alt
197-
* red horizontal line right, green vertical line bottom. black background.
198194
*/
199195
p5.prototype.rotationY = 0;
200196

@@ -224,15 +220,14 @@ p5.prototype.rotationY = 0;
224220
* //rotateX(radians(rotationX));
225221
* //rotateY(radians(rotationY));
226222
* box(200, 200, 200);
223+
* describe(`red horizontal line right, green vertical line bottom.
224+
* black background.`);
227225
* }
228226
* </code>
229227
* </div>
230228
*
231229
* @property {Number} rotationZ
232230
* @readOnly
233-
*
234-
* @alt
235-
* red horizontal line right, green vertical line bottom. black background.
236231
*/
237232
p5.prototype.rotationZ = 0;
238233

@@ -271,12 +266,10 @@ p5.prototype.rotationZ = 0;
271266
* }
272267
*
273268
* print(rotateDirection);
269+
* describe('no image to display.');
274270
* </code>
275271
* </div>
276272
*
277-
* @alt
278-
* no image to display.
279-
*
280273
* @property {Number} pRotationX
281274
* @readOnly
282275
*/
@@ -316,12 +309,10 @@ p5.prototype.pRotationX = 0;
316309
* rotateDirection = 'counter-clockwise';
317310
* }
318311
* print(rotateDirection);
312+
* describe('no image to display.');
319313
* </code>
320314
* </div>
321315
*
322-
* @alt
323-
* no image to display.
324-
*
325316
* @property {Number} pRotationY
326317
* @readOnly
327318
*/
@@ -357,12 +348,10 @@ p5.prototype.pRotationY = 0;
357348
* rotateDirection = 'counter-clockwise';
358349
* }
359350
* print(rotateDirection);
351+
* describe('no image to display.');
360352
* </code>
361353
* </div>
362354
*
363-
* @alt
364-
* no image to display.
365-
*
366355
* @property {Number} pRotationZ
367356
* @readOnly
368357
*/
@@ -403,6 +392,10 @@ p5.prototype._updatePRotations = function() {
403392
* function draw() {
404393
* fill(value);
405394
* rect(25, 25, 50, 50);
395+
* describe(`50-by-50 black rect in center of canvas.
396+
* turns white on mobile when device turns`);
397+
* describe(`50-by-50 black rect in center of canvas.
398+
* turns white on mobile when x-axis turns`);
406399
* }
407400
* function deviceTurned() {
408401
* if (turnAxis === 'X') {
@@ -415,10 +408,6 @@ p5.prototype._updatePRotations = function() {
415408
* }
416409
* </code>
417410
* </div>
418-
*
419-
* @alt
420-
* 50×50 black rect in center of canvas. turns white on mobile when device turns
421-
* 50×50 black rect in center of canvas. turns white on mobile when x-axis turns
422411
*/
423412
p5.prototype.turnAxis = undefined;
424413

@@ -446,6 +435,8 @@ let shake_threshold = 30;
446435
* function draw() {
447436
* fill(value);
448437
* rect(25, 25, 50, 50);
438+
* describe(`50-by-50 black rect in center of canvas.
439+
* turns white on mobile when device moves`);
449440
* }
450441
* function deviceMoved() {
451442
* value = value + 5;
@@ -458,9 +449,6 @@ let shake_threshold = 30;
458449
* }
459450
* </code>
460451
* </div>
461-
*
462-
* @alt
463-
* 50×50 black rect in center of canvas. turns white on mobile when device moves
464452
*/
465453

466454
p5.prototype.setMoveThreshold = function(val) {
@@ -489,6 +477,8 @@ p5.prototype.setMoveThreshold = function(val) {
489477
* function draw() {
490478
* fill(value);
491479
* rect(25, 25, 50, 50);
480+
* describe(`50-by-50 black rect in center of canvas.
481+
* turns white on mobile when device is being shaked`);
492482
* }
493483
* function deviceMoved() {
494484
* value = value + 5;
@@ -501,10 +491,6 @@ p5.prototype.setMoveThreshold = function(val) {
501491
* }
502492
* </code>
503493
* </div>
504-
*
505-
* @alt
506-
* 50×50 black rect in center of canvas. turns white on mobile when device
507-
* is being shaked
508494
*/
509495

510496
p5.prototype.setShakeThreshold = function(val) {
@@ -529,6 +515,8 @@ p5.prototype.setShakeThreshold = function(val) {
529515
* function draw() {
530516
* fill(value);
531517
* rect(25, 25, 50, 50);
518+
* describe(`50-by-50 black rect in center of canvas.
519+
* turns white on mobile when device moves`);
532520
* }
533521
* function deviceMoved() {
534522
* value = value + 5;
@@ -538,9 +526,6 @@ p5.prototype.setShakeThreshold = function(val) {
538526
* }
539527
* </code>
540528
* </div>
541-
*
542-
* @alt
543-
* 50×50 black rect in center of canvas. turns white on mobile when device moves
544529
*/
545530

546531
/**
@@ -563,6 +548,8 @@ p5.prototype.setShakeThreshold = function(val) {
563548
* function draw() {
564549
* fill(value);
565550
* rect(25, 25, 50, 50);
551+
* describe(`50-by-50 black rect in center of canvas.
552+
* turns white on mobile when device turns`);
566553
* }
567554
* function deviceTurned() {
568555
* if (value === 0) {
@@ -583,6 +570,8 @@ p5.prototype.setShakeThreshold = function(val) {
583570
* function draw() {
584571
* fill(value);
585572
* rect(25, 25, 50, 50);
573+
* describe(`50-by-50 black rect in center of canvas.
574+
* turns white on mobile when x-axis turns`);
586575
* }
587576
* function deviceTurned() {
588577
* if (turnAxis === 'X') {
@@ -595,10 +584,6 @@ p5.prototype.setShakeThreshold = function(val) {
595584
* }
596585
* </code>
597586
* </div>
598-
*
599-
* @alt
600-
* 50×50 black rect in center of canvas. turns white on mobile when device turns
601-
* 50×50 black rect in center of canvas. turns white on mobile when x-axis turns
602587
*/
603588

604589
/**
@@ -618,6 +603,8 @@ p5.prototype.setShakeThreshold = function(val) {
618603
* function draw() {
619604
* fill(value);
620605
* rect(25, 25, 50, 50);
606+
* describe(`50-by-50 black rect in center of canvas.
607+
* turns white on mobile when device shakes`);
621608
* }
622609
* function deviceShaken() {
623610
* value = value + 5;
@@ -627,9 +614,6 @@ p5.prototype.setShakeThreshold = function(val) {
627614
* }
628615
* </code>
629616
* </div>
630-
*
631-
* @alt
632-
* 50×50 black rect in center of canvas. turns white on mobile when device shakes
633617
*/
634618

635619
p5.prototype._ondeviceorientation = function(e) {

0 commit comments

Comments
 (0)