Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/color/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,19 @@ p5.prototype.clip = function(callback, options) {
* function setup() {
* createCanvas(100, 100);
*
* // R, G, B, and Alpha values.
* background(255, 0, 0, 128);
*
* describe('A canvas with a semi-transparent red background.');
* }
* </code>
* </div>
*
* <div>
* <code>
* function setup() {
* createCanvas(100, 100);
*
* // Use HSB color.
* colorMode(HSB);
*
Expand Down Expand Up @@ -1040,6 +1053,22 @@ p5.prototype.colorMode = function(mode, max1, max2, max3, maxA) {
* function setup() {
* createCanvas(100, 100);
*
* background(200);
*
* // R, G, B, and Alpha values.
* fill(255, 0, 0, 128);
* square(20, 20, 60);
*
* describe('A semi-transparent red square with a black outline.');
* }
* </code>
* </div>
*
* <div>
* <code>
* function setup() {
* createCanvas(100, 100);
*
* background(100);
*
* // Use HSB color.
Expand Down
3 changes: 1 addition & 2 deletions src/core/shape/2d_primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ p5.prototype._normalizeArcAngles = (
* The fifth and sixth parameters, `start` and `stop`, set the angles
* between which to draw the arc. Arcs are always drawn clockwise from
* `start` to `stop`. The fifth and sixth parameters, start and stop, set the
* angles between which to draw the arc. Arcs are always drawn clockwise from
* start to stop. By default, angles are given in radians, but if angleMode
* angles between which to draw the arc. By default, angles are given in radians, but if angleMode
* (DEGREES) is set, the function interprets the values in degrees.
*
* The seventh parameter, `mode`, is optional. It determines the arc's fill
Expand Down
51 changes: 41 additions & 10 deletions src/core/shape/vertex.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ let isFirstContour = true;
* </code>
* </div>
*/
p5.prototype.beginContour = function() {
p5.prototype.beginContour = function () {
if (this._renderer.isP3D) {
this._renderer.beginContour();
} else {
Expand Down Expand Up @@ -515,7 +515,7 @@ p5.prototype.beginContour = function() {
* </code>
* </div>
*/
p5.prototype.beginShape = function(kind) {
p5.prototype.beginShape = function (kind) {
p5._validateParameters('beginShape', arguments);
if (this._renderer.isP3D) {
this._renderer.beginShape(...arguments);
Expand Down Expand Up @@ -802,7 +802,7 @@ p5.prototype.beginShape = function(kind) {
* @param {Number} z4 z-coordinate of the anchor point.
* @chainable
*/
p5.prototype.bezierVertex = function(...args) {
p5.prototype.bezierVertex = function (...args) {
p5._validateParameters('bezierVertex', args);
if (this._renderer.isP3D) {
this._renderer.bezierVertex(...args);
Expand Down Expand Up @@ -1210,7 +1210,7 @@ p5.prototype.bezierVertex = function(...args) {
* </code>
* </div>
*/
p5.prototype.curveVertex = function(...args) {
p5.prototype.curveVertex = function (...args) {
p5._validateParameters('curveVertex', args);
if (this._renderer.isP3D) {
this._renderer.curveVertex(...args);
Expand Down Expand Up @@ -1319,7 +1319,7 @@ p5.prototype.curveVertex = function(...args) {
* </code>
* </div>
*/
p5.prototype.endContour = function() {
p5.prototype.endContour = function () {
if (this._renderer.isP3D) {
return this;
}
Expand All @@ -1342,7 +1342,7 @@ p5.prototype.endContour = function() {
};

/**
* Begins adding vertices to a custom shape.
* Completes the custom shape defined with vertex() calls, and optionally closes it if CLOSE is passed.
*
* The <a href="#/p5/beginShape">beginShape()</a> and `endShape()` functions
* allow for creating custom shapes in 2D or 3D.
Expand Down Expand Up @@ -1417,6 +1417,37 @@ p5.prototype.endContour = function() {
*
* <div>
* <code>
* function setup() {
* createCanvas(200, 100);
*
* background(240);
*
* noFill();
* stroke(0);
*
* // Open shape (left)
* beginShape();
* vertex(20, 20);
* vertex(80, 20);
* vertex(80, 80);
* endShape(); // Not closed
*
* // Closed shape (right)
* beginShape();
* vertex(120, 20);
* vertex(180, 20);
* vertex(180, 80);
* endShape(CLOSE); // Closed
*
* describe(
* '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.'
* );
* }
* </code>
* </div>
*
* <div>
* <code>
* // Note: A "uniform" is a global variable within a shader program.
*
* // Create a string with the vertex shader program.
Expand Down Expand Up @@ -1504,7 +1535,7 @@ p5.prototype.endContour = function() {
* </code>
* </div>
*/
p5.prototype.endShape = function(mode, count = 1) {
p5.prototype.endShape = function (mode, count = 1) {
p5._validateParameters('endShape', arguments);
if (count < 1) {
console.log('🌸 p5.js says: You can not have less than one instance');
Expand Down Expand Up @@ -1807,7 +1838,7 @@ p5.prototype.endShape = function(mode, count = 1) {
* @param {Number} y3
* @param {Number} z3 z-coordinate of the anchor point.
*/
p5.prototype.quadraticVertex = function(...args) {
p5.prototype.quadraticVertex = function (...args) {
p5._validateParameters('quadraticVertex', args);
if (this._renderer.isP3D) {
this._renderer.quadraticVertex(...args);
Expand Down Expand Up @@ -2034,7 +2065,7 @@ p5.prototype.quadraticVertex = function(...args) {
* @param {Number} [v] v-coordinate of the vertex's texture. Defaults to 0.
* @chainable
*/
p5.prototype.vertex = function(x, y, moveTo, u, v) {
p5.prototype.vertex = function (x, y, moveTo, u, v) {
if (this._renderer.isP3D) {
this._renderer.vertex(...arguments);
} else {
Expand Down Expand Up @@ -2245,7 +2276,7 @@ p5.prototype.vertex = function(x, y, moveTo, u, v) {
* @param {Number} z z-component of the vertex normal.
* @chainable
*/
p5.prototype.normal = function(x, y, z) {
p5.prototype.normal = function (x, y, z) {
this._assert3d('normal');
p5._validateParameters('normal', arguments);
this._renderer.normal(...arguments);
Expand Down
4 changes: 2 additions & 2 deletions src/core/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ p5.prototype.shearX = function(angle) {
* function draw() {
* background(200);
*
* // Shear the coordinate system along the x-axis.
* // Shear the coordinate system along the y-axis.
* shearY(QUARTER_PI);
*
* // Draw the square.
Expand All @@ -1204,7 +1204,7 @@ p5.prototype.shearX = function(angle) {
* function draw() {
* background(200);
*
* // Shear the coordinate system along the x-axis.
* // Shear the coordinate system along the y-axis.
* shearY(45);
*
* // Draw the square.
Expand Down