@@ -439,6 +439,11 @@ function setting(p5, fn){
439
439
* in RGB values. Calling `background(255, 204, 0)` sets the background a bright
440
440
* yellow color.
441
441
*
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
+ *
442
447
* @method background
443
448
* @param {p5.Color } color any value created by the <a href="#/p5/color">color()</a> function
444
449
* @chainable
@@ -487,6 +492,19 @@ function setting(p5, fn){
487
492
* function setup() {
488
493
* createCanvas(100, 100);
489
494
*
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
+ *
490
508
* // Use HSB color.
491
509
* colorMode(HSB);
492
510
*
@@ -1213,6 +1231,10 @@ function setting(p5, fn){
1213
1231
* <a href="#/p5/colorMode">colorMode()</a>. The default color space is RGB,
1214
1232
* with each value in the range from 0 to 255.
1215
1233
*
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
+ *
1216
1238
* @method fill
1217
1239
* @param {Number } v1 red value if color mode is RGB or hue value if color mode is HSB.
1218
1240
* @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){
1257
1279
* function setup() {
1258
1280
* createCanvas(100, 100);
1259
1281
*
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
+ *
1260
1298
* background(100);
1261
1299
*
1262
1300
* // Use HSB color.
@@ -1551,7 +1589,7 @@ function setting(p5, fn){
1551
1589
* Sets the color used to draw points, lines, and the outlines of shapes.
1552
1590
*
1553
1591
* 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
1555
1593
* these parameters are interpreted may be changed with the
1556
1594
* <a href="#/p5/colorMode">colorMode()</a> function.
1557
1595
*
0 commit comments