Skip to content

Commit fc8ca8a

Browse files
authored
Merge pull request #8086 from Nitin2332/reference-fix-2.0
reference-fix-2.0
2 parents 752a7fe + 4e82bf3 commit fc8ca8a

File tree

3 files changed

+72
-3
lines changed

3 files changed

+72
-3
lines changed

src/color/setting.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ function setting(p5, fn){
439439
* in RGB values. Calling `background(255, 204, 0)` sets the background a bright
440440
* yellow color.
441441
*
442+
* The version of `background()` with four parameters interprets them as RGBA,
443+
* HSBA, or HSLA colors, depending on the current
444+
* <a href="#/p5/colorMode">colorMode()</a>. The last parameter sets the alpha
445+
* (transparency) value.
446+
*
442447
* @method background
443448
* @param {p5.Color} color any value created by the <a href="#/p5/color">color()</a> function
444449
* @chainable
@@ -487,6 +492,19 @@ function setting(p5, fn){
487492
* function setup() {
488493
* createCanvas(100, 100);
489494
*
495+
* // R, G, B, and Alpha values.
496+
* background(255, 0, 0, 128);
497+
*
498+
* describe('A canvas with a semi-transparent red background.');
499+
* }
500+
* </code>
501+
* </div>
502+
*
503+
* <div>
504+
* <code>
505+
* function setup() {
506+
* createCanvas(100, 100);
507+
*
490508
* // Use HSB color.
491509
* colorMode(HSB);
492510
*
@@ -1213,6 +1231,10 @@ function setting(p5, fn){
12131231
* <a href="#/p5/colorMode">colorMode()</a>. The default color space is RGB,
12141232
* with each value in the range from 0 to 255.
12151233
*
1234+
* The version of `fill()` with four parameters interprets them as `RGBA`, `HSBA`,
1235+
* or `HSLA` colors, depending on the current <a href="#/p5/colorMode">colorMode()</a>. The last parameter
1236+
* sets the alpha (transparency) value.
1237+
*
12161238
* @method fill
12171239
* @param {Number} v1 red value if color mode is RGB or hue value if color mode is HSB.
12181240
* @param {Number} v2 green value if color mode is RGB or saturation value if color mode is HSB.
@@ -1257,6 +1279,22 @@ function setting(p5, fn){
12571279
* function setup() {
12581280
* createCanvas(100, 100);
12591281
*
1282+
* background(200);
1283+
*
1284+
* // R, G, B, and Alpha values.
1285+
* fill(255, 0, 0, 128);
1286+
* square(20, 20, 60);
1287+
*
1288+
* describe('A semi-transparent red square with a black outline.');
1289+
* }
1290+
* </code>
1291+
* </div>
1292+
*
1293+
* <div>
1294+
* <code>
1295+
* function setup() {
1296+
* createCanvas(100, 100);
1297+
*
12601298
* background(100);
12611299
*
12621300
* // Use HSB color.
@@ -1551,7 +1589,7 @@ function setting(p5, fn){
15511589
* Sets the color used to draw points, lines, and the outlines of shapes.
15521590
*
15531591
* Calling `stroke(255, 165, 0)` or `stroke('orange')` means all shapes drawn
1554-
* after calling `stroke()` will be filled with the color orange. The way
1592+
* after calling `stroke()` will be outlined with the color orange. The way
15551593
* these parameters are interpreted may be changed with the
15561594
* <a href="#/p5/colorMode">colorMode()</a> function.
15571595
*

src/core/transform.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ function transform(p5, fn){
11801180
* function draw() {
11811181
* background(200);
11821182
*
1183-
* // Shear the coordinate system along the x-axis.
1183+
* // Shear the coordinate system along the y-axis.
11841184
* shearY(QUARTER_PI);
11851185
*
11861186
* // Draw the square.
@@ -1203,7 +1203,7 @@ function transform(p5, fn){
12031203
* function draw() {
12041204
* background(200);
12051205
*
1206-
* // Shear the coordinate system along the x-axis.
1206+
* // Shear the coordinate system along the y-axis.
12071207
* shearY(45);
12081208
*
12091209
* // Draw the square.

src/shape/vertex.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,37 @@ function vertex(p5, fn){
763763
* <div>
764764
* <code>
765765
* function setup() {
766+
* createCanvas(200, 100);
767+
*
768+
* background(240);
769+
*
770+
* noFill();
771+
* stroke(0);
772+
*
773+
* // Open shape (left)
774+
* beginShape();
775+
* vertex(20, 20);
776+
* vertex(80, 20);
777+
* vertex(80, 80);
778+
* endShape(); // Not closed
779+
*
780+
* // Closed shape (right)
781+
* beginShape();
782+
* vertex(120, 20);
783+
* vertex(180, 20);
784+
* vertex(180, 80);
785+
* endShape(CLOSE); // Closed
786+
*
787+
* describe(
788+
* 'Two right-angled shapes on a light gray background. The left shape is open with three lines. The right shape is closed, forming a triangle.'
789+
* );
790+
* }
791+
* </code>
792+
* </div>
793+
*
794+
* <div>
795+
* <code>
796+
* function setup() {
766797
* createCanvas(100, 100);
767798
* background(200);
768799
*

0 commit comments

Comments
 (0)