From 8662cfdf2d321ddd0f9c916bff132cff16a03574 Mon Sep 17 00:00:00 2001 From: Spongman Date: Sun, 7 Jan 2018 23:40:53 -0800 Subject: [PATCH] docs tweaks --- src/core/2d_primitives.js | 2 +- src/core/attributes.js | 2 +- src/core/curves.js | 67 +++++++++++++++++----------- src/events/mouse.js | 4 +- src/math/random.js | 10 ++--- src/typography/loading_displaying.js | 2 +- src/webgl/camera.js | 6 +-- src/webgl/p5.RendererGL.js | 2 +- src/webgl/primitives.js | 2 +- 9 files changed, 55 insertions(+), 42 deletions(-) diff --git a/src/core/2d_primitives.js b/src/core/2d_primitives.js index 224ddfb606..51d0e296fa 100644 --- a/src/core/2d_primitives.js +++ b/src/core/2d_primitives.js @@ -344,7 +344,7 @@ p5.prototype.quad = function() { * @param {Number} [tr] optional radius of top-right corner. * @param {Number} [br] optional radius of bottom-right corner. * @param {Number} [bl] optional radius of bottom-left corner. - * @return {p5} the p5 object. + * @chainable * @example *
* diff --git a/src/core/attributes.js b/src/core/attributes.js index 540a1b9db3..8819b1a033 100644 --- a/src/core/attributes.js +++ b/src/core/attributes.js @@ -316,7 +316,7 @@ p5.prototype.strokeJoin = function(join) { * * @method strokeWeight * @param {Number} weight the weight (in pixels) of the stroke - * @return {p5} the p5 object + * @chainable * @example *
* diff --git a/src/core/curves.js b/src/core/curves.js index de5f5248d8..3fac2a39fb 100644 --- a/src/core/curves.js +++ b/src/core/curves.js @@ -30,7 +30,7 @@ require('./error_helpers'); * @param {Number} y3 y-coordinate for the second control point * @param {Number} x4 x-coordinate for the second anchor point * @param {Number} y4 y-coordinate for the second anchor point - * @return {p5} the p5 object + * @chainable * @example *
* @@ -42,6 +42,16 @@ require('./error_helpers'); * bezier(85, 20, 10, 10, 90, 90, 15, 80); * *
+ * + *
+ * + * background(0, 0, 0); + * noFill(); + * stroke(255); + * bezier(250, 250, 0, 100, 100, 0, 100, 0, 0, 0, 100, 0); + * + *
+ * * @alt * stretched black s-shape in center with orange lines extending from end points. * stretched black s-shape with 10 5x5 white ellipses along the shape. @@ -55,20 +65,19 @@ require('./error_helpers'); */ /** * @method bezier + * @param {Number} x1 + * @param {Number} y1 * @param {Number} z1 z-coordinate for the first anchor point + * @param {Number} x2 + * @param {Number} y2 * @param {Number} z2 z-coordinate for the first control point - * @param {Number} z3 z-coordinate for the first anchor point - * @param {Number} z4 z-coordinate for the first control point + * @param {Number} x3 + * @param {Number} y3 + * @param {Number} z3 z-coordinate for the second control point + * @param {Number} x4 + * @param {Number} y4 + * @param {Number} z4 z-coordinate for the second anchor point * @chainable - * @example - *
- * - *background(0, 0, 0); - *noFill(); - *stroke(255); - *bezier(250, 250, 0, 100, 100, 0, 100, 0, 0, 0, 100, 0); - * - *
*/ p5.prototype.bezier = function() { p5._validateParameters('bezier', arguments); @@ -260,7 +269,7 @@ p5.prototype.bezierTangent = function(a, b, c, d, t) { * @param {Number} y3 y-coordinate for the second point * @param {Number} x4 x-coordinate for the ending control point * @param {Number} y4 y-coordinate for the ending control point - * @return {p5} the p5 object + * @chainable * @example *
* @@ -289,20 +298,6 @@ p5.prototype.bezierTangent = function(a, b, c, d, t) { * curve(p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, p4.x, p4.y); * *
- * - * @alt - * horseshoe shape with orange ends facing left and black curved center. - * horseshoe shape with orange ends facing left and black curved center. - * - */ -/** - * @method curve - * @param {Number} z1 z-coordinate for the beginning control point - * @param {Number} z2 z-coordinate for the first point - * @param {Number} z3 z-coordinate for the second point - * @param {Number} z4 z-coordinate for the ending control point - * @chainable - * @example *
* * noFill(); @@ -316,8 +311,26 @@ p5.prototype.bezierTangent = function(a, b, c, d, t) { *
* * @alt + * horseshoe shape with orange ends facing left and black curved center. + * horseshoe shape with orange ends facing left and black curved center. * curving black and orange lines. */ +/** + * @method curve + * @param {Number} x1 + * @param {Number} y1 + * @param {Number} z1 z-coordinate for the beginning control point + * @param {Number} x2 + * @param {Number} y2 + * @param {Number} z2 z-coordinate for the first point + * @param {Number} x3 + * @param {Number} y3 + * @param {Number} z3 z-coordinate for the second point + * @param {Number} x4 + * @param {Number} y4 + * @param {Number} z4 z-coordinate for the ending control point + * @chainable + */ p5.prototype.curve = function() { p5._validateParameters('curve', arguments); diff --git a/src/events/mouse.js b/src/events/mouse.js index 585bcabc0c..498fa5dce3 100644 --- a/src/events/mouse.js +++ b/src/events/mouse.js @@ -61,7 +61,7 @@ p5.prototype.mouseX = 0; * function draw() { * background(244, 248, 252); * line(0, mouseY, 100, mouseY); - *} + * } * *
* @@ -179,7 +179,7 @@ p5.prototype.winMouseX = 0; * @example *
* - *var myCanvas; + * var myCanvas; * * function setup() { * //use a variable to store a pointer to the canvas diff --git a/src/math/random.js b/src/math/random.js index 3df0cd2c9c..470411d905 100644 --- a/src/math/random.js +++ b/src/math/random.js @@ -192,16 +192,16 @@ p5.prototype.random = function(min, max) { *
*
* - *var distribution = new Array(360); + * var distribution = new Array(360); * - *function setup() { + * function setup() { * createCanvas(100, 100); * for (var i = 0; i < distribution.length; i++) { * distribution[i] = floor(randomGaussian(0, 15)); * } - *} + * } * - *function draw() { + * function draw() { * background(204); * * translate(width / 2, width / 2); @@ -212,7 +212,7 @@ p5.prototype.random = function(min, max) { * var dist = abs(distribution[i]); * line(0, 0, dist, 0); * } - *} + * } * *
* @alt diff --git a/src/typography/loading_displaying.js b/src/typography/loading_displaying.js index db43320bbe..6e905c3e26 100644 --- a/src/typography/loading_displaying.js +++ b/src/typography/loading_displaying.js @@ -165,7 +165,7 @@ p5.prototype.loadFont = function(path, onSuccess, onError) { * see rectMode() for more info * @param {Number} [y2] by default, the height of the text box, * see rectMode() for more info - * @return {p5} this + * @chainable * @example *
* diff --git a/src/webgl/camera.js b/src/webgl/camera.js index d9f9721205..6fdb73e806 100644 --- a/src/webgl/camera.js +++ b/src/webgl/camera.js @@ -27,7 +27,7 @@ var p5 = require('../core/core'); * @param {Number} [upX] x component of direction 'up' from camera * @param {Number} [upY] y component of direction 'up' from camera * @param {Number} [upZ] z component of direction 'up' from camera - * @return {p5} the p5 object + * @chainable * @example *
* @@ -167,7 +167,7 @@ p5.RendererGL.prototype.camera = function( * @param {Number} [aspect] camera frustum aspect ratio * @param {Number} [near] frustum near plane length * @param {Number} [far] frustum far plane length - * @return {p5} the p5 object + * @chainable * @example *
* @@ -245,7 +245,7 @@ p5.RendererGL.prototype.perspective = function(fovy, aspect, near, far) { * @param {Number} [top] camera frustum top plane * @param {Number} [near] camera frustum near plane * @param {Number} [far] camera frustum far plane - * @return {p5} the p5 object + * @chainable * @example *
* diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index a877cef112..71e474d0c2 100755 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -446,7 +446,7 @@ p5.RendererGL.prototype.background = function() { * @param {Number} [v2] green or saturation value * @param {Number} [v3] blue or brightness value * @param {Number} [a] opacity - * @return {p5} the p5 object + * @chainable * @example *
* diff --git a/src/webgl/primitives.js b/src/webgl/primitives.js index c1edb11b18..15a8f10c47 100644 --- a/src/webgl/primitives.js +++ b/src/webgl/primitives.js @@ -19,7 +19,7 @@ require('./p5.Geometry'); * subdivisions in x-dimension * @param {Number} [detailY] Optional number of triangle * subdivisions in y-dimension - * @return {p5} the p5 object + * @chainable * @example *
*