Skip to content

Commit 8a3126f

Browse files
authored
Merge pull request #5560 from nickmcintyre/doc-edits
Assorted edits to inline docs
2 parents 92851ef + bdc10b2 commit 8a3126f

22 files changed

+166
-162
lines changed

src/color/p5.Color.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as constants from '../core/constants';
1212
import color_conversion from './color_conversion';
1313

1414
/**
15-
* Each color stores the color mode and level maxes that was applied at the
15+
* Each color stores the color mode and level maxes that were applied at the
1616
* time of its construction. These are used to interpret the input arguments
1717
* (at construction and later for that instance of color) and to format the
1818
* output e.g. when <a href="#/p5/saturation">saturation()</a> is requested.
@@ -21,7 +21,7 @@ import color_conversion from './color_conversion';
2121
* point form, normalized from 0 to 1. From this we calculate the closest
2222
* screen color (RGBA levels from 0 to 255) and expose this to the renderer.
2323
*
24-
* We also cache normalized, floating point components of the color in various
24+
* We also cache normalized, floating-point components of the color in various
2525
* representations as they are calculated. This is done to prevent repeating a
2626
* conversion that has already been performed.
2727
*
@@ -49,7 +49,7 @@ p5.Color = function(pInst, vals) {
4949
};
5050

5151
/**
52-
* This function returns the color formatted as a string. This can be useful
52+
* This method returns the color formatted as a string. This can be useful
5353
* for debugging, or for using p5.js with other libraries.
5454
*
5555
* @method toString
@@ -252,7 +252,7 @@ p5.Color.prototype.toString = function(format) {
252252
};
253253

254254
/**
255-
* The setRed function sets the red component of a color.
255+
* The setRed method sets the red component of a color.
256256
* The range depends on your color mode, in the default RGB mode it's between 0 and 255.
257257
* @method setRed
258258
* @param {Number} red the new red value
@@ -279,7 +279,7 @@ p5.Color.prototype.setRed = function(new_red) {
279279
};
280280

281281
/**
282-
* The setGreen function sets the green component of a color.
282+
* The setGreen method sets the green component of a color.
283283
* The range depends on your color mode, in the default RGB mode it's between 0 and 255.
284284
* @method setGreen
285285
* @param {Number} green the new green value
@@ -302,7 +302,7 @@ p5.Color.prototype.setGreen = function(new_green) {
302302
};
303303

304304
/**
305-
* The setBlue function sets the blue component of a color.
305+
* The setBlue method sets the blue component of a color.
306306
* The range depends on your color mode, in the default RGB mode it's between 0 and 255.
307307
* @method setBlue
308308
* @param {Number} blue the new blue value
@@ -325,7 +325,7 @@ p5.Color.prototype.setBlue = function(new_blue) {
325325
};
326326

327327
/**
328-
* The setAlpha function sets the transparency (alpha) value of a color.
328+
* The setAlpha method sets the transparency (alpha) value of a color.
329329
* The range depends on your color mode, in the default RGB mode it's between 0 and 255.
330330
* @method setAlpha
331331
* @param {Number} alpha the new alpha value

src/color/setting.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ p5.prototype.colorMode = function(mode, max1, max2, max3, maxA) {
359359
* and all named color strings are supported. In this case, an alpha number
360360
* value as a second argument is not supported, the RGBA form should be used.
361361
*
362-
* A p5 <a href="#/p5.Color">Color</a> object can also be provided to set the fill color.
362+
* A <a href="#/p5.Color">p5.Color</a> object can also be provided to set the fill color.
363363
*
364364
* @method fill
365365
* @param {Number} v1 red or hue value relative to
@@ -594,7 +594,7 @@ p5.prototype.noStroke = function() {
594594
* number value as a second argument is not supported, the RGBA form should be
595595
* used.
596596
*
597-
* A p5 <a href="#/p5.Color">Color</a> object can also be provided to set the stroke color.
597+
* A <a href="#/p5.Color">p5.Color</a> object can also be provided to set the stroke color.
598598
*
599599
* @method stroke
600600
* @param {Number} v1 red or hue value relative to

src/core/constants.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ export const TAU = _PI * 2;
154154
*/
155155
export const TWO_PI = _PI * 2;
156156
/**
157-
* Constant to be used with <a href="#/p5/angleMode">angleMode()</a> function, to set the mode which
158-
* p5.js interprets and calculates angles (either DEGREES or RADIANS).
157+
* Constant to be used with the <a href="#/p5/angleMode">angleMode()</a> function, to set the mode in
158+
* which p5.js interprets and calculates angles (either DEGREES or RADIANS).
159159
* @property {String} DEGREES
160160
* @final
161161
*
@@ -168,8 +168,8 @@ export const TWO_PI = _PI * 2;
168168
*/
169169
export const DEGREES = 'degrees';
170170
/**
171-
* Constant to be used with <a href="#/p5/angleMode">angleMode()</a> function, to set the mode which
172-
* p5.js interprets and calculates angles (either RADIANS or DEGREES).
171+
* Constant to be used with the <a href="#/p5/angleMode">angleMode()</a> function, to set the mode
172+
* in which p5.js interprets and calculates angles (either RADIANS or DEGREES).
173173
* @property {String} RADIANS
174174
* @final
175175
*

src/core/environment.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ p5.prototype.print = function(...args) {
5353
* The system variable <a href="#/p5/frameCount">frameCount</a> contains the
5454
* number of frames that have been displayed since the program started. Inside
5555
* <a href="#/p5/setup">setup()</a> the value is 0, after the first iteration
56-
* of draw it is 1, etc.
56+
* of <a href="#/p5/draw">draw()</a> it is 1, etc.
5757
*
5858
* @property {Integer} frameCount
5959
* @readOnly
@@ -241,7 +241,7 @@ p5.prototype.cursor = function(type, x, y) {
241241
* return a value. This is the same as <a href="#/p5/getFrameRate">getFrameRate()</a>.
242242
*
243243
* Calling <a href="#/p5/frameRate">frameRate()</a> with arguments that are not
244-
* of the type numbers or are non positive also returns current framerate.
244+
* of the type Number or are non-positive also returns current framerate.
245245
*
246246
* @method frameRate
247247
* @param {Number} fps number of frames to be displayed every second
@@ -262,7 +262,7 @@ p5.prototype.cursor = function(type, x, y) {
262262
*
263263
* function draw() {
264264
* background(200);
265-
* rectX = rectX += 1; // Move Rectangle
265+
* rectX += 1; // Move Rectangle
266266
*
267267
* if (rectX >= width) {
268268
// If you go off screen.

src/core/p5.Element.js

+32-32
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import p5 from './main';
99
/**
1010
* Base class for all elements added to a sketch, including canvas,
1111
* graphics buffers, and other HTML elements. It is not called directly, but <a href="#/p5.Element">p5.Element</a>
12-
* objects are created by calling <a href="#/p5/createCanvas">createCanvas</a>, <a href="#/p5/createGraphics">createGraphics</a>,
13-
* <a href="#/p5/createDiv">createDiv</a>, <a href="#/p5/createImg">createImg</a>, <a href="#/p5/createInput">createInput</a>, etc.
12+
* objects are created by calling <a href="#/p5/createCanvas">createCanvas()</a>, <a href="#/p5/createGraphics">createGraphics()</a>,
13+
* <a href="#/p5/createDiv">createDiv()</a>, <a href="#/p5/createImg">createImg()</a>, <a href="#/p5/createInput">createInput()</a>, etc.
1414
*
1515
* @class p5.Element
1616
* @constructor
@@ -48,7 +48,7 @@ p5.Element = function(elt, pInst) {
4848
*
4949
* Attaches the element to the parent specified. A way of setting
5050
* the container for the element. Accepts either a string ID, DOM
51-
* node, or <a href="#/p5.Element">p5.Element</a>. If no arguments given, parent node is returned.
51+
* node, or <a href="#/p5.Element">p5.Element</a>. If no arguments are given, parent node is returned.
5252
* For more ways to position the canvas, see the
5353
* <a href='https://github.com/processing/p5.js/wiki/Positioning-your-canvas'>
5454
* positioning the canvas</a> wiki page.
@@ -116,7 +116,7 @@ p5.Element.prototype.parent = function(p) {
116116
* Sets the ID of the element. If no ID argument is passed in, it instead
117117
* returns the current ID of the element.
118118
* Note that only one element can have a particular id in a page.
119-
* The <a href="#/p5.Element/class">.class()</a> function can be used
119+
* The <a href="#/p5.Element/class">class()</a> method can be used
120120
* to identify multiple elements with the same class name.
121121
*
122122
* @method id
@@ -187,10 +187,10 @@ p5.Element.prototype.class = function(c) {
187187
};
188188

189189
/**
190-
* The .<a href="#/p5.Element/mousePressed">mousePressed()</a> function is called
190+
* The <a href="#/p5.Element/mousePressed">mousePressed()</a> method is called
191191
* once after every time a mouse button is pressed over the element. Some mobile
192192
* browsers may also trigger this event on a touch screen, if the user performs
193-
* a quick tap. This can be used to attach element specific event listeners.
193+
* a quick tap. This can be used to attach element-specific event listeners.
194194
*
195195
* @method mousePressed
196196
* @param {Function|Boolean} fxn function to be fired when mouse is
@@ -244,9 +244,9 @@ p5.Element.prototype.mousePressed = function(fxn) {
244244
};
245245

246246
/**
247-
* The .<a href="#/p5.Element/doubleClicked">doubleClicked()</a> function is called once after every time a
247+
* The <a href="#/p5.Element/doubleClicked">doubleClicked()</a> method is called once after every time a
248248
* mouse button is pressed twice over the element. This can be used to
249-
* attach element and action specific event listeners.
249+
* attach element and action-specific event listeners.
250250
*
251251
* @method doubleClicked
252252
* @param {Function|Boolean} fxn function to be fired when mouse is
@@ -290,18 +290,18 @@ p5.Element.prototype.doubleClicked = function(fxn) {
290290
};
291291

292292
/**
293-
* The <a href="#/p5.Element/mouseWheel">mouseWheel()</a> function is called
293+
* The <a href="#/p5.Element/mouseWheel">mouseWheel()</a> method is called
294294
* once after every time a mouse wheel is scrolled over the element. This can
295-
* be used to attach element specific event listeners.
295+
* be used to attach element-specific event listeners.
296296
*
297-
* The function accepts a callback function as argument which will be executed
297+
* The method accepts a callback function as argument which will be executed
298298
* when the `wheel` event is triggered on the element, the callback function is
299299
* passed one argument `event`. The `event.deltaY` property returns negative
300300
* values if the mouse wheel is rotated up or away from the user and positive
301301
* in the other direction. The `event.deltaX` does the same as `event.deltaY`
302302
* except it reads the horizontal wheel scroll of the mouse wheel.
303303
*
304-
* On OS X with "natural" scrolling enabled, the `event.deltaY` values are
304+
* On macOS with "natural" scrolling enabled, the `event.deltaY` values are
305305
* reversed.
306306
*
307307
* @method mouseWheel
@@ -352,10 +352,10 @@ p5.Element.prototype.mouseWheel = function(fxn) {
352352
};
353353

354354
/**
355-
* The <a href="#/p5.Element/mouseReleased">mouseReleased()</a> function is
355+
* The <a href="#/p5.Element/mouseReleased">mouseReleased()</a> method is
356356
* called once after every time a mouse button is released over the element.
357357
* Some mobile browsers may also trigger this event on a touch screen, if the
358-
* user performs a quick tap. This can be used to attach element specific event listeners.
358+
* user performs a quick tap. This can be used to attach element-specific event listeners.
359359
*
360360
* @method mouseReleased
361361
* @param {Function|Boolean} fxn function to be fired when mouse is
@@ -401,10 +401,10 @@ p5.Element.prototype.mouseReleased = function(fxn) {
401401
};
402402

403403
/**
404-
* The .<a href="#/p5.Element/mouseClicked">mouseClicked()</a> function is
404+
* The <a href="#/p5.Element/mouseClicked">mouseClicked()</a> method is
405405
* called once after a mouse button is pressed and released over the element.
406406
* Some mobile browsers may also trigger this event on a touch screen, if the
407-
* user performs a quick tap.This can be used to attach element specific event listeners.
407+
* user performs a quick tap. This can be used to attach element-specific event listeners.
408408
*
409409
* @method mouseClicked
410410
* @param {Function|Boolean} fxn function to be fired when mouse is
@@ -452,9 +452,9 @@ p5.Element.prototype.mouseClicked = function(fxn) {
452452
};
453453

454454
/**
455-
* The .<a href="#/p5.Element/mouseMoved">mouseMoved()</a> function is called once every time a
455+
* The <a href="#/p5.Element/mouseMoved">mouseMoved()</a> method is called once every time a
456456
* mouse moves over the element. This can be used to attach an
457-
* element specific event listener.
457+
* element-specific event listener.
458458
*
459459
* @method mouseMoved
460460
* @param {Function|Boolean} fxn function to be fired when a mouse moves
@@ -508,9 +508,9 @@ p5.Element.prototype.mouseMoved = function(fxn) {
508508
};
509509

510510
/**
511-
* The .<a href="#/p5.Element/mouseOver">mouseOver()</a> function is called once after every time a
511+
* The <a href="#/p5.Element/mouseOver">mouseOver()</a> method is called once after every time a
512512
* mouse moves onto the element. This can be used to attach an
513-
* element specific event listener.
513+
* element-specific event listener.
514514
*
515515
* @method mouseOver
516516
* @param {Function|Boolean} fxn function to be fired when a mouse moves
@@ -549,9 +549,9 @@ p5.Element.prototype.mouseOver = function(fxn) {
549549
};
550550

551551
/**
552-
* The .<a href="#/p5.Element/mouseOut">mouseOut()</a> function is called once after every time a
552+
* The <a href="#/p5.Element/mouseOut">mouseOut()</a> method is called once after every time a
553553
* mouse moves off the element. This can be used to attach an
554-
* element specific event listener.
554+
* element-specific event listener.
555555
*
556556
* @method mouseOut
557557
* @param {Function|Boolean} fxn function to be fired when a mouse
@@ -590,8 +590,8 @@ p5.Element.prototype.mouseOut = function(fxn) {
590590
};
591591

592592
/**
593-
* The .<a href="#/p5.Element/touchStarted">touchStarted()</a> function is called once after every time a touch is
594-
* registered. This can be used to attach element specific event listeners.
593+
* The <a href="#/p5.Element/touchStarted">touchStarted()</a> method is called once after every time a touch is
594+
* registered. This can be used to attach element-specific event listeners.
595595
*
596596
* @method touchStarted
597597
* @param {Function|Boolean} fxn function to be fired when a touch
@@ -637,8 +637,8 @@ p5.Element.prototype.touchStarted = function(fxn) {
637637
};
638638

639639
/**
640-
* The .<a href="#/p5.Element/touchMoved">touchMoved()</a> function is called once after every time a touch move is
641-
* registered. This can be used to attach element specific event listeners.
640+
* The <a href="#/p5.Element/touchMoved">touchMoved()</a> method is called once after every time a touch move is
641+
* registered. This can be used to attach element-specific event listeners.
642642
*
643643
* @method touchMoved
644644
* @param {Function|Boolean} fxn function to be fired when a touch moves over
@@ -676,8 +676,8 @@ p5.Element.prototype.touchMoved = function(fxn) {
676676
};
677677

678678
/**
679-
* The .<a href="#/p5.Element/touchEnded">touchEnded()</a> function is called once after every time a touch is
680-
* registered. This can be used to attach element specific event listeners.
679+
* The <a href="#/p5.Element/touchEnded">touchEnded()</a> method is called once after every time a touch is
680+
* registered. This can be used to attach element-specific event listeners.
681681
*
682682
* @method touchEnded
683683
* @param {Function|Boolean} fxn function to be fired when a touch ends
@@ -723,9 +723,9 @@ p5.Element.prototype.touchEnded = function(fxn) {
723723
};
724724

725725
/**
726-
* The .<a href="#/p5.Element/dragOver">dragOver()</a> function is called once after every time a
726+
* The <a href="#/p5.Element/dragOver">dragOver()</a> method is called once after every time a
727727
* file is dragged over the element. This can be used to attach an
728-
* element specific event listener.
728+
* element-specific event listener.
729729
*
730730
* @method dragOver
731731
* @param {Function|Boolean} fxn function to be fired when a file is
@@ -761,9 +761,9 @@ p5.Element.prototype.dragOver = function(fxn) {
761761
};
762762

763763
/**
764-
* The .dragLeave() function is called once after every time a
764+
* The <a href="#/p5.Element/dragLeave">dragLeave()</a> method is called once after every time a
765765
* dragged file leaves the element area. This can be used to attach an
766-
* element specific event listener.
766+
* element-specific event listener.
767767
*
768768
* @method dragLeave
769769
* @param {Function|Boolean} fxn function to be fired when a file is

src/core/rendering.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ let defaultId = 'defaultCanvas0'; // this gets set again in createCanvas
1313
const defaultClass = 'p5Canvas';
1414

1515
/**
16-
* Creates a canvas element in the document, and sets the dimensions of it
17-
* in pixels. This method should be called only once at the start of setup.
16+
* Creates a canvas element in the document and sets its dimensions
17+
* in pixels. This method should be called only once at the start of <a href="#/p5/setup">setup()</a>.
1818
* Calling <a href="#/p5/createCanvas">createCanvas</a> more than once in a
1919
* sketch will result in very unpredictable behavior. If you want more than
20-
* one drawing canvas you could use <a href="#/p5/createGraphics">createGraphics</a>
20+
* one drawing canvas you could use <a href="#/p5/createGraphics">createGraphics()</a>
2121
* (hidden by default but it can be shown).
2222
*
2323
* Important note: in 2D mode (i.e. when `p5.Renderer` is not set) the origin (0,0)
@@ -37,7 +37,7 @@ const defaultClass = 'p5Canvas';
3737
* @param {Number} w width of the canvas
3838
* @param {Number} h height of the canvas
3939
* @param {Constant} [renderer] either P2D or WEBGL
40-
* @return {p5.Renderer}
40+
* @return {p5.Renderer} pointer to p5.Renderer holding canvas
4141
* @example
4242
* <div>
4343
* <code>

0 commit comments

Comments
 (0)