diff --git a/src/color/p5.Color.js b/src/color/p5.Color.js index 6eda86a0c1..e5eaa3056a 100644 --- a/src/color/p5.Color.js +++ b/src/color/p5.Color.js @@ -12,7 +12,7 @@ import * as constants from '../core/constants'; import color_conversion from './color_conversion'; /** - * Each color stores the color mode and level maxes that was applied at the + * Each color stores the color mode and level maxes that were applied at the * time of its construction. These are used to interpret the input arguments * (at construction and later for that instance of color) and to format the * output e.g. when saturation() is requested. @@ -21,7 +21,7 @@ import color_conversion from './color_conversion'; * point form, normalized from 0 to 1. From this we calculate the closest * screen color (RGBA levels from 0 to 255) and expose this to the renderer. * - * We also cache normalized, floating point components of the color in various + * We also cache normalized, floating-point components of the color in various * representations as they are calculated. This is done to prevent repeating a * conversion that has already been performed. * @@ -49,7 +49,7 @@ p5.Color = function(pInst, vals) { }; /** - * This function returns the color formatted as a string. This can be useful + * This method returns the color formatted as a string. This can be useful * for debugging, or for using p5.js with other libraries. * * @method toString @@ -254,7 +254,7 @@ p5.Color.prototype.toString = function(format) { }; /** - * The setRed function sets the red component of a color. + * The setRed method sets the red component of a color. * The range depends on your color mode, in the default RGB mode it's between 0 and 255. * @method setRed * @param {Number} red the new red value @@ -283,7 +283,7 @@ p5.Color.prototype.setRed = function(new_red) { }; /** - * The setGreen function sets the green component of a color. + * The setGreen method sets the green component of a color. * The range depends on your color mode, in the default RGB mode it's between 0 and 255. * @method setGreen * @param {Number} green the new green value @@ -307,7 +307,7 @@ p5.Color.prototype.setGreen = function(new_green) { }; /** - * The setBlue function sets the blue component of a color. + * The setBlue method sets the blue component of a color. * The range depends on your color mode, in the default RGB mode it's between 0 and 255. * @method setBlue * @param {Number} blue the new blue value @@ -331,7 +331,7 @@ p5.Color.prototype.setBlue = function(new_blue) { }; /** - * The setAlpha function sets the transparency (alpha) value of a color. + * The setAlpha method sets the transparency (alpha) value of a color. * The range depends on your color mode, in the default RGB mode it's between 0 and 255. * @method setAlpha * @param {Number} alpha the new alpha value diff --git a/src/color/setting.js b/src/color/setting.js index 604df5f897..5e9f95932f 100644 --- a/src/color/setting.js +++ b/src/color/setting.js @@ -356,7 +356,7 @@ p5.prototype.colorMode = function(mode, max1, max2, max3, maxA) { * and all named color strings are supported. In this case, an alpha number * value as a second argument is not supported, the RGBA form should be used. * - * A p5 Color object can also be provided to set the fill color. + * A p5.Color object can also be provided to set the fill color. * * @method fill * @param {Number} v1 red or hue value relative to @@ -596,7 +596,7 @@ p5.prototype.noStroke = function() { * number value as a second argument is not supported, the RGBA form should be * used. * - * A p5 Color object can also be provided to set the stroke color. + * A p5.Color object can also be provided to set the stroke color. * * @method stroke * @param {Number} v1 red or hue value relative to diff --git a/src/core/constants.js b/src/core/constants.js index a872802c78..49d4f48342 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -154,8 +154,8 @@ export const TAU = _PI * 2; */ export const TWO_PI = _PI * 2; /** - * Constant to be used with angleMode() function, to set the mode which - * p5.js interprets and calculates angles (either DEGREES or RADIANS). + * Constant to be used with the angleMode() function, to set the mode in + * which p5.js interprets and calculates angles (either DEGREES or RADIANS). * @property {String} DEGREES * @final * @@ -168,8 +168,8 @@ export const TWO_PI = _PI * 2; */ export const DEGREES = 'degrees'; /** - * Constant to be used with angleMode() function, to set the mode which - * p5.js interprets and calculates angles (either RADIANS or DEGREES). + * Constant to be used with the angleMode() function, to set the mode + * in which p5.js interprets and calculates angles (either RADIANS or DEGREES). * @property {String} RADIANS * @final * diff --git a/src/core/environment.js b/src/core/environment.js index 0268fa24f3..98c9140dde 100644 --- a/src/core/environment.js +++ b/src/core/environment.js @@ -53,7 +53,7 @@ p5.prototype.print = function(...args) { * The system variable frameCount contains the * number of frames that have been displayed since the program started. Inside * setup() the value is 0, after the first iteration - * of draw it is 1, etc. + * of draw() it is 1, etc. * * @property {Integer} frameCount * @readOnly @@ -241,7 +241,7 @@ p5.prototype.cursor = function(type, x, y) { * return a value. This is the same as getFrameRate(). * * Calling frameRate() with arguments that are not - * of the type numbers or are non positive also returns current framerate. + * of the type Number or are non-positive also returns current framerate. * * @method frameRate * @param {Number} fps number of frames to be displayed every second @@ -262,7 +262,7 @@ p5.prototype.cursor = function(type, x, y) { * * function draw() { * background(200); - * rectX = rectX += 1; // Move Rectangle + * rectX += 1; // Move Rectangle * * if (rectX >= width) { // If you go off screen. diff --git a/src/core/p5.Element.js b/src/core/p5.Element.js index 92432e1a39..a6cf66975d 100644 --- a/src/core/p5.Element.js +++ b/src/core/p5.Element.js @@ -9,8 +9,8 @@ import p5 from './main'; /** * Base class for all elements added to a sketch, including canvas, * graphics buffers, and other HTML elements. It is not called directly, but p5.Element - * objects are created by calling createCanvas, createGraphics, - * createDiv, createImg, createInput, etc. + * objects are created by calling createCanvas(), createGraphics(), + * createDiv(), createImg(), createInput(), etc. * * @class p5.Element * @constructor @@ -48,7 +48,7 @@ p5.Element = function(elt, pInst) { * * Attaches the element to the parent specified. A way of setting * the container for the element. Accepts either a string ID, DOM - * node, or p5.Element. If no arguments given, parent node is returned. + * node, or p5.Element. If no arguments are given, parent node is returned. * For more ways to position the canvas, see the * * positioning the canvas wiki page. @@ -116,7 +116,7 @@ p5.Element.prototype.parent = function(p) { * Sets the ID of the element. If no ID argument is passed in, it instead * returns the current ID of the element. * Note that only one element can have a particular id in a page. - * The .class() function can be used + * The class() method can be used * to identify multiple elements with the same class name. * * @method id @@ -187,10 +187,10 @@ p5.Element.prototype.class = function(c) { }; /** - * The .mousePressed() function is called + * The mousePressed() method is called * once after every time a mouse button is pressed over the element. Some mobile * browsers may also trigger this event on a touch screen, if the user performs - * a quick tap. This can be used to attach element specific event listeners. + * a quick tap. This can be used to attach element-specific event listeners. * * @method mousePressed * @param {Function|Boolean} fxn function to be fired when mouse is @@ -244,9 +244,9 @@ p5.Element.prototype.mousePressed = function(fxn) { }; /** - * The .doubleClicked() function is called once after every time a + * The doubleClicked() method is called once after every time a * mouse button is pressed twice over the element. This can be used to - * attach element and action specific event listeners. + * attach element and action-specific event listeners. * * @method doubleClicked * @param {Function|Boolean} fxn function to be fired when mouse is @@ -290,18 +290,18 @@ p5.Element.prototype.doubleClicked = function(fxn) { }; /** - * The mouseWheel() function is called + * The mouseWheel() method is called * once after every time a mouse wheel is scrolled over the element. This can - * be used to attach element specific event listeners. + * be used to attach element-specific event listeners. * - * The function accepts a callback function as argument which will be executed + * The method accepts a callback function as argument which will be executed * when the `wheel` event is triggered on the element, the callback function is * passed one argument `event`. The `event.deltaY` property returns negative * values if the mouse wheel is rotated up or away from the user and positive * in the other direction. The `event.deltaX` does the same as `event.deltaY` * except it reads the horizontal wheel scroll of the mouse wheel. * - * On OS X with "natural" scrolling enabled, the `event.deltaY` values are + * On macOS with "natural" scrolling enabled, the `event.deltaY` values are * reversed. * * @method mouseWheel @@ -352,10 +352,10 @@ p5.Element.prototype.mouseWheel = function(fxn) { }; /** - * The mouseReleased() function is + * The mouseReleased() method is * called once after every time a mouse button is released over the element. * Some mobile browsers may also trigger this event on a touch screen, if the - * user performs a quick tap. This can be used to attach element specific event listeners. + * user performs a quick tap. This can be used to attach element-specific event listeners. * * @method mouseReleased * @param {Function|Boolean} fxn function to be fired when mouse is @@ -401,10 +401,10 @@ p5.Element.prototype.mouseReleased = function(fxn) { }; /** - * The .mouseClicked() function is + * The mouseClicked() method is * called once after a mouse button is pressed and released over the element. * Some mobile browsers may also trigger this event on a touch screen, if the - * user performs a quick tap.This can be used to attach element specific event listeners. + * user performs a quick tap. This can be used to attach element-specific event listeners. * * @method mouseClicked * @param {Function|Boolean} fxn function to be fired when mouse is @@ -452,9 +452,9 @@ p5.Element.prototype.mouseClicked = function(fxn) { }; /** - * The .mouseMoved() function is called once every time a + * The mouseMoved() method is called once every time a * mouse moves over the element. This can be used to attach an - * element specific event listener. + * element-specific event listener. * * @method mouseMoved * @param {Function|Boolean} fxn function to be fired when a mouse moves @@ -508,9 +508,9 @@ p5.Element.prototype.mouseMoved = function(fxn) { }; /** - * The .mouseOver() function is called once after every time a + * The mouseOver() method is called once after every time a * mouse moves onto the element. This can be used to attach an - * element specific event listener. + * element-specific event listener. * * @method mouseOver * @param {Function|Boolean} fxn function to be fired when a mouse moves @@ -549,9 +549,9 @@ p5.Element.prototype.mouseOver = function(fxn) { }; /** - * The .mouseOut() function is called once after every time a + * The mouseOut() method is called once after every time a * mouse moves off the element. This can be used to attach an - * element specific event listener. + * element-specific event listener. * * @method mouseOut * @param {Function|Boolean} fxn function to be fired when a mouse @@ -590,8 +590,8 @@ p5.Element.prototype.mouseOut = function(fxn) { }; /** - * The .touchStarted() function is called once after every time a touch is - * registered. This can be used to attach element specific event listeners. + * The touchStarted() method is called once after every time a touch is + * registered. This can be used to attach element-specific event listeners. * * @method touchStarted * @param {Function|Boolean} fxn function to be fired when a touch @@ -637,8 +637,8 @@ p5.Element.prototype.touchStarted = function(fxn) { }; /** - * The .touchMoved() function is called once after every time a touch move is - * registered. This can be used to attach element specific event listeners. + * The touchMoved() method is called once after every time a touch move is + * registered. This can be used to attach element-specific event listeners. * * @method touchMoved * @param {Function|Boolean} fxn function to be fired when a touch moves over @@ -676,8 +676,8 @@ p5.Element.prototype.touchMoved = function(fxn) { }; /** - * The .touchEnded() function is called once after every time a touch is - * registered. This can be used to attach element specific event listeners. + * The touchEnded() method is called once after every time a touch is + * registered. This can be used to attach element-specific event listeners. * * @method touchEnded * @param {Function|Boolean} fxn function to be fired when a touch ends @@ -723,9 +723,9 @@ p5.Element.prototype.touchEnded = function(fxn) { }; /** - * The .dragOver() function is called once after every time a + * The dragOver() method is called once after every time a * file is dragged over the element. This can be used to attach an - * element specific event listener. + * element-specific event listener. * * @method dragOver * @param {Function|Boolean} fxn function to be fired when a file is @@ -761,9 +761,9 @@ p5.Element.prototype.dragOver = function(fxn) { }; /** - * The .dragLeave() function is called once after every time a + * The dragLeave() method is called once after every time a * dragged file leaves the element area. This can be used to attach an - * element specific event listener. + * element-specific event listener. * * @method dragLeave * @param {Function|Boolean} fxn function to be fired when a file is diff --git a/src/core/rendering.js b/src/core/rendering.js index 771b55d5d1..c2526ad726 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -13,11 +13,11 @@ let defaultId = 'defaultCanvas0'; // this gets set again in createCanvas const defaultClass = 'p5Canvas'; /** - * Creates a canvas element in the document, and sets the dimensions of it - * in pixels. This method should be called only once at the start of setup. + * Creates a canvas element in the document and sets its dimensions + * in pixels. This method should be called only once at the start of setup(). * Calling createCanvas more than once in a * sketch will result in very unpredictable behavior. If you want more than - * one drawing canvas you could use createGraphics + * one drawing canvas you could use createGraphics() * (hidden by default but it can be shown). * * Important note: in 2D mode (i.e. when `p5.Renderer` is not set) the origin (0,0) @@ -37,7 +37,7 @@ const defaultClass = 'p5Canvas'; * @param {Number} w width of the canvas * @param {Number} h height of the canvas * @param {Constant} [renderer] either P2D or WEBGL - * @return {p5.Renderer} + * @return {p5.Renderer} pointer to p5.Renderer holding canvas * @example *
* diff --git a/src/core/shape/2d_primitives.js b/src/core/shape/2d_primitives.js index 68b9a1e9ef..cfa6c24526 100644 --- a/src/core/shape/2d_primitives.js +++ b/src/core/shape/2d_primitives.js @@ -240,8 +240,8 @@ p5.prototype.arc = function(x, y, w, h, start, stop, mode, detail) { * with the ellipseMode() function. * * @method ellipse - * @param {Number} x x-coordinate of the center of ellipse. - * @param {Number} y y-coordinate of the center of ellipse. + * @param {Number} x x-coordinate of the center of the ellipse. + * @param {Number} y y-coordinate of the center of the ellipse. * @param {Number} w width of the ellipse. * @param {Number} [h] height of the ellipse. * @chainable @@ -262,7 +262,7 @@ p5.prototype.arc = function(x, y, w, h, start, stop, mode, detail) { * @param {Number} y * @param {Number} w * @param {Number} h - * @param {Integer} [detail] optional parameter for WebGL mode only. This is to + * @param {Integer} [detail] optional parameter for WEBGL mode only. This is to * specify the number of vertices that makes up the * perimeter of the ellipse. Default value is 25. Won't * draw a stroke for a detail of more than 50. @@ -275,15 +275,16 @@ p5.prototype.ellipse = function(x, y, w, h, detailX) { /** * Draws a circle to the screen. A circle is a simple closed shape. It is the set * of all points in a plane that are at a given distance from a given point, - * the centre. This function is a special case of the ellipse() function, where - * the width and height of the ellipse are the same. Height and width of the - * ellipse correspond to the diameter of the circle. By default, the first two - * parameters set the location of the centre of the circle, the third sets the - * diameter of the circle. + * the center. This function is a special case of the + * ellipse() function, where the width and height + * of the ellipse are the same. Height and width of the ellipse correspond to + * the diameter of the circle. By default, the first two parameters set the + * location of the center of the circle, the third sets the diameter of the + * circle. * * @method circle - * @param {Number} x x-coordinate of the centre of the circle. - * @param {Number} y y-coordinate of the centre of the circle. + * @param {Number} x x-coordinate of the center of the circle. + * @param {Number} y y-coordinate of the center of the circle. * @param {Number} d diameter of the circle. * @chainable * @example @@ -476,7 +477,7 @@ p5.prototype.point = function(...args) { }; /** - * Draws a quad on the canvas. A quad is a quadrilateral, a four sided polygon. It is + * Draws a quad on the canvas. A quad is a quadrilateral, a four-sided polygon. It is * similar to a rectangle, but the angles between its edges are not * constrained to ninety degrees. The first pair of parameters (x1,y1) * sets the first vertex and the subsequent pairs should proceed @@ -553,7 +554,7 @@ p5.prototype.quad = function(...args) { * Draws a rectangle on the canvas. A rectangle is a four-sided closed shape with * every angle at ninety degrees. By default, the first two parameters set * the location of the upper-left corner, the third sets the width, and the - * fourth sets the height. The way these parameters are interpreted, may be + * fourth sets the height. The way these parameters are interpreted may be * changed with the rectMode() function. * * The fifth, sixth, seventh and eighth parameters, if specified, diff --git a/src/core/shape/attributes.js b/src/core/shape/attributes.js index e65352d500..bf23b9c58e 100644 --- a/src/core/shape/attributes.js +++ b/src/core/shape/attributes.js @@ -123,7 +123,7 @@ p5.prototype.noSmooth = function() { * rectMode(CORNERS) interprets the first two parameters as the location of * one of the corners, and the third and fourth parameters as the location of * the diagonally opposite corner. Note, the rectangle is drawn between the - * coordinates, so it is not neccesary that the first corner be the upper left + * coordinates, so it is not necessary that the first corner be the upper left * corner. * * rectMode(CENTER) interprets the first two parameters as the shape's center diff --git a/src/core/shape/vertex.js b/src/core/shape/vertex.js index cd3484f3b4..2afb78f880 100644 --- a/src/core/shape/vertex.js +++ b/src/core/shape/vertex.js @@ -89,12 +89,12 @@ p5.prototype.beginContour = function() { * Draw a series of connected triangles in strip fashion * * QUADS - * Draw a series of separate quad + * Draw a series of separate quads * * QUAD_STRIP * Draw quad strip using adjacent edges to form the next quad * - * TESS (WebGl only) + * TESS (WEBGL only) * Handle irregular polygon for filling curve by explicit tessellation * * After calling the beginShape() function, a series of vertex() commands must follow. To stop @@ -582,9 +582,9 @@ p5.prototype.endContour = function() { /** * The endShape() function is the companion to beginShape() and may only be - * called after beginShape(). When endShape() is called, all of image data - * defined since the previous call to beginShape() is written into the image - * buffer. The constant CLOSE as the value for the MODE parameter to close + * called after beginShape(). When endShape() is called, all of the image + * data defined since the previous call to beginShape() is written into the image + * buffer. The constant CLOSE as the value for the `mode` parameter to close * the shape (to connect the beginning and the end). * * @method endShape diff --git a/src/core/structure.js b/src/core/structure.js index b01dc9e94e..d64afaeb92 100644 --- a/src/core/structure.js +++ b/src/core/structure.js @@ -28,7 +28,7 @@ import p5 from './main'; * has been specified. Otherwise, the sketch would enter an odd state until * loop() was called. * - * Use isLooping() to check current state of loop(). + * Use isLooping() to check the current state of loop(). * * @method noLoop * @example @@ -88,7 +88,7 @@ p5.prototype.noLoop = function() { * * Avoid calling loop() from inside setup(). * - * Use isLooping() to check current state of loop(). + * Use isLooping() to check the current state of loop(). * * @method loop * @example diff --git a/src/core/transform.js b/src/core/transform.js index 1fe637e5d9..f92b253b87 100644 --- a/src/core/transform.js +++ b/src/core/transform.js @@ -198,13 +198,13 @@ p5.prototype.resetMatrix = function() { * Objects are always rotated around their relative position to the * origin and positive numbers rotate objects in a clockwise direction. * Transformations apply to everything that happens after and subsequent - * calls to the function accumulates the effect. For example, calling + * calls to the function accumulate the effect. For example, calling * rotate(HALF_PI) and then rotate(HALF_PI) is the same as rotate(PI). * All transformations are reset when draw() begins again. * * Technically, rotate() multiplies the current transformation matrix * by a rotation matrix. This function can be further controlled by - * the push() and pop(). + * push() and pop(). * * @method rotate * @param {Number} angle the angle of rotation, specified in radians @@ -506,7 +506,7 @@ p5.prototype.shearY = function(angle) { * @method translate * @param {Number} x left/right translation * @param {Number} y up/down translation - * @param {Number} [z] forward/backward translation (webgl only) + * @param {Number} [z] forward/backward translation (WEBGL only) * @chainable * @example *
diff --git a/src/dom/dom.js b/src/dom/dom.js index a845db2203..01e0d5b2e8 100644 --- a/src/dom/dom.js +++ b/src/dom/dom.js @@ -458,7 +458,7 @@ p5.prototype.createA = function(href, html, target) { * @param {Number} max maximum value of the slider * @param {Number} [value] default value of the slider * @param {Number} [step] step size for each tick of the slider (if step is set to 0, the slider will move continuously from the minimum to the maximum value) - * @return {p5.Element} pointer to p5.Element holding created node + * @return {p5.Element} pointer to p5.Element holding the created node * @example *
* let slider; @@ -540,7 +540,8 @@ p5.prototype.createButton = function(label, value) { /** * Creates a checkbox `<input></input>` element in the DOM. - * Calling .checked() on a checkbox returns if it is checked or not + * Calling .checked() on a checkbox returns a boolean indicating whether + * it is checked or not. * * @method createCheckbox * @param {String} [label] label displayed after checkbox @@ -624,14 +625,14 @@ p5.prototype.createCheckbox = function() { * It also helps to assign select-box methods to p5.Element when selecting existing select box. * - `.option(name, [value])` can be used to set options for the select after it is created. * - `.value()` will return the currently selected option. - * - `.selected()` will return current dropdown element which is an instance of p5.Element + * - `.selected()` will return the current dropdown element which is an instance of p5.Element. * - `.selected(value)` can be used to make given option selected by default when the page first loads. - * - `.disable()` marks whole of dropdown element as disabled. - * - `.disable(value)` marks given option as disabled + * - `.disable()` marks the whole dropdown element as disabled. + * - `.disable(value)` marks a given option as disabled. * * @method createSelect * @param {boolean} [multiple] true if dropdown should support multiple selections - * @return {p5.Element} + * @return {p5.Element} pointer to p5.Element holding created node * @example *
* let sel; @@ -768,7 +769,7 @@ p5.prototype.createSelect = function() { }; /** - * Creates a radio button element in the DOM.It also helps existing radio buttons + * Creates a radio button element in the DOM. It also helps existing radio buttons * assign methods of p5.Element. * - `.option(value, [label])` can be used to create a new option for the * element. If an option with a value already exists, it will be returned. @@ -780,8 +781,8 @@ p5.prototype.createSelect = function() { * - `.disable(Boolean)` method will enable/disable the whole radio button element. * * @method createRadio - * @param {Object} containerElement An container HTML Element either a div - * or span inside which all existing radio inputs will be considered as options. + * @param {Object} containerElement A container HTML Element, either a div + * or span, inside which all existing radio inputs will be considered as options. * @param {string} [name] A name parameter for each Input Element. * @return {p5.Element} pointer to p5.Element holding created node * @example @@ -974,7 +975,8 @@ p5.prototype.createRadio = function() { /** * Creates a colorPicker element in the DOM for color input. * The .value() method will return a hex string (#rrggbb) of the color. - * The .color() method will return a p5.Color object with the current chosen color. + * The .color() method will return a p5.Color + * object with the current chosen color. * * @method createColorPicker * @param {String|p5.Color} [value] default color of element @@ -1555,7 +1557,7 @@ p5.Element.prototype.removeClass = function(c) { /** * - * Checks if specified class already set to element + * Checks if specified class is already applied to element. * * @method hasClass * @returns {boolean} a boolean value if element has specified class @@ -1584,7 +1586,7 @@ p5.Element.prototype.hasClass = function(c) { /** * - * Toggles element class + * Toggles element class. * * @method toggleClass * @param c {String} class name to toggle @@ -1669,10 +1671,10 @@ p5.Element.prototype.child = function(childNode) { }; /** - * Centers a p5 Element either vertically, horizontally, + * Centers a p5.Element either vertically, horizontally, * or both, relative to its parent or according to - * the body if the Element has no parent. If no argument is passed - * the Element is aligned both vertically and horizontally. + * the body if the p5.Element has no parent. If no argument is passed + * the p5.Element is aligned both vertically and horizontally. * * @method center * @param {String} [align] passing 'vertical', 'horizontal' aligns element accordingly @@ -1722,8 +1724,8 @@ p5.Element.prototype.center = function(align) { /** * * If an argument is given, sets the inner HTML of the element, - * replacing any existing html. If true is included as a second - * argument, html is appended instead of replacing existing html. + * replacing any existing HTML. If true is included as a second + * argument, HTML is appended instead of replacing existing HTML. * If no arguments are given, returns * the inner HTML of the element. * @@ -1764,7 +1766,7 @@ p5.Element.prototype.html = function() { * position will be relative to (0, 0) of the window. * Essentially, this sets position:absolute and left and top * properties of style. If an optional third argument specifying position type is given, - * the x and y coordinates will be interpreted based on the positioning scheme. * If no arguments given, the function returns the x and y position of the element. * @@ -1879,10 +1881,10 @@ p5.Element.prototype._rotate = function() { }; /** - * Sets the given style (css) property (1st arg) of the element with the + * Sets the given style (CSS) property (1st arg) of the element with the * given value (2nd arg). If a single argument is given, .style() - * returns the value of the given property; however, if the single argument - * is given in css syntax ('text-align:center'), .style() sets the css + * returns the value of the given property; however, if a single argument + * is given in CSS syntax ('text-align:center'), .style() sets the CSS * appropriately. * * @method style @@ -1977,7 +1979,7 @@ p5.Element.prototype.style = function(prop, val) { * * Adds a new attribute or changes the value of an existing attribute * on the specified element. If no value is specified, returns the - * value of the given attribute, or null if attribute is not set. + * value of the given attribute, or null if the attribute is not set. * * @method attribute * @return {String} value of attribute @@ -2146,8 +2148,8 @@ p5.Element.prototype.hide = function() { * * Sets the width and height of the element. AUTO can be used to * only adjust one dimension at a time. If no arguments are given, it - * returns the width and height of the element in an object. In case of - * elements which need to be loaded, such as images, it is recommended + * returns the width and height of the element in an Object. In the case of + * elements that need to be loaded, such as images, it is recommended * to call the function after the element has finished loading. * * @method size diff --git a/src/events/keyboard.js b/src/events/keyboard.js index 4ee87f313f..ffd2d6eee5 100644 --- a/src/events/keyboard.js +++ b/src/events/keyboard.js @@ -192,7 +192,7 @@ p5.prototype._onkeydown = function(e) { * See key and keyCode for more information.

* Browsers may have different default * behaviors attached to various key events. To prevent any default - * behavior for this event, add "return false" to the end of the method. + * behavior for this event, add "return false" to the end of the function. * * @method keyReleased * @param {Object} [event] optional KeyboardEvent callback argument. @@ -252,7 +252,7 @@ p5.prototype._onkeyup = function(e) { * configured.

* Browsers may have different default behaviors attached to various key * events. To prevent any default behavior for this event, add "return false" - * to the end of the method. + * to the end of the function. * * @method keyTyped * @param {Object} [event] optional KeyboardEvent callback argument. diff --git a/src/events/mouse.js b/src/events/mouse.js index ae449c3191..be63806e97 100644 --- a/src/events/mouse.js +++ b/src/events/mouse.js @@ -538,7 +538,7 @@ p5.prototype._setMouseButton = function(e) { * touchMoved() function will be called instead if it is defined.

* Browsers may have different default * behaviors attached to various mouse events. To prevent any default - * behavior for this event, add "return false" to the end of the method. + * behavior for this event, add "return false" to the end of the function. * * @method mouseDragged * @param {Object} [event] optional MouseEvent callback argument. @@ -620,7 +620,7 @@ p5.prototype._onmousemove = function(e) { * called instead if it is defined.

* Browsers may have different default * behaviors attached to various mouse events. To prevent any default - * behavior for this event, add "return false" to the end of the method. + * behavior for this event, add "return false" to the end of the function. * * @method mousePressed * @param {Object} [event] optional MouseEvent callback argument. @@ -699,7 +699,7 @@ p5.prototype._onmousedown = function(e) { * function will be called instead if it is defined.

* Browsers may have different default * behaviors attached to various mouse events. To prevent any default - * behavior for this event, add "return false" to the end of the method. + * behavior for this event, add "return false" to the end of the function. * * @method mouseReleased * @param {Object} [event] optional MouseEvent callback argument. @@ -777,7 +777,7 @@ p5.prototype._ondragover = p5.prototype._onmousemove; * being pressed or released, see mousePressed() or mouseReleased().

* Browsers may have different default * behaviors attached to various mouse events. To prevent any default - * behavior for this event, add "return false" to the end of the method. + * behavior for this event, add "return false" to the end of the function. * * @method mouseClicked * @param {Object} [event] optional MouseEvent callback argument. @@ -929,7 +929,7 @@ p5.prototype._pmouseWheelDeltaY = 0; * touchpad.

* The event.delta property returns the amount the mouse wheel * have scrolled. The values can be positive or negative depending on the - * scroll direction (on OS X with "natural" scrolling enabled, the signs + * scroll direction (on macOS with "natural" scrolling enabled, the signs * are inverted).

* Browsers may have different default behaviors attached to various * mouse events. To prevent any default behavior for this event, add diff --git a/src/math/calculation.js b/src/math/calculation.js index 7bc94ea85b..a1159e2928 100644 --- a/src/math/calculation.js +++ b/src/math/calculation.js @@ -115,7 +115,7 @@ p5.prototype.constrain = function(n, low, high) { /** * Calculates the distance between two points, in either two or three dimensions. - * If you looking for distance between two vectors see dist() + * If you looking for distance between two vectors see p5.Vector.dist() * * @method dist * @param {Number} x1 x-coordinate of the first point @@ -269,10 +269,10 @@ p5.prototype.floor = Math.floor; /** * Calculates a number between two numbers at a specific increment. The amt * parameter is the amount to interpolate between the two values where 0.0 - * equal to the first point, 0.1 is very near the first point, 0.5 is + * is equal to the first point, 0.1 is very near the first point, 0.5 is * half-way in between, and 1.0 is equal to the second point. If the * value of amt is more than 1.0 or less than 0.0, the number will be - * calculated accordingly in the ratio of the two given numbers. The lerp + * calculated accordingly in the ratio of the two given numbers. The lerp() * function is convenient for creating motion along a straight * path and for drawing dotted lines. * diff --git a/src/math/math.js b/src/math/math.js index 89d07aaeef..afb4f2879b 100644 --- a/src/math/math.js +++ b/src/math/math.js @@ -9,7 +9,7 @@ import p5 from '../core/main'; /** * Creates a new p5.Vector (the datatype for storing vectors). This provides a - * two or three dimensional vector, specifically a Euclidean (also known as + * two or three-dimensional vector, specifically a Euclidean (also known as * geometric) vector. A vector is an entity that has both magnitude and * direction. * diff --git a/src/math/noise.js b/src/math/noise.js index cb58e0744d..ac75a64361 100644 --- a/src/math/noise.js +++ b/src/math/noise.js @@ -36,26 +36,26 @@ let perlin; // will be initialized lazily by noise() or noiseSeed() /** * Returns the Perlin noise value at specified coordinates. Perlin noise is * a random sequence generator producing a more naturally ordered, harmonic - * succession of numbers compared to the standard random() function. + * succession of numbers compared to the standard random() function. * It was invented by Ken Perlin in the 1980s and been used since in * graphical applications to produce procedural textures, natural motion, * shapes, terrains etc.

The main difference to the - * random() function is that Perlin noise is defined in an infinite + * random() function is that Perlin noise is defined in an infinite * n-dimensional space where each pair of coordinates corresponds to a * fixed semi-random value (fixed only for the lifespan of the program; see * the noiseSeed() function). p5.js can compute 1D, 2D and 3D noise, * depending on the number of coordinates given. The resulting value will * always be between 0.0 and 1.0. The noise value can be animated by moving * through the noise space as demonstrated in the example above. The 2nd - * and 3rd dimension can also be interpreted as time.

The actual + * and 3rd dimensions can also be interpreted as time.

The actual * noise is structured similar to an audio signal, in respect to the * function's use of frequencies. Similar to the concept of harmonics in - * physics, perlin noise is computed over several octaves which are added + * physics, Perlin noise is computed over several octaves which are added * together for the final result.

Another way to adjust the * character of the resulting sequence is the scale of the input * coordinates. As the function works within an infinite space the value of * the coordinates doesn't matter as such, only the distance between - * successive coordinates does (eg. when using noise() within a + * successive coordinates does (eg. when using noise() within a * loop). As a general rule the smaller the difference between coordinates, * the smoother the resulting noise sequence will be. Steps of 0.005-0.03 * work best for most applications, but this will differ depending on use. @@ -181,17 +181,17 @@ p5.prototype.noise = function(x, y = 0, z = 0) { * function. Similar to harmonics in physics, noise is computed over * several octaves. Lower octaves contribute more to the output signal and * as such define the overall intensity of the noise, whereas higher octaves - * create finer grained details in the noise sequence. + * create finer-grained details in the noise sequence. * * By default, noise is computed over 4 octaves with each octave contributing - * exactly half than its predecessor, starting at 50% strength for the 1st + * exactly half as much as its predecessor, starting at 50% strength for the 1st * octave. This falloff amount can be changed by adding an additional function * parameter. Eg. a falloff factor of 0.75 means each octave will now have * 75% impact (25% less) of the previous lower octave. Any value between - * 0.0 and 1.0 is valid, however note that values greater than 0.5 might - * result in greater than 1.0 values returned by noise(). + * 0.0 and 1.0 is valid, however, note that values greater than 0.5 might + * result in greater than 1.0 values returned by noise(). * - * By changing these parameters, the signal created by the noise() + * By changing these parameters, the signal created by the noise() * function can be adapted to fit very specific needs and characteristics. * * @method noiseDetail @@ -241,10 +241,10 @@ p5.prototype.noiseDetail = function(lod, falloff) { }; /** - * Sets the seed value for noise(). By default, noise() - * produces different results each time the program is run. Set the - * value parameter to a constant to return the same pseudo-random - * numbers each time the software is run. + * Sets the seed value for noise(). By default, + * noise() produces different results each time + * the program is run. Set the `seed` parameter to a constant to return + * the same pseudo-random numbers each time the software is run. * * @method noiseSeed * @param {Number} seed the seed value diff --git a/src/math/p5.Vector.js b/src/math/p5.Vector.js index fd0879cfc3..cdf60e12ee 100644 --- a/src/math/p5.Vector.js +++ b/src/math/p5.Vector.js @@ -8,11 +8,11 @@ import p5 from '../core/main'; import * as constants from '../core/constants'; /** - * A class to describe a two or three dimensional vector, specifically + * A class to describe a two or three-dimensional vector, specifically * a Euclidean (also known as geometric) vector. A vector is an entity * that has both magnitude and direction. The datatype, however, stores * the components of the vector (x, y for 2D, and x, y, z for 3D). The magnitude - * and direction can be accessed via the methods mag() and heading(). + * and direction can be accessed via the methods p5.Vector.mag() and heading(). * * In many of the p5.js examples, you will see p5.Vector used to describe a * position, velocity, or acceleration. For example, if you consider a rectangle @@ -249,7 +249,7 @@ p5.Vector.prototype.copy = function copy() { * Adds x, y, and z components to a vector, adds one vector to another, or * adds two independent vectors together. The version of the method that adds * two vectors together is a static method and returns a p5.Vector, the others - * acts directly on the vector. Additionally, you may provide arguments to this function as an array. + * act directly on the vector. Additionally, you may provide arguments to this method as an array. * See the examples for more context. * * @method add @@ -370,7 +370,7 @@ const calculateRemainder3D = function(xComponent, yComponent, zComponent) { return this; }; /** - * Gives remainder of a vector when it is divided by another vector. + * Gives the remainder of a vector when it is divided by another vector. * See examples for more context. * * @method rem @@ -462,7 +462,7 @@ p5.Vector.prototype.rem = function rem(x, y, z) { * Subtracts x, y, and z components from a vector, subtracts one vector from * another, or subtracts two independent vectors. The version of the method * that subtracts two vectors is a static method and returns a p5.Vector, the - * other acts directly on the vector. Additionally, you may provide arguments to this function as an array. + * others act directly on the vector. Additionally, you may provide arguments to this method as an array. * See the examples for more context. * * @method sub @@ -565,8 +565,8 @@ p5.Vector.prototype.sub = function sub(x, y, z) { * and z components of the vector are all multiplied by the scalar. When multiplying a vector by a vector, * the x, y, z components of both vectors are multiplied by each other * (for example, with two vectors a and b: a.x * b.x, a.y * b.y, a.z * b.z). The static version of this method - * creates a new p5.Vector while the non static version acts on the vector - * directly. Additionally, you may provide arguments to this function as an array. + * creates a new p5.Vector while the non-static version acts on the vector + * directly. Additionally, you may provide arguments to this method as an array. * See the examples for more context. * * @method mult @@ -756,10 +756,10 @@ p5.Vector.prototype.mult = function mult(x, y, z) { * z components of two vectors against each other. When dividing a vector by a scalar, the x, y, * and z components of the vector are all divided by the scalar. When dividing a vector by a vector, * the x, y, z components of the source vector are treated as the dividend, and the x, y, z components - * of the argument is treated as the divisor (for example with two vectors a and b: a.x / b.x, a.y / b.y, a.z / b.z). + * of the argument are treated as the divisor (for example with two vectors a and b: a.x / b.x, a.y / b.y, a.z / b.z). * The static version of this method creates a - * new p5.Vector while the non static version acts on the vector directly. - * Additionally, you may provide arguments to this function as an array. + * new p5.Vector while the non-static version acts on the vector directly. + * Additionally, you may provide arguments to this method as an array. * See the examples for more context. * * @method div @@ -1102,7 +1102,7 @@ p5.Vector.prototype.dot = function dot(x, y, z) { /** * Calculates and returns a vector composed of the cross product between - * two vectors. Both the static and non static methods return a new p5.Vector. + * two vectors. Both the static and non-static methods return a new p5.Vector. * See the examples for more context. * * @method cross @@ -1145,7 +1145,7 @@ p5.Vector.prototype.cross = function cross(v) { /** * Calculates the Euclidean distance between two points (considering a * point as a vector object). - * If you are looking to calculate distance with 2 points see dist() + * If you are looking to calculate distance between 2 points see dist() * * @method dist * @param {p5.Vector} v the x, y, and z coordinates of a p5.Vector @@ -1399,9 +1399,9 @@ p5.Vector.prototype.setMag = function setMag(n) { }; /** - * Calculate the angle of rotation for this vector(only 2D vectors). + * Calculate the angle of rotation for this vector (only 2D vectors). * p5.Vectors created using createVector() - * will take the current angleMode into + * will take the current angleMode() into * consideration, and give the angle in radians or degree accordingly. * * @method heading @@ -1472,7 +1472,7 @@ p5.Vector.prototype.heading = function heading() { /** * Rotate the vector to a specific angle (only 2D vectors), magnitude remains the - * same + * same. * * @method setHeading * @param {number} angle the angle of rotation @@ -1497,7 +1497,7 @@ p5.Vector.prototype.setHeading = function setHeading(a) { /** * Rotate the vector by an angle (only 2D vectors), magnitude remains the - * same + * same. * * @method rotate * @param {number} angle the angle of rotation @@ -1565,7 +1565,7 @@ p5.Vector.prototype.rotate = function rotate(a) { }; /** - * Calculates and returns the angle between two vectors. This function will take + * Calculates and returns the angle between two vectors. This method will take * the current angleMode into consideration, and * give the angle in radians or degree accordingly. * @@ -1645,7 +1645,7 @@ p5.Vector.prototype.angleBetween = function angleBetween(v) { return angle; }; /** - * Linear interpolate the vector to another vector + * Linear interpolate the vector to another vector. * * @method lerp * @param {Number} x the x component @@ -1734,8 +1734,8 @@ p5.Vector.prototype.lerp = function lerp(x, y, z, amt) { }; /** - * Reflect the incoming vector about a normal to a line in 2D, or about a normal to a plane in 3D - * This method acts on the vector directly + * Reflect the incoming vector about a normal to a line in 2D, or about a normal to a plane in 3D. + * This method acts on the vector directly. * * @method reflect * @param {p5.Vector} surfaceNormal the p5.Vector to reflect about, will be normalized by this method @@ -1821,7 +1821,7 @@ p5.Vector.prototype.array = function array() { }; /** - * Equality check against a p5.Vector + * Equality check against a p5.Vector. * * @method equals * @param {Number} [x] the x component of the vector @@ -1876,7 +1876,7 @@ p5.Vector.prototype.equals = function equals(x, y, z) { // Static Methods /** - * Make a new 2D vector from an angle + * Make a new 2D vector from an angle. * * @method fromAngle * @static @@ -1927,7 +1927,7 @@ p5.Vector.fromAngle = function fromAngle(angle, length) { }; /** - * Make a new 3D vector from a pair of ISO spherical angles + * Make a new 3D vector from a pair of ISO spherical angles. * * @method fromAngles * @static @@ -1976,7 +1976,7 @@ p5.Vector.fromAngles = function(theta, phi, length) { }; /** - * Make a new 2D unit vector from a random angle + * Make a new 2D unit vector from a random angle. * * @method random2D * @static diff --git a/src/math/random.js b/src/math/random.js index 2914020d33..40fe5fa62b 100644 --- a/src/math/random.js +++ b/src/math/random.js @@ -160,9 +160,9 @@ p5.prototype.random = function(min, max) { * be returned. * * Takes either 0, 1 or 2 arguments.
- * If no args, returns a mean of 0 and standard deviation of 1.
- * If one arg, that arg is the mean (standard deviation is 1).
- * If two args, first is mean, second is standard deviation. + * If no args, the mean is 0 and the standard deviation is 1.
+ * If one arg, that arg is the mean and the standard deviation is 1.
+ * If two args, the first arg is the mean and the second is the standard deviation. * * @method randomGaussian * @param {Number} [mean] the mean diff --git a/src/math/trigonometry.js b/src/math/trigonometry.js index d71449cfc2..ebd1a5226e 100644 --- a/src/math/trigonometry.js +++ b/src/math/trigonometry.js @@ -18,8 +18,8 @@ p5.prototype._angleMode = constants.RADIANS; /** * The inverse of cos(), returns the arc cosine of a value. * This function expects the values in the range of -1 to 1 and values are returned in - * the range 0 to PI (3.1415927) if the angleMode is RADIANS or 0 to 180 if the - * angle mode is DEGREES. + * the range 0 to PI (3.1415927) if the angleMode() is RADIANS + * or 0 to 180 if the angleMode() is DEGREES. * * @method acos * @param {Number} value the value whose arc cosine is to be returned @@ -123,9 +123,10 @@ p5.prototype.atan = function(ratio) { /** * Calculates the angle (in radians) from a specified point to the coordinate * origin as measured from the positive x-axis. Values are returned as a - * float in the range from PI to -PI if the angleMode is RADIANS or 180 to - * -180 if the angleMode is DEGREES. The atan2() function is - * most often used for orienting geometry to the position of the cursor. + * float in the range from PI to -PI if the angleMode() + * is RADIANS or 180 to -180 if the angleMode() is DEGREES. + * The atan2() function is most often used for orienting geometry + * to the position of the cursor. * * Note: The y-coordinate of the point is the first parameter, and the * x-coordinate is the second parameter, due the the structure of calculating @@ -241,7 +242,7 @@ p5.prototype.tan = function(angle) { * Radians and degrees are two ways of measuring the same thing. There are * 360 degrees in a circle and 2*PI radians in a circle. For example, * 90° = PI/2 = 1.5707964. This function does not take into account the - * current angleMode. + * current angleMode(). * * @method degrees * @param {Number} radians the radians value to convert to degrees @@ -283,7 +284,7 @@ p5.prototype.degrees = angle => angle * constants.RAD_TO_DEG; p5.prototype.radians = angle => angle * constants.DEG_TO_RAD; /** - * Sets the current mode of p5 to given mode. Default mode is RADIANS. + * Sets the current mode of p5 to the given mode. Default mode is RADIANS. * * @method angleMode * @param {Constant} mode either RADIANS or DEGREES diff --git a/src/typography/attributes.js b/src/typography/attributes.js index 0b8fba11ed..80d47c7f37 100644 --- a/src/typography/attributes.js +++ b/src/typography/attributes.js @@ -20,7 +20,7 @@ import p5 from '../core/main'; * So if you write textAlign(LEFT), you are aligning the left * edge of your text to the x value you give in text(). * If you write textAlign(RIGHT, TOP), you are aligning the right edge - * of your text to the x value and the top of edge of the text + * of your text to the x value and the top edge of the text * to the y value. * * @method textAlign diff --git a/src/typography/loading_displaying.js b/src/typography/loading_displaying.js index d0a8553b73..a83f3470b5 100644 --- a/src/typography/loading_displaying.js +++ b/src/typography/loading_displaying.js @@ -15,9 +15,9 @@ import '../core/friendly_errors/fes_core'; /** * Loads an opentype font file (.otf, .ttf) from a file or a URL, - * and returns a PFont Object. This method is asynchronous, - * meaning it may not finish before the next line in your sketch - * is executed. + * and returns a p5.Font object. This function + * is asynchronous, meaning it may not finish before the next line in + * your sketch is executed. * * The path to the font should be relative to the HTML file * that links in your sketch. Loading fonts from a URL or other