Skip to content

Commit a6ca404

Browse files
author
Luis Morales-Navarro
committed
use describe p5 function instead of @alt fix
1 parent 45ff9ca commit a6ca404

File tree

2 files changed

+46
-35
lines changed

2 files changed

+46
-35
lines changed

src/color/setting.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ p5.prototype.stroke = function(...args) {
769769
* erase();
770770
* ellipse(25, 30, 30);
771771
* noErase();
772+
* describe(
773+
* 'centered pink rect over purple background. Elliptical area in top-left of rect is erased white'
774+
* );
772775
* </code>
773776
* </div>
774777
*
@@ -781,6 +784,9 @@ p5.prototype.stroke = function(...args) {
781784
* erase(150, 255);
782785
* triangle(50, 10, 70, 50, 90, 10);
783786
* noErase();
787+
* describe(
788+
* 'purple rect centered over mint green background. Triangle in top-right is partially erased with fully erased outline'
789+
* );
784790
* </code>
785791
* </div>
786792
*
@@ -807,14 +813,13 @@ p5.prototype.stroke = function(...args) {
807813
* translate(0, 0, 40);
808814
* torus(15, 5);
809815
* noErase();
816+
* describe(
817+
* 'teal sphere centered over yellow background. Torus rotating around sphere erases to reveal black text underneath'
818+
* );
810819
* }
811820
* </code>
812821
* </div>
813822
*
814-
* @alt
815-
* 60x60 centered pink rect, purple background. Elliptical area in top-left of rect is erased white.
816-
* 60x60 centered purple rect, mint green background. Triangle in top-right is partially erased with fully erased outline.
817-
* 60x60 centered teal sphere, yellow background. Torus rotating around sphere erases to reveal black text underneath.
818823
*/
819824
p5.prototype.erase = function(opacityFill = 255, opacityStroke = 255) {
820825
this._renderer.erase(opacityFill, opacityStroke);
@@ -841,11 +846,12 @@ p5.prototype.erase = function(opacityFill = 255, opacityStroke = 255) {
841846
* ellipse(50, 50, 60);
842847
* noErase();
843848
* rect(70, 10, 10, 80);
849+
* decribe(
850+
* 'Orange background, with two tall blue rectangles. A centered ellipse erased the first blue rect but not the second'
851+
* );
844852
* </code>
845853
* </div>
846854
*
847-
* @alt
848-
* Orange background, with two tall blue rectangles. A centered ellipse erased the first blue rect but not the second.
849855
*/
850856

851857
p5.prototype.noErase = function() {

src/core/shape/2d_primitives.js

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -136,39 +136,42 @@ p5.prototype._normalizeArcAngles = (
136136
* arc(50, 55, 60, 60, HALF_PI, PI);
137137
* arc(50, 55, 70, 70, PI, PI + QUARTER_PI);
138138
* arc(50, 55, 80, 80, PI + QUARTER_PI, TWO_PI);
139+
* describe(
140+
* 'shattered outline of ellipse with a quarter of a white circle bottom-right'
141+
* );
139142
* </code>
140143
* </div>
141144
*
142145
* <div>
143146
* <code>
144147
* arc(50, 50, 80, 80, 0, PI + QUARTER_PI);
148+
* describe('white ellipse with top right quarter missing');
145149
* </code>
146150
* </div>
147151
*
148152
* <div>
149153
* <code>
150154
* arc(50, 50, 80, 80, 0, PI + QUARTER_PI, OPEN);
155+
* describe('white ellipse with black outline with top right missing');
151156
* </code>
152157
* </div>
153158
*
154159
* <div>
155160
* <code>
156161
* arc(50, 50, 80, 80, 0, PI + QUARTER_PI, CHORD);
162+
* describe('white open arc with black outline with top right missing');
157163
* </code>
158164
* </div>
159165
*
160166
* <div>
161167
* <code>
162168
* arc(50, 50, 80, 80, 0, PI + QUARTER_PI, PIE);
169+
* describe(
170+
* 'white ellipse with top right quarter missing with black outline around the shape'
171+
* );
163172
* </code>
164173
* </div>
165174
*
166-
* @alt
167-
*shattered outline of an ellipse with a quarter of a white circle bottom-right.
168-
*white ellipse with top right quarter missing.
169-
*white ellipse with black outline with top right missing.
170-
*white ellipse with top right missing with black outline around shape.
171-
*white ellipse with top right quarter missing with black outline around the shape.
172175
*/
173176
p5.prototype.arc = function(x, y, w, h, start, stop, mode, detail) {
174177
p5._validateParameters('arc', arguments);
@@ -249,11 +252,10 @@ p5.prototype.arc = function(x, y, w, h, start, stop, mode, detail) {
249252
* <div>
250253
* <code>
251254
* ellipse(56, 46, 55, 55);
255+
* describe('white ellipse with black outline in middle of a gray canvas');
252256
* </code>
253257
* </div>
254258
*
255-
* @alt
256-
*white ellipse with black outline in middle-right of canvas that is 55x55
257259
*/
258260

259261
/**
@@ -291,11 +293,10 @@ p5.prototype.ellipse = function(x, y, w, h, detailX) {
291293
* <code>
292294
* // Draw a circle at location (30, 30) with a diameter of 20.
293295
* circle(30, 30, 20);
296+
* describe('white circle with black outline in mid of gray canvas');
294297
* </code>
295298
* </div>
296299
*
297-
* @alt
298-
* white circle with black outline in mid of canvas that is 55x55.
299300
*/
300301
p5.prototype.circle = function() {
301302
p5._validateParameters('circle', arguments);
@@ -354,6 +355,9 @@ p5.prototype._renderEllipse = function(x, y, w, h, detailX) {
354355
* <div>
355356
* <code>
356357
* line(30, 20, 85, 75);
358+
* describe(
359+
* 'a 78 pixels long line running from mid-top to bottom-right of canvas'
360+
* );
357361
* </code>
358362
* </div>
359363
*
@@ -364,12 +368,12 @@ p5.prototype._renderEllipse = function(x, y, w, h, detailX) {
364368
* line(85, 20, 85, 75);
365369
* stroke(255);
366370
* line(85, 75, 30, 75);
371+
* describe(
372+
* '3 lines of various stroke sizes. Form top, bottom and right sides of a square'
373+
* );
367374
* </code>
368375
* </div>
369376
*
370-
* @alt
371-
* An example showing a line 78 pixels long running from mid-top to bottom-right of canvas.
372-
* An example showing 3 lines of various stroke sizes. Form top, bottom and right sides of a square.
373377
*/
374378

375379
/**
@@ -416,6 +420,7 @@ p5.prototype.line = function(...args) {
416420
* point(85, 20);
417421
* point(85, 75);
418422
* point(30, 75);
423+
* describe('4 points create the corners of a square');
419424
* </code>
420425
* </div>
421426
*
@@ -427,6 +432,7 @@ p5.prototype.line = function(...args) {
427432
* strokeWeight(10); // Make the points 10 pixels in size
428433
* point(85, 75);
429434
* point(30, 75);
435+
* describe('2 points and 2 large purple points in middle-right of canvas');
430436
* </code>
431437
* </div>
432438
*
@@ -438,13 +444,12 @@ p5.prototype.line = function(...args) {
438444
* point(b);
439445
* point(createVector(20, 10));
440446
* point(createVector(20, 20));
447+
* describe(
448+
* 'four points create vertices of 10x10 pixel square on top-left of canvas'
449+
* );
441450
* </code>
442451
* </div>
443452
*
444-
* @alt
445-
* 4 points centered in the middle-right of the canvas.
446-
* 2 large points and 2 large purple points centered in the middle-right of the canvas.
447-
* Vertices of a square of length 10 pixels towards the top-left of the canvas.
448453
*/
449454

450455
/**
@@ -499,11 +504,10 @@ p5.prototype.point = function(...args) {
499504
* <div>
500505
* <code>
501506
* quad(38, 31, 86, 20, 69, 63, 30, 76);
507+
* describe('irregular white quadrilateral with black outline');
502508
* </code>
503509
* </div>
504510
*
505-
* @alt
506-
*irregular white quadrilateral shape with black outline mid-right of canvas.
507511
*/
508512
/**
509513
* @method quad
@@ -576,13 +580,17 @@ p5.prototype.quad = function(...args) {
576580
* <code>
577581
* // Draw a rectangle at location (30, 20) with a width and height of 55.
578582
* rect(30, 20, 55, 55);
583+
* describe('white rect with black outline in mid-right of canvas');
579584
* </code>
580585
* </div>
581586
*
582587
* <div>
583588
* <code>
584589
* // Draw a rectangle with rounded corners, each having a radius of 20.
585590
* rect(30, 20, 55, 55, 20);
591+
* describe(
592+
* 'white rect with black outline and round edges in mid-right of canvas'
593+
* );
586594
* </code>
587595
* </div>
588596
*
@@ -591,13 +599,10 @@ p5.prototype.quad = function(...args) {
591599
* // Draw a rectangle with rounded corners having the following radii:
592600
* // top-left = 20, top-right = 15, bottom-right = 10, bottom-left = 5.
593601
* rect(30, 20, 55, 55, 20, 15, 10, 5);
602+
* describe('white rect with black outline and round edges of different radii');
594603
* </code>
595604
* </div>
596605
*
597-
* @alt
598-
* 55x55 white rect with black outline in mid-right of canvas.
599-
* 55x55 white rect with black outline and rounded edges in mid-right of canvas.
600-
* 55x55 white rect with black outline and rounded edges of different radii.
601606
*/
602607

603608
/**
@@ -643,13 +648,17 @@ p5.prototype.rect = function() {
643648
* <code>
644649
* // Draw a square at location (30, 20) with a side size of 55.
645650
* square(30, 20, 55);
651+
* describe('white square with black outline in mid-right of canvas');
646652
* </code>
647653
* </div>
648654
*
649655
* <div>
650656
* <code>
651657
* // Draw a square with rounded corners, each having a radius of 20.
652658
* square(30, 20, 55, 20);
659+
* describe(
660+
* 'white square with black outline and round edges in mid-right of canvas'
661+
* );
653662
* </code>
654663
* </div>
655664
*
@@ -658,13 +667,10 @@ p5.prototype.rect = function() {
658667
* // Draw a square with rounded corners having the following radii:
659668
* // top-left = 20, top-right = 15, bottom-right = 10, bottom-left = 5.
660669
* square(30, 20, 55, 20, 15, 10, 5);
670+
* describe('white square with black outline and round edges of different radii');
661671
* </code>
662672
* </div>
663673
*
664-
* @alt
665-
* 55x55 white square with black outline in mid-right of canvas.
666-
* 55x55 white square with black outline and rounded edges in mid-right of canvas.
667-
* 55x55 white square with black outline and rounded edges of different radii.
668674
*/
669675
p5.prototype.square = function(x, y, s, tl, tr, br, bl) {
670676
p5._validateParameters('square', arguments);
@@ -722,11 +728,10 @@ p5.prototype._renderRect = function() {
722728
* <div>
723729
* <code>
724730
* triangle(30, 75, 58, 20, 86, 75);
731+
* describe('white triangle with black outline in mid-right of canvas');
725732
* </code>
726733
* </div>
727734
*
728-
*@alt
729-
* white triangle with black outline in mid-right of canvas.
730735
*/
731736
p5.prototype.triangle = function(...args) {
732737
p5._validateParameters('triangle', args);

0 commit comments

Comments
 (0)