From dc46772b292b228f991c61169905a9d123b2d4d0 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 28 Jan 2024 16:38:37 -0500 Subject: [PATCH 01/45] Add initial conversion script from Documentation.js to old format --- utils/convert.js | 77 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 utils/convert.js diff --git a/utils/convert.js b/utils/convert.js new file mode 100644 index 0000000000..df4ed93410 --- /dev/null +++ b/utils/convert.js @@ -0,0 +1,77 @@ +const fs = require('fs'); +const path = require('path'); + +const data = JSON.parse(fs.readFileSync(path.join(__dirname, '../docs/data.json'))); + +const converted = { + project: {}, // TODO + files: {}, // TODO + modules: {}, // TODO + classes: {}, // TODO + classitems: [], // TODO + warnings: [], // TODO + consts: {} // TODO +}; + +function descriptionString(node) { + if (!node) { + return ''; + } else if (node.type === 'text') { + return node.value; + } else if (node.type === 'paragraph') { + return '

' + node.children.map(n => descriptionString(n)).join('') + '

'; + } else if (node.type === 'includeCode') { + return '' + node.value + ''; + } else if (node.value) { + return node.value; + } else if (node.children) { + return node.children.map(n => descriptionString(n)).join(''); + } else { + return ''; + } +} + +function typeObject(node) { + if (!node) return {}; + + if (node.type === 'OptionalType') { + return { optional: true, ...typeObject(node.expression) }; + } else { + return { type: node.name }; + } +} + +for (const entry of data) { + if (entry.kind === 'function' && entry.properties.length === 0) { + const item = { + name: entry.name, + itemtype: 'method', + chainable: entry.tags.some(tag => tag.title === 'chainable'), + description: descriptionString(entry.description), + example: entry.examples.map(e => e.description), + overloads: [ + { + params: entry.params.map(p => { + return { + name: p.name, + description: p.description && descriptionString(p.description), + ...typeObject(p.type) + }; + }) + } + // TODO add other overloads + ], + return: entry.returns[0] && { + description: descriptionString(entry.returns[0].description), + ...typeObject(entry.returns[0].type).name + }, + class: entry.memberof, // TODO + module: undefined, // TODO + submodule: undefined // TODO + }; + + converted.classitems.push(item); + } +} + +fs.writeFileSync(path.join(__dirname, '../docs/converted.json'), JSON.stringify(converted, null, 2)); From ccd64f8fef489d157fcd2b5fbff8ba1a3878b005 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 4 Feb 2024 14:29:48 -0500 Subject: [PATCH 02/45] Add module/submodule info --- utils/convert.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/utils/convert.js b/utils/convert.js index df4ed93410..ab9451f1ab 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -41,8 +41,57 @@ function typeObject(node) { } } +// Modules +const fileModuleInfo = {}; +const modules = {}; +const submodules = {}; +for (const entry of data) { + if (entry.tags.some(tag => tag.title === 'module')) { + const module = entry.tags.find(tag => tag.title === 'module').name; + + const submoduleTag = entry.tags.find(tag => tag.title === 'submodule'); + const submodule = submoduleTag ? submoduleTag.description : undefined; + + const file = entry.context.file; + + // Record what module/submodule each file is attached to so that we can + // look this info up for each method based on its file + fileModuleInfo[file] = fileModuleInfo[file] || { + module: undefined, + submodule: undefined + }; + fileModuleInfo[file].module = module; + fileModuleInfo[file].submodule = + fileModuleInfo[file].submodule || submodule; + + modules[module] = modules[module] || { + name: module, + submodules: {}, + classes: {} + }; + if (submodule) { + modules[module].submodules[submodule] = true; + submodules[submodule] = submodules[submodule] || { + name: submodule, + module, + is_submodule: true + }; + } + } +} +for (const key in modules) { + converted.modules[key] = modules[key]; +} +for (const key in submodules) { + converted.modules[key] = submodules[key]; +} + +// Class methods for (const entry of data) { if (entry.kind === 'function' && entry.properties.length === 0) { + const file = entry.context.file; + const { module, submodule } = fileModuleInfo[file] || {}; + const item = { name: entry.name, itemtype: 'method', @@ -66,8 +115,8 @@ for (const entry of data) { ...typeObject(entry.returns[0].type).name }, class: entry.memberof, // TODO - module: undefined, // TODO - submodule: undefined // TODO + module, + submodule }; converted.classitems.push(item); From 7c07ff37e01e5cac9560b6227ddaba30ee5480d5 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 4 Feb 2024 15:51:34 -0500 Subject: [PATCH 03/45] Handle overloads --- utils/convert.js | 55 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/utils/convert.js b/utils/convert.js index ab9451f1ab..b479432f47 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -36,6 +36,7 @@ function typeObject(node) { if (node.type === 'OptionalType') { return { optional: true, ...typeObject(node.expression) }; + // TODO handle type UndefinedLiteral here } else { return { type: node.name }; } @@ -52,17 +53,24 @@ for (const entry of data) { const submoduleTag = entry.tags.find(tag => tag.title === 'submodule'); const submodule = submoduleTag ? submoduleTag.description : undefined; + // TODO handle methods in classes that don't have this + const forTag = entry.tags.find(tag => tag.title === 'for'); + const forEntry = forTag ? forTag.description : undefined; + const file = entry.context.file; // Record what module/submodule each file is attached to so that we can // look this info up for each method based on its file fileModuleInfo[file] = fileModuleInfo[file] || { module: undefined, - submodule: undefined + submodule: undefined, + for: undefined }; fileModuleInfo[file].module = module; fileModuleInfo[file].submodule = fileModuleInfo[file].submodule || submodule; + fileModuleInfo[file].module = + fileModuleInfo[file].module || forEntry; modules[module] = modules[module] || { name: module, @@ -86,19 +94,39 @@ for (const key in submodules) { converted.modules[key] = submodules[key]; } +// Classes +// TODO +// const classDefs = {}; +// for (const entry of data) { +// } + +// Class properties +// TODO: look for tag with title "property" + // Class methods +const classMethods = {}; for (const entry of data) { if (entry.kind === 'function' && entry.properties.length === 0) { const file = entry.context.file; - const { module, submodule } = fileModuleInfo[file] || {}; + let { module, submodule, for: forEntry } = fileModuleInfo[file] || {}; + forEntry = entry.memberof || forEntry; + + // If a previous version of this same method exists, then this is probably + // an overload on that method + const prevItem = (classMethods[entry.memberof] || {})[entry.name] || {}; const item = { name: entry.name, itemtype: 'method', - chainable: entry.tags.some(tag => tag.title === 'chainable'), + chainable: prevItem.chainable || entry.tags.some(tag => tag.title === 'chainable'), description: descriptionString(entry.description), - example: entry.examples.map(e => e.description), + example: [ + ...(prevItem.example || []), + // TODO: @alt + ...entry.examples.map(e => e.description) + ], overloads: [ + ...(prevItem.overloads || []), { params: entry.params.map(p => { return { @@ -106,20 +134,29 @@ for (const entry of data) { description: p.description && descriptionString(p.description), ...typeObject(p.type) }; - }) + }), + return: entry.returns[0] && { + description: descriptionString(entry.returns[0].description), + ...typeObject(entry.returns[0].type).name + } } - // TODO add other overloads ], - return: entry.returns[0] && { + return: prevItem.return || entry.returns[0] && { description: descriptionString(entry.returns[0].description), ...typeObject(entry.returns[0].type).name }, - class: entry.memberof, // TODO + class: prevItem.class || forEntry, module, submodule }; - converted.classitems.push(item); + classMethods[entry.memberof] = classMethods[entry.memberof] || {}; + classMethods[entry.memberof][entry.name] = item; + } +} +for (const className in classMethods) { + for (const methodName in classMethods[className]) { + converted.classitems.push(classMethods[className][methodName]); } } From 5d92215791527889db34456118d82637dc511850 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Mon, 5 Feb 2024 17:20:19 -0500 Subject: [PATCH 04/45] Update documentation to make the parser work --- package-lock.json | 8 +-- package.json | 2 +- src/webgl/p5.Framebuffer.js | 129 +++++++++++++++--------------------- utils/convert.js | 8 +++ 4 files changed, 67 insertions(+), 80 deletions(-) diff --git a/package-lock.json b/package-lock.json index 95f9cd9bd5..5c17c95a09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "core-js": "^3.6.5", "dayjs": "^1.11.10", "derequire": "^2.0.0", - "documentation": "^14.0.2", + "documentation": "^14.0.3", "eslint": "^8.54.0", "file-saver": "^1.3.8", "gifenc": "^1.0.3", @@ -5970,9 +5970,9 @@ } }, "node_modules/documentation": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/documentation/-/documentation-14.0.2.tgz", - "integrity": "sha512-hWoTf8/u4pOjib02L7w94hwmhPfcSwyJNGtlPdGVe8GFyq8HkzcFzQQltaaikKunHEp0YSwDAbwBAO7nxrWIfA==", + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/documentation/-/documentation-14.0.3.tgz", + "integrity": "sha512-B7cAviVKN9Rw7Ofd+9grhVuxiHwly6Ieh+d/ceMw8UdBOv/irkuwnDEJP8tq0wgdLJDUVuIkovV+AX9mTrZFxg==", "dev": true, "dependencies": { "@babel/core": "^7.18.10", diff --git a/package.json b/package.json index ba9d338fbb..eaa8f3012e 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "core-js": "^3.6.5", "dayjs": "^1.11.10", "derequire": "^2.0.0", - "documentation": "^14.0.2", + "documentation": "^14.0.3", "eslint": "^8.54.0", "file-saver": "^1.3.8", "gifenc": "^1.0.3", diff --git a/src/webgl/p5.Framebuffer.js b/src/webgl/p5.Framebuffer.js index 7003a12fc1..671c03355b 100644 --- a/src/webgl/p5.Framebuffer.js +++ b/src/webgl/p5.Framebuffer.js @@ -8,17 +8,16 @@ import * as constants from '../core/constants'; import { checkWebGLCapabilities } from './p5.Texture'; import { readPixelsWebGL, readPixelWebGL } from './p5.RendererGL'; -class FramebufferCamera extends p5.Camera { - /** - * A p5.Camera attached to a - * p5.Framebuffer. - * - * @class p5.FramebufferCamera - * @constructor - * @param {p5.Framebuffer} framebuffer The framebuffer this camera is - * attached to - * @private - */ +/** + * A p5.Camera attached to a + * p5.Framebuffer. + * + * @class p5.FramebufferCamera + * @param {p5.Framebuffer} framebuffer The framebuffer this camera is + * attached to + * @private + */ +p5.FramebufferCamera = class FramebufferCamera extends p5.Camera { constructor(framebuffer) { super(framebuffer.target._renderer); this.fbo = framebuffer; @@ -36,22 +35,20 @@ class FramebufferCamera extends p5.Camera { this.defaultCameraFOV = 2 * Math.atan(this.fbo.height / 2 / this.defaultEyeZ); } -} - -p5.FramebufferCamera = FramebufferCamera; +}; -class FramebufferTexture { - /** - * A p5.Texture corresponding to a property of a - * p5.Framebuffer. - * - * @class p5.FramebufferTexture - * @param {p5.Framebuffer} framebuffer The framebuffer represented by this - * texture - * @param {String} property The property of the framebuffer represented by - * this texture, either `color` or `depth` - * @private - */ +/** + * A p5.Texture corresponding to a property of a + * p5.Framebuffer. + * + * @class p5.FramebufferTexture + * @param {p5.Framebuffer} framebuffer The framebuffer represented by this + * texture + * @param {String} property The property of the framebuffer represented by + * this texture, either `color` or `depth` + * @private + */ +p5.FramebufferTexture = class FramebufferTexture { constructor(framebuffer, property) { this.framebuffer = framebuffer; this.property = property; @@ -68,44 +65,27 @@ class FramebufferTexture { rawTexture() { return this.framebuffer[this.property]; } -} +}; p5.FramebufferTexture = FramebufferTexture; -class Framebuffer { - /** - * An object that one can draw to and then read as a texture. While similar - * to a p5.Graphics, using a p5.Framebuffer as a texture will generally run - * much faster, as it lives within the same WebGL context as the canvas it - * is created on. It only works in WebGL mode. - * - * @class p5.Framebuffer - * @constructor - * @param {p5.Graphics|p5} target A p5 global instance or p5.Graphics - * @param {Object} [settings] A settings object - */ +/** + * An object that one can draw to and then read as a texture. While similar + * to a p5.Graphics, using a p5.Framebuffer as a texture will generally run + * much faster, as it lives within the same WebGL context as the canvas it + * is created on. It only works in WebGL mode. + * + * @class p5.Framebuffer + * @param {p5.Graphics|p5} target A p5 global instance or p5.Graphics + * @param {Object} [settings] A settings object + */ +p5.Framebuffer = class Framebuffer { constructor(target, settings = {}) { this.target = target; this.target._renderer.framebuffers.add(this); this._isClipApplied = false; - /** - * A Uint8ClampedArray - * containing the values for all the pixels in the Framebuffer. - * - * Like the main canvas pixels property, call - * loadPixels() before reading - * it, and call updatePixels() - * afterwards to update its data. - * - * Note that updating pixels via this property will be slower than - * drawing to the framebuffer directly. - * Consider using a shader instead of looping over pixels. - * - * @property {Number[]} pixels - */ this.pixels = []; this.format = settings.format || constants.UNSIGNED_BYTE; @@ -184,7 +164,6 @@ class Framebuffer { /** * Resizes the framebuffer to the given width and height. * - * @method resize * @param {Number} width * @param {Number} height * @@ -240,7 +219,6 @@ class Framebuffer { * Call this method with no arguments to get the current density, or pass * in a number to set the density. * - * @method pixelDensity * @param {Number} [density] A scaling factor for the number of pixels per * side of the framebuffer */ @@ -261,7 +239,6 @@ class Framebuffer { * Call this method with no arguments to see if it is currently auto-sized, * or pass in a boolean to set this property. * - * @method autoSized * @param {Boolean} [autoSized] Whether or not the framebuffer should resize * along with the canvas it's attached to */ @@ -701,7 +678,6 @@ class Framebuffer { * while drawing to this framebuffer. The camera will be set as the * currently active camera. * - * @method createCamera * @returns {p5.Camera} A new camera */ createCamera() { @@ -729,8 +705,6 @@ class Framebuffer { /** * Removes the framebuffer and frees its resources. * - * @method remove - * * @example *
* @@ -795,8 +769,6 @@ class Framebuffer { * functions go right to the canvas again and to be able to read the * contents of the framebuffer's texture. * - * @method begin - * * @example *
* @@ -869,7 +841,6 @@ class Framebuffer { * renderbuffer, while other framebuffers can write directly to their main * framebuffers. * - * @method _framebufferToBind * @private */ _framebufferToBind() { @@ -886,7 +857,6 @@ class Framebuffer { /** * Ensures that the framebuffer is ready to be drawn to * - * @method _beforeBegin * @private */ _beforeBegin() { @@ -901,7 +871,6 @@ class Framebuffer { /** * Ensures that the framebuffer is ready to be read by other framebuffers. * - * @method _beforeEnd * @private */ _beforeEnd() { @@ -936,8 +905,6 @@ class Framebuffer { * functions from going to the framebuffer's texture, allowing them to go * right to the canvas again. After this, one can read from the framebuffer's * texture. - * - * @method end */ end() { const gl = this.gl; @@ -965,7 +932,6 @@ class Framebuffer { * and then calling `framebuffer.end()`, but ensures that one never * accidentally forgets `begin` or `end`. * - * @method draw * @param {Function} callback A function to run that draws to the canvas. The * function will immediately be run, but it will draw to the framebuffer * instead of the canvas. @@ -1052,7 +1018,6 @@ class Framebuffer { * getting an image, the x and y parameters define the coordinates for the * upper-left corner of the image, regardless of the current imageMode(). * - * @method get * @param {Number} x x-coordinate of the pixel * @param {Number} y y-coordinate of the pixel * @param {Number} w width of the section to be returned @@ -1060,11 +1025,9 @@ class Framebuffer { * @return {p5.Image} the rectangle p5.Image */ /** - * @method get * @return {p5.Image} the whole p5.Image */ /** - * @method get * @param {Number} x * @param {Number} y * @return {Number[]} color of pixel at x,y in array format [R, G, B, A] @@ -1289,7 +1252,7 @@ class Framebuffer { } } } -} +}; /** * A texture with the color information of the framebuffer. Pass this (or the @@ -1412,6 +1375,22 @@ class Framebuffer { * from the camera they go */ -p5.Framebuffer = Framebuffer; +/** + * A Uint8ClampedArray + * containing the values for all the pixels in the Framebuffer. + * + * Like the main canvas pixels property, call + * loadPixels() before reading + * it, and call updatePixels() + * afterwards to update its data. + * + * Note that updating pixels via this property will be slower than + * drawing to the framebuffer directly. + * Consider using a shader instead of looping over pixels. + * + * @property {Number[]} pixels + * @for p5.Framebuffer + */ -export default Framebuffer; +export default p5.Framebuffer; diff --git a/utils/convert.js b/utils/convert.js index b479432f47..41c60f5451 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -42,6 +42,13 @@ function typeObject(node) { } } +function locationInfo(node) { + return { + file: node.context.file.slice(node.context.file.indexOf('src/')), + line: node.context.loc.start.line + }; +} + // Modules const fileModuleInfo = {}; const modules = {}; @@ -117,6 +124,7 @@ for (const entry of data) { const item = { name: entry.name, + ...locationInfo(entry), itemtype: 'method', chainable: prevItem.chainable || entry.tags.some(tag => tag.title === 'chainable'), description: descriptionString(entry.description), From bdedeee5a4c743bc0e807c57d38a16cd3fe3f4ec Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sat, 10 Feb 2024 10:01:26 -0500 Subject: [PATCH 05/45] Implement class properties --- utils/convert.js | 157 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 140 insertions(+), 17 deletions(-) diff --git a/utils/convert.js b/utils/convert.js index 41c60f5451..c1b89e5bd9 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -2,14 +2,24 @@ const fs = require('fs'); const path = require('path'); const data = JSON.parse(fs.readFileSync(path.join(__dirname, '../docs/data.json'))); +const allData = data.flatMap(entry => { + return [ + entry, + ...entry.members.global, + ...entry.members.inner, + ...entry.members.instance, + ...entry.members.events, + ...entry.members.static + ]; +}); const converted = { project: {}, // TODO files: {}, // TODO - modules: {}, // TODO - classes: {}, // TODO - classitems: [], // TODO - warnings: [], // TODO + modules: {}, + classes: {}, + classitems: [], + warnings: [], // Intentionally unimplemented consts: {} // TODO }; @@ -49,11 +59,25 @@ function locationInfo(node) { }; } +function getExample(node) { + return node.description; +} + +function getAlt(node) { + return node + .tags + .filter(tag => tag.title === 'alt') + .map(tag => tag.description) + .join('\n') || undefined; +} + +// ============================================================================ // Modules +// ============================================================================ const fileModuleInfo = {}; const modules = {}; const submodules = {}; -for (const entry of data) { +for (const entry of allData) { if (entry.tags.some(tag => tag.title === 'module')) { const module = entry.tags.find(tag => tag.title === 'module').name; @@ -101,22 +125,121 @@ for (const key in submodules) { converted.modules[key] = submodules[key]; } +function getModuleInfo(entry) { + const file = entry.context.file; + let { module, submodule, for: forEntry } = fileModuleInfo[file] || {}; + forEntry = entry.memberof || forEntry; + return { module, submodule, forEntry }; +} + +// ============================================================================ // Classes -// TODO -// const classDefs = {}; -// for (const entry of data) { -// } +// ============================================================================ +for (const entry of allData) { + if (entry.kind === 'class') { + const { module, submodule } = getModuleInfo(entry); + + const item = { + name: entry.name, + ...locationInfo(entry), + extends: entry.augments && entry.augments[0] && entry.augments[0].name, + description: descriptionString(entry.description), + example: entry.examples.map(getExample), + alt: getAlt(entry), + params: entry.params.map(p => { + return { + name: p.name, + description: p.description && descriptionString(p.description), + ...typeObject(p.type) + }; + }), + return: entry.returns[0] && { + description: descriptionString(entry.returns[0].description), + ...typeObject(entry.returns[0].type).name + }, + module, + submodule + }; + + converted.classes[item.name] = item; + } +} +// ============================================================================ // Class properties -// TODO: look for tag with title "property" +// ============================================================================ +const propDefs = {}; +// Grab properties out of the class nodes. These should have all the properties +// but very little of their metadata. +for (const entry of allData) { + if (entry.kind !== 'class') continue; + if (!entry.properties) continue; + + const { module, submodule } = getModuleInfo(entry); + const location = locationInfo(entry); + propDefs[entry.name] = propDefs[entry.name] || {}; + + for (const property of entry.properties) { + const item = { + itemtype: 'property', + name: property.name, + ...location, + line: property.lineNumber || location.line, + ...typeObject(property.type), + module, + submodule, + class: entry.name + }; + propDefs[entry.name][property.name] = item; + } +} + +// Grab property metadata out of other loose nodes. +for (const entry of allData) { + const { module, submodule, forEntry } = getModuleInfo(entry); + const propTag = entry.tags.find(tag => tag.title === 'property'); + const forTag = entry.tags.find(tag => tag.title === 'for'); + const memberof = entry.memberof; + if (!propTag || (!forEntry && !forTag && !memberof)) continue; + + const forName = memberof || (forTag && forTag.description) || forEntry; + propDefs[forName] = propDefs[forName] || {}; + const classEntry = propDefs[forName]; + + const prop = classEntry[propTag.name] || { + itemtype: 'property', + name: propTag.name, + ...locationInfo(entry), + ...typeObject(propTag.type), + module, + submodule, + class: forName + }; + + const updated = { + ...prop, + example: entry.examples.map(getExample), + alt: getAlt(entry), + description: descriptionString(entry.description) + }; + classEntry[propTag.name] = updated; +} + +// Add to the list +for (const className in propDefs) { + for (const propName in propDefs[className]) { + converted.classitems.push(propDefs[className][propName]); + } +} + +// ============================================================================ // Class methods +// ============================================================================ const classMethods = {}; -for (const entry of data) { +for (const entry of allData) { if (entry.kind === 'function' && entry.properties.length === 0) { - const file = entry.context.file; - let { module, submodule, for: forEntry } = fileModuleInfo[file] || {}; - forEntry = entry.memberof || forEntry; + const { module, submodule, forEntry } = getModuleInfo(entry); // If a previous version of this same method exists, then this is probably // an overload on that method @@ -127,12 +250,12 @@ for (const entry of data) { ...locationInfo(entry), itemtype: 'method', chainable: prevItem.chainable || entry.tags.some(tag => tag.title === 'chainable'), - description: descriptionString(entry.description), + description: prevItem.description || descriptionString(entry.description), example: [ ...(prevItem.example || []), - // TODO: @alt - ...entry.examples.map(e => e.description) + ...entry.examples.map(getExample) ], + alt: getAlt(entry), overloads: [ ...(prevItem.overloads || []), { From bb80892d817bc4b9eb9c404cdcc391c218d1f01c Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sat, 10 Feb 2024 10:12:58 -0500 Subject: [PATCH 06/45] Use 1 for true to save characters and match the old format --- utils/convert.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/convert.js b/utils/convert.js index c1b89e5bd9..a8dce4f6e8 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -45,7 +45,7 @@ function typeObject(node) { if (!node) return {}; if (node.type === 'OptionalType') { - return { optional: true, ...typeObject(node.expression) }; + return { optional: 1, ...typeObject(node.expression) }; // TODO handle type UndefinedLiteral here } else { return { type: node.name }; @@ -109,11 +109,11 @@ for (const entry of allData) { classes: {} }; if (submodule) { - modules[module].submodules[submodule] = true; + modules[module].submodules[submodule] = 1; submodules[submodule] = submodules[submodule] || { name: submodule, module, - is_submodule: true + is_submodule: 1 }; } } @@ -157,6 +157,7 @@ for (const entry of allData) { description: descriptionString(entry.returns[0].description), ...typeObject(entry.returns[0].type).name }, + is_constructor: 1, module, submodule }; From 4be13d207701b2b0003b8262f505686395f7f605 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 10:18:15 -0500 Subject: [PATCH 07/45] Handle consts + usage --- src/core/shape/vertex.js | 4 +-- utils/convert.js | 72 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/src/core/shape/vertex.js b/src/core/shape/vertex.js index b08d5830cf..642e2aae23 100644 --- a/src/core/shape/vertex.js +++ b/src/core/shape/vertex.js @@ -110,7 +110,7 @@ p5.prototype.beginContour = function() { * ellipse() or rect() within beginShape(). * * @method beginShape - * @param {Constant} [kind] either POINTS, LINES, TRIANGLES, TRIANGLE_FAN + * @param {POINTS|LINES|TRIANGLES|TRIANGLE_FAN|TRIANGLE_STRIP|QUADS|QUAD_STRIP|TESS} [kind] either POINTS, LINES, TRIANGLES, TRIANGLE_FAN * TRIANGLE_STRIP, QUADS, QUAD_STRIP or TESS * @chainable * @example @@ -603,7 +603,7 @@ p5.prototype.endContour = function() { * page. * * @method endShape - * @param {Constant} [mode] use CLOSE to close the shape + * @param {CLOSE} [mode] use CLOSE to close the shape * @param {Integer} [count] number of times you want to draw/instance the shape (for WebGL mode). * @chainable * @example diff --git a/utils/convert.js b/utils/convert.js index a8dce4f6e8..26a6691f59 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -14,13 +14,13 @@ const allData = data.flatMap(entry => { }); const converted = { - project: {}, // TODO - files: {}, // TODO + project: {}, // Unimplemented, probably not needed + files: {}, // Unimplemented, probably not needed modules: {}, classes: {}, classitems: [], warnings: [], // Intentionally unimplemented - consts: {} // TODO + consts: {} }; function descriptionString(node) { @@ -46,12 +46,47 @@ function typeObject(node) { if (node.type === 'OptionalType') { return { optional: 1, ...typeObject(node.expression) }; - // TODO handle type UndefinedLiteral here + } else if (node.type === 'UnionType') { + const names = node.elements.map(n => typeObject(n).type); + return { + type: names.join('|') + }; + } else if (node.type === 'TypeApplication') { + const { type: typeName } = typeObject(node.expression); + const args = node.applications.map(n => typeObject(n).type); + return { + type: `${typeName}<${args.join(', ')}>` + }; } else { + // TODO + // - handle type UndefinedLiteral + // - handle record types return { type: node.name }; } } +const constUsage = {}; +function registerConstantUsage(name, memberof, node) { + if (!node) return; + if (node.type === 'OptionalType') { + registerConstantUsage(name, memberof, node.expression); + } else if (node.type === 'UnionType') { + for (const element of node.elements) { + registerConstantUsage(name, memberof, element); + } + } else if (node.type === 'TypeApplication') { + registerConstantUsage(name, memberof, node.expression); + for (const element of node.applications) { + registerConstantUsage(name, memberof, element); + } + } else if (node.type === 'NameExpression') { + const constant = constUsage[node.name]; + if (constant) { + constant.add(`${memberof}.${name}`); + } + } +} + function locationInfo(node) { return { file: node.context.file.slice(node.context.file.indexOf('src/')), @@ -100,8 +135,8 @@ for (const entry of allData) { fileModuleInfo[file].module = module; fileModuleInfo[file].submodule = fileModuleInfo[file].submodule || submodule; - fileModuleInfo[file].module = - fileModuleInfo[file].module || forEntry; + fileModuleInfo[file].for = + fileModuleInfo[file].for || forEntry; modules[module] = modules[module] || { name: module, @@ -132,6 +167,15 @@ function getModuleInfo(entry) { return { module, submodule, forEntry }; } +// ============================================================================ +// Constants +// ============================================================================ +for (const entry of allData) { + if (entry.kind === 'constant') { + constUsage[entry.name] = new Set(); + } +} + // ============================================================================ // Classes // ============================================================================ @@ -198,6 +242,9 @@ for (const entry of allData) { // Grab property metadata out of other loose nodes. for (const entry of allData) { + // These are in a different section + if (entry.kind === 'constant') continue; + const { module, submodule, forEntry } = getModuleInfo(entry); const propTag = entry.tags.find(tag => tag.title === 'property'); const forTag = entry.tags.find(tag => tag.title === 'for'); @@ -246,11 +293,17 @@ for (const entry of allData) { // an overload on that method const prevItem = (classMethods[entry.memberof] || {})[entry.name] || {}; + for (const param of entry.params) { + registerConstantUsage(entry.name, prevItem.class || forEntry, param.type); + } + const item = { name: entry.name, ...locationInfo(entry), itemtype: 'method', - chainable: prevItem.chainable || entry.tags.some(tag => tag.title === 'chainable'), + chainable: (prevItem.chainable || entry.tags.some(tag => tag.title === 'chainable')) + ? 1 + : undefined, description: prevItem.description || descriptionString(entry.description), example: [ ...(prevItem.example || []), @@ -292,4 +345,9 @@ for (const className in classMethods) { } } +// Done registering const usage, make a finished version +for (const key in constUsage) { + converted.consts[key] = [...constUsage[key]]; +} + fs.writeFileSync(path.join(__dirname, '../docs/converted.json'), JSON.stringify(converted, null, 2)); From a9fb00334c613b3459b9766bd7e640bd5a16b18b Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 10:25:59 -0500 Subject: [PATCH 08/45] Also log return types and properties --- utils/convert.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/convert.js b/utils/convert.js index 26a6691f59..67faac7298 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -255,6 +255,8 @@ for (const entry of allData) { propDefs[forName] = propDefs[forName] || {}; const classEntry = propDefs[forName]; + registerConstantUsage(entry.type); + const prop = classEntry[propTag.name] || { itemtype: 'property', name: propTag.name, @@ -296,6 +298,9 @@ for (const entry of allData) { for (const param of entry.params) { registerConstantUsage(entry.name, prevItem.class || forEntry, param.type); } + if (entry.returns[0]) { + registerConstantUsage(entry.returns[0].type); + } const item = { name: entry.name, From 590490a4147a554ee56a8a61e19958846c4ef5ef Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 10:35:36 -0500 Subject: [PATCH 09/45] Fix some more cases of private classes --- utils/convert.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/utils/convert.js b/utils/convert.js index 67faac7298..ecdc0e9fda 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -206,7 +206,14 @@ for (const entry of allData) { submodule }; - converted.classes[item.name] = item; + // The @private tag doesn't seem to end up in the Documentation.js output. + // However, it also doesn't seem to grab the description in this case, so + // I'm using this as a proxy to let us know that a class should be private. + // This means any public class *must* have a description. + const isPrivate = !item.description; + if (!isPrivate) { + converted.classes[item.name] = item; + } } } @@ -219,6 +226,10 @@ const propDefs = {}; // but very little of their metadata. for (const entry of allData) { if (entry.kind !== 'class') continue; + + // Ignore private classes + if (!converted.classes[entry.name]) continue; + if (!entry.properties) continue; const { module, submodule } = getModuleInfo(entry); @@ -254,6 +265,7 @@ for (const entry of allData) { const forName = memberof || (forTag && forTag.description) || forEntry; propDefs[forName] = propDefs[forName] || {}; const classEntry = propDefs[forName]; + if (!classEntry) continue; registerConstantUsage(entry.type); @@ -295,6 +307,14 @@ for (const entry of allData) { // an overload on that method const prevItem = (classMethods[entry.memberof] || {})[entry.name] || {}; + // Ignore methods of private classes + if (!converted.classes[prevItem.class || forEntry]) continue; + + // Ignore private methods. @private-tagged ones don't show up in the JSON, + // but we also implicitly use this _-prefix convension. + const isPrivate = entry.name.startsWith('_'); + if (isPrivate) continue; + for (const param of entry.params) { registerConstantUsage(entry.name, prevItem.class || forEntry, param.type); } From d4f1fa4ea8ee50807149cd449f0744986512967e Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 10:56:46 -0500 Subject: [PATCH 10/45] Fix p5.Geometry ES6 method docs --- package.json | 2 +- src/webgl/p5.Framebuffer.js | 2 -- src/webgl/p5.Geometry.js | 10 +--------- utils/convert.js | 11 +++++++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index eaa8f3012e..d9cb4489f2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build": "rollup -c", "preview": "vite", "dev": "grunt yui browserify:dev connect:yui watch:quick", - "docs": "documentation build ./src/app.js -o ./docs/data.json", + "docs": "documentation build ./src/app.js -o ./docs/data.json && node ./utils/convert.js", "test": "vitest run", "lint": "eslint .", "lint:fix": "eslint --fix ." diff --git a/src/webgl/p5.Framebuffer.js b/src/webgl/p5.Framebuffer.js index 671c03355b..aa7a07c091 100644 --- a/src/webgl/p5.Framebuffer.js +++ b/src/webgl/p5.Framebuffer.js @@ -67,8 +67,6 @@ p5.FramebufferTexture = class FramebufferTexture { } }; -p5.FramebufferTexture = FramebufferTexture; - /** * An object that one can draw to and then read as a texture. While similar * to a p5.Graphics, using a p5.Framebuffer as a texture will generally run diff --git a/src/webgl/p5.Geometry.js b/src/webgl/p5.Geometry.js index 76c8ed8ad4..b7438d8d58 100644 --- a/src/webgl/p5.Geometry.js +++ b/src/webgl/p5.Geometry.js @@ -12,8 +12,8 @@ import p5 from '../core/main'; import * as constants from '../core/constants'; /** * p5 Geometry class + * * @class p5.Geometry - * @constructor * @param {Integer} [detailX] number of vertices along the x-axis. * @param {Integer} [detailY] number of vertices along the y-axis. * @param {function} [callback] function to call upon object instantiation. @@ -69,7 +69,6 @@ p5.Geometry = class Geometry { if (callback instanceof Function) { callback.call(this); } - return this; // TODO: is this a constructor? } reset() { @@ -93,8 +92,6 @@ p5.Geometry = class Geometry { * Using `clearColors()`, you can use `fill()` to supply new colors before drawing each shape. * If `clearColors()` is not used, the shapes will use their internal colors by ignoring `fill()`. * - * @method clearColors - * * @example *
* @@ -144,7 +141,6 @@ p5.Geometry = class Geometry { } /** * computes faces for geometry objects based on the vertices. - * @method computeFaces * @chainable */ computeFaces() { @@ -195,7 +191,6 @@ p5.Geometry = class Geometry { * Options can include: * - `roundToPrecision`: Precision value for rounding computations. Defaults to 3. * - * @method computeNormals * @param {String} [shadingType] shading type (`FLAT` for flat shading or `SMOOTH` for smooth shading) for buildGeometry() outputs. Defaults to `FLAT`. * @param {Object} [options] An optional object with configuration. * @chainable @@ -359,7 +354,6 @@ p5.Geometry = class Geometry { /** * Averages the vertex normals. Used in curved * surfaces - * @method averageNormals * @chainable */ averageNormals() { @@ -379,7 +373,6 @@ p5.Geometry = class Geometry { /** * Averages pole normals. Used in spherical primitives - * @method averagePoleNormals * @chainable */ averagePoleNormals() { @@ -689,7 +682,6 @@ p5.Geometry = class Geometry { /** * Modifies all vertices to be centered within the range -100 to 100. - * @method normalize * @chainable */ normalize() { diff --git a/utils/convert.js b/utils/convert.js index ecdc0e9fda..55a41989bd 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -57,9 +57,10 @@ function typeObject(node) { return { type: `${typeName}<${args.join(', ')}>` }; + } else if (node.type === 'UndefinedLiteral') { + return { type: 'undefined' }; } else { // TODO - // - handle type UndefinedLiteral // - handle record types return { type: node.name }; } @@ -307,8 +308,10 @@ for (const entry of allData) { // an overload on that method const prevItem = (classMethods[entry.memberof] || {})[entry.name] || {}; + const className = entry.memberof || prevItem.class || forEntry; + // Ignore methods of private classes - if (!converted.classes[prevItem.class || forEntry]) continue; + if (!converted.classes[className]) continue; // Ignore private methods. @private-tagged ones don't show up in the JSON, // but we also implicitly use this _-prefix convension. @@ -316,7 +319,7 @@ for (const entry of allData) { if (isPrivate) continue; for (const param of entry.params) { - registerConstantUsage(entry.name, prevItem.class || forEntry, param.type); + registerConstantUsage(entry.name, className, param.type); } if (entry.returns[0]) { registerConstantUsage(entry.returns[0].type); @@ -355,7 +358,7 @@ for (const entry of allData) { description: descriptionString(entry.returns[0].description), ...typeObject(entry.returns[0].type).name }, - class: prevItem.class || forEntry, + class: className, module, submodule }; From 1ac249f81929fb653eeaebe5664e7f87edb615d9 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:17:21 -0500 Subject: [PATCH 11/45] Convert TypedDict; fix overloaded params having too many items --- src/data/p5.TypedDict.js | 41 ---------------------------------------- utils/convert.js | 35 +++++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 44 deletions(-) diff --git a/src/data/p5.TypedDict.js b/src/data/p5.TypedDict.js index 449887157b..cb1f35ae1e 100644 --- a/src/data/p5.TypedDict.js +++ b/src/data/p5.TypedDict.js @@ -85,9 +85,7 @@ p5.prototype.createNumberDict = function (key, value) { * typed Dictionary classes inherit from this class. * * @class p5.TypedDict - * @constructor */ - p5.TypedDict = class TypedDict { constructor(key, value) { if (key instanceof Object) { @@ -102,7 +100,6 @@ p5.TypedDict = class TypedDict { /** * Returns the number of key-value pairs currently stored in the Dictionary. * - * @method size * @return {Integer} the number of key-value pairs in the Dictionary * * @example @@ -124,7 +121,6 @@ p5.TypedDict = class TypedDict { * Returns true if the given key exists in the Dictionary, * otherwise returns false. * - * @method hasKey * @param {Number|String} key that you want to look up * @return {Boolean} whether that key exists in Dictionary * @@ -145,7 +141,6 @@ p5.TypedDict = class TypedDict { /** * Returns the value stored at the given key. * - * @method get * @param {Number|String} the key you want to access * @return {Number|String} the value stored at that key * @@ -172,7 +167,6 @@ p5.TypedDict = class TypedDict { * Updates the value associated with the given key in case it already exists * in the Dictionary. Otherwise a new key-value pair is added. * - * @method set * @param {Number|String} key * @param {Number|String} value * @@ -209,7 +203,6 @@ p5.TypedDict = class TypedDict { /** * Creates a new key-value pair in the Dictionary. * - * @method create * @param {Number|String} key * @param {Number|String} value * @@ -225,10 +218,8 @@ p5.TypedDict = class TypedDict { *
*/ /** - * @method create * @param {Object} obj key/value pair */ - create(key, value) { if (key instanceof Object && typeof value === 'undefined') { this._addObj(key); @@ -245,7 +236,6 @@ p5.TypedDict = class TypedDict { /** * Removes all previously stored key-value pairs from the Dictionary. * - * @method clear * @example *
* @@ -258,7 +248,6 @@ p5.TypedDict = class TypedDict { * *
*/ - clear() { this.data = {}; } @@ -266,7 +255,6 @@ p5.TypedDict = class TypedDict { /** * Removes the key-value pair stored at the given key from the Dictionary. * - * @method remove * @param {Number|String} key for the pair to remove * * @example @@ -283,7 +271,6 @@ p5.TypedDict = class TypedDict { * } *
*/ - remove(key) { if (this.data.hasOwnProperty(key)) { delete this.data[key]; @@ -295,8 +282,6 @@ p5.TypedDict = class TypedDict { /** * Logs the set of items currently stored in the Dictionary to the console. * - * @method print - * * @example *
* @@ -309,7 +294,6 @@ p5.TypedDict = class TypedDict { * *
*/ - print() { for (const item in this.data) { console.log(`key:${item} value:${this.data[item]}`); @@ -319,7 +303,6 @@ p5.TypedDict = class TypedDict { /** * Converts the Dictionary into a CSV file for local download. * - * @method saveTable * @example *
* @@ -342,7 +325,6 @@ p5.TypedDict = class TypedDict { * *
*/ - saveTable(filename) { let output = ''; @@ -357,7 +339,6 @@ p5.TypedDict = class TypedDict { /** * Converts the Dictionary into a JSON file for local download. * - * @method saveJSON * @example *
* @@ -380,7 +361,6 @@ p5.TypedDict = class TypedDict { * *
*/ - saveJSON(filename, opt) { p5.prototype.saveJSON(this.data, filename, opt); } @@ -401,7 +381,6 @@ p5.TypedDict = class TypedDict { * @class p5.StringDict * @extends p5.TypedDict */ - p5.StringDict = class StringDict extends p5.TypedDict { constructor(...args) { super(...args); @@ -426,12 +405,10 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { super(...args); } - /** * private helper function to ensure that the user passed in valid * values for the Dictionary type */ - _validate(value) { return typeof value === 'number'; } @@ -440,7 +417,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * Add the given number to the value currently stored at the given key. * The sum then replaces the value previously stored in the Dictionary. * - * @method add * @param {Number} Key for the value you wish to add to * @param {Number} Number to add to the value * @example @@ -454,7 +430,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { *
* */ - add(key, amount) { if (this.data.hasOwnProperty(key)) { this.data[key] += amount; @@ -467,7 +442,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * Subtract the given number from the value currently stored at the given key. * The difference then replaces the value previously stored in the Dictionary. * - * @method sub * @param {Number} Key for the value you wish to subtract from * @param {Number} Number to subtract from the value * @example @@ -481,7 +455,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * * */ - sub(key, amount) { this.add(key, -amount); } @@ -490,7 +463,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * Multiply the given number with the value currently stored at the given key. * The product then replaces the value previously stored in the Dictionary. * - * @method mult * @param {Number} Key for value you wish to multiply * @param {Number} Amount to multiply the value by * @example @@ -504,7 +476,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * * */ - mult(key, amount) { if (this.data.hasOwnProperty(key)) { this.data[key] *= amount; @@ -517,7 +488,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * Divide the given number with the value currently stored at the given key. * The quotient then replaces the value previously stored in the Dictionary. * - * @method div * @param {Number} Key for value you wish to divide * @param {Number} Amount to divide the value by * @example @@ -531,7 +501,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * * */ - div(key, amount) { if (this.data.hasOwnProperty(key)) { this.data[key] /= amount; @@ -545,7 +514,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * the argument 'flip' is used to flip the comparison arrow * from 'less than' to 'greater than' */ - _valueTest(flip) { if (Object.keys(this.data).length === 0) { throw new Error( @@ -567,7 +535,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { /** * Return the lowest number currently stored in the Dictionary. * - * @method minValue * @return {Number} * @example *
@@ -579,7 +546,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * } *
*/ - minValue() { return this._valueTest(1); } @@ -587,7 +553,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { /** * Return the highest number currently stored in the Dictionary. * - * @method maxValue * @return {Number} * @example *
@@ -599,7 +564,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * } *
*/ - maxValue() { return this._valueTest(-1); } @@ -609,7 +573,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * the argument 'flip' is used to flip the comparison arrow * from 'less than' to 'greater than' */ - _keyTest(flip) { if (Object.keys(this.data).length === 0) { throw new Error('Unable to use minValue on an empty NumberDict'); @@ -629,7 +592,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { /** * Return the lowest key currently used in the Dictionary. * - * @method minKey * @return {Number} * @example *
@@ -641,7 +603,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * } *
*/ - minKey() { return this._keyTest(1); } @@ -649,7 +610,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { /** * Return the highest key currently used in the Dictionary. * - * @method maxKey * @return {Number} * @example *
@@ -661,7 +621,6 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { * } *
*/ - maxKey() { return this._keyTest(-1); } diff --git a/utils/convert.js b/utils/convert.js index 55a41989bd..d38f7072e0 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -168,6 +168,35 @@ function getModuleInfo(entry) { return { module, submodule, forEntry }; } +function getParams(entry) { + // Documentation.js seems to try to grab params from the function itself in + // the code if we don't document all the parameters. This messes with our + // manually-documented overloads. Instead of using the provided entry.params + // array, we'll instead only rely on manually included @param tags. + // + // However, the tags don't include a tree-structured description field, and + // instead convert it to a string. We want a slightly different conversion to + // string, so we match these params to the Documentation.js-provided `params` + // array and grab the description from those. + return (entry.tags || []).filter(t => t.title === 'param').map(node => { + const param = entry.params.find(param => param.name === node.name); + if (param) { + return { + ...node, + description: param.description + }; + } else { + return { + ...node, + description: { + type: 'html', + value: node.description + } + }; + } + }); +} + // ============================================================================ // Constants // ============================================================================ @@ -191,7 +220,7 @@ for (const entry of allData) { description: descriptionString(entry.description), example: entry.examples.map(getExample), alt: getAlt(entry), - params: entry.params.map(p => { + params: getParams(entry).map(p => { return { name: p.name, description: p.description && descriptionString(p.description), @@ -318,7 +347,7 @@ for (const entry of allData) { const isPrivate = entry.name.startsWith('_'); if (isPrivate) continue; - for (const param of entry.params) { + for (const param of getParams(entry)) { registerConstantUsage(entry.name, className, param.type); } if (entry.returns[0]) { @@ -341,7 +370,7 @@ for (const entry of allData) { overloads: [ ...(prevItem.overloads || []), { - params: entry.params.map(p => { + params: getParams(entry).map(p => { return { name: p.name, description: p.description && descriptionString(p.description), From b77d9120a125392de1d855e7bb89efed2234b724 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:17:51 -0500 Subject: [PATCH 12/45] Fix one straggler --- src/data/p5.TypedDict.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/data/p5.TypedDict.js b/src/data/p5.TypedDict.js index cb1f35ae1e..20f0aef23b 100644 --- a/src/data/p5.TypedDict.js +++ b/src/data/p5.TypedDict.js @@ -396,7 +396,6 @@ p5.StringDict = class StringDict extends p5.TypedDict { * A simple Dictionary class for Numbers. * * @class p5.NumberDict - * @constructor * @extends p5.TypedDict */ From 0b490b0c0473a305d44a92aa167285f5ee7e2ba3 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:37:46 -0500 Subject: [PATCH 13/45] Convert more classes --- src/dom/dom.js | 525 ++++++++++++++++++-------------------- src/image/p5.Image.js | 283 ++++++++++---------- src/typography/p5.Font.js | 22 +- 3 files changed, 396 insertions(+), 434 deletions(-) diff --git a/src/dom/dom.js b/src/dom/dom.js index b12a2750c8..f8b5952d91 100644 --- a/src/dom/dom.js +++ b/src/dom/dom.js @@ -3650,7 +3650,6 @@ class Cue { * createCapture. * * @class p5.MediaElement - * @constructor * @param {String} elt DOM node that is wrapped * @extends p5.Element * @example @@ -3674,7 +3673,7 @@ class Cue { * * */ -class MediaElement extends p5.Element { +p5.MediaElement = class MediaElement extends p5.Element { constructor(elt, pInst) { super(elt, pInst); @@ -3696,32 +3695,6 @@ class MediaElement extends p5.Element { // the internal canvas so we only update it if the frame has changed. this._frameOnCanvas = -1; - /** - * Path to the media element's source as a string. - * - * @property src - * @return {String} src - * @example - *
- * - * let beat; - * - * function setup() { - * // Create a p5.MediaElement using createAudio(). - * beat = createAudio('assets/beat.mp3'); - * - * describe('The text "https://p5js.org/reference/assets/beat.mp3" written in black on a gray background.'); - * } - * - * function draw() { - * background(200); - * - * textWrap(CHAR); - * text(beat.src, 10, 10, 80, 80); - * } - * - *
- */ Object.defineProperty(self, 'src', { get() { const firstChildSrc = self.elt.children[0].src; @@ -3753,7 +3726,6 @@ class MediaElement extends p5.Element { /** * Play audio or video from a media element. * - * @method play * @chainable * @example *
@@ -3814,7 +3786,6 @@ class MediaElement extends p5.Element { * Stops a media element and sets its current time to zero. Calling * `media.play()` will restart playing audio/video from the beginning. * - * @method stop * @chainable * @example *
@@ -3868,7 +3839,6 @@ class MediaElement extends p5.Element { * Pauses a media element. Calling `media.play()` will resume playing * audio/video from the moment it paused. * - * @method pause * @chainable * @example *
@@ -3922,7 +3892,6 @@ class MediaElement extends p5.Element { /** * Play the audio/video repeatedly in a loop. * - * @method loop * @chainable * @example *
@@ -3979,7 +3948,6 @@ class MediaElement extends p5.Element { * Stops the audio/video from playing in a loop. It will stop when it * reaches the end. * - * @method noLoop * @chainable * @example *
@@ -4035,7 +4003,6 @@ class MediaElement extends p5.Element { /** * Sets up logic to check that autoplay succeeded. * - * @method setupAutoplayFailDetection * @private */ _setupAutoplayFailDetection() { @@ -4061,7 +4028,6 @@ class MediaElement extends p5.Element { * media will automatically play. If `false` is passed, as in * `media.autoPlay(false)`, it won't play automatically. * - * @method autoplay * @param {Boolean} [shouldAutoplay] whether the element should autoplay. * @chainable * @example @@ -4135,7 +4101,6 @@ class MediaElement extends p5.Element { * from 0 (off) to 1 (maximum). For example, calling `media.volume(0.5)` * sets the volume to half of its maximum. * - * @method volume * @return {Number} current volume. * * @example @@ -4197,7 +4162,6 @@ class MediaElement extends p5.Element { * Note: Not all browsers support backward playback. Even if they do, * playback might not be smooth. * - * @method speed * @return {Number} current playback speed. * * @example @@ -4234,9 +4198,7 @@ class MediaElement extends p5.Element { * } * */ - /** - * @method speed * @param {Number} speed speed multiplier for playback. * @chainable */ @@ -4260,7 +4222,6 @@ class MediaElement extends p5.Element { * The parameter, `time`, is optional. It's a number that specifies the * time, in seconds, to jump to when playback begins. * - * @method time * @return {Number} current time (in seconds). * * @example @@ -4323,7 +4284,6 @@ class MediaElement extends p5.Element { *
*/ /** - * @method time * @param {Number} time time to jump to (in seconds). * @chainable */ @@ -4339,7 +4299,6 @@ class MediaElement extends p5.Element { /** * Returns the audio/video's duration in seconds. * - * @method duration * @return {Number} duration (in seconds). * * @example @@ -4457,7 +4416,6 @@ class MediaElement extends p5.Element { * helper method for web GL mode to figure out if the element * has been modified and might need to be re-uploaded to texture * memory between frames. - * @method isModified * @private * @return {boolean} a boolean indicating whether or not the * image has been updated or modified since last texture upload. @@ -4471,7 +4429,6 @@ class MediaElement extends p5.Element { * set this value to false after uploading the texture; or might set * it to true if metadata has become available but there is no actual * texture data available yet.. - * @method setModified * @param {boolean} val sets whether or not the element has been * modified. * @private @@ -4485,7 +4442,6 @@ class MediaElement extends p5.Element { * * The `p5.MediaElement` is passed as an argument to the callback function. * - * @method onended * @param {Function} callback function to call when playback ends. * The `p5.MediaElement` is passed as * the argument. @@ -4552,7 +4508,6 @@ class MediaElement extends p5.Element { * * This method is meant to be used with the p5.sound.js addon library. * - * @method connect * @param {AudioNode|Object} audioNode AudioNode from the Web Audio API, * or an object from the p5.sound library */ @@ -4597,8 +4552,6 @@ class MediaElement extends p5.Element { * Disconnect all Web Audio routing, including to main output. * This is useful if you want to re-route the output through * audio effects, for example. - * - * @method disconnect */ disconnect() { if (this.audioSourceNode) { @@ -4615,7 +4568,6 @@ class MediaElement extends p5.Element { * HTMLMediaElement * controls. These vary between web browser. * - * @method showControls * @example *
* @@ -4647,7 +4599,6 @@ class MediaElement extends p5.Element { * HTMLMediaElement * controls. * - * @method hideControls * @example *
* @@ -4709,7 +4660,6 @@ class MediaElement extends p5.Element { * Calling `media.addCue()` returns an ID as a string. This is useful for * removing the cue later. * - * @method addCue * @param {Number} time cue time to run the callback function. * @param {Function} callback function to call at the cue time. * @param {Object} [value] object to pass as the argument to @@ -4756,7 +4706,6 @@ class MediaElement extends p5.Element { /** * Remove a callback based on its ID. * - * @method removeCue * @param {Number} id ID of the cue, created by `media.addCue()`. * @example *
@@ -4820,7 +4769,6 @@ class MediaElement extends p5.Element { /** * Removes all functions scheduled with `media.addCue()`. * - * @method clearCues * @example *
* @@ -4889,9 +4837,36 @@ class MediaElement extends p5.Element { this._prevTime = playbackTime; } -} +}; + +/** + * Path to the media element's source as a string. + * + * @for p5.MediaElement + * @property src + * @return {String} src + * @example + *
+ * + * let beat; + * + * function setup() { + * // Create a p5.MediaElement using createAudio(). + * beat = createAudio('assets/beat.mp3'); + * + * describe('The text "https://p5js.org/reference/assets/beat.mp3" written in black on a gray background.'); + * } + * + * function draw() { + * background(200); + * + * textWrap(CHAR); + * text(beat.src, 10, 10, 80, 80); + * } + * + *
+ */ -p5.MediaElement = MediaElement; /** * A class to describe a file. @@ -4902,7 +4877,6 @@ p5.MediaElement = MediaElement; * createFileInput. * * @class p5.File - * @constructor * @param {File} file wrapped file. * @example *
@@ -4981,47 +4955,8 @@ p5.MediaElement = MediaElement; * *
*/ -class File { +p5.File = class File { constructor(file, pInst) { - /** - * Underlying - * File - * object. All `File` properties and methods are accessible. - * - * @property file - * @example - *
- * - * // Use the file input to load a - * // file and display its info. - * - * function setup() { - * background(200); - * - * // Create a file input and place it beneath - * // the canvas. Call displayInfo() when - * // the file loads. - * let input = createFileInput(displayInfo); - * input.position(0, 100); - * - * describe('A gray square with a file input beneath it. If the user loads a file, its info is written in black.'); - * } - * - * // Use the p5.File once - * // it loads. - * function displayInfo(file) { - * background(200); - * - * // Display the p5.File's name. - * text(file.name, 10, 10, 80, 40); - * // Display the p5.File's type and subtype. - * text(`${file.type}/${file.subtype}`, 10, 70); - * // Display the p5.File's size in bytes. - * text(file.size, 10, 90); - * } - * - *
- */ this.file = file; this._pInst = pInst; @@ -5029,184 +4964,11 @@ class File { // Splitting out the file type into two components // This makes determining if image or text etc simpler const typeList = file.type.split('/'); - /** - * The file - * MIME type - * as a string. For example, `'image'`, `'text'`, and so on. - * - * @property type - * @example - *
- * - * // Use the file input to load a - * // file and display its info. - * - * function setup() { - * background(200); - * - * // Create a file input and place it beneath - * // the canvas. Call displayType() when - * // the file loads. - * let input = createFileInput(displayType); - * input.position(0, 100); - * - * describe('A gray square with a file input beneath it. If the user loads a file, its type is written in black.'); - * } - * - * // Display the p5.File's type - * // once it loads. - * function displayType(file) { - * background(200); - * - * // Display the p5.File's type. - * text(`This is file's type is: ${file.type}`, 10, 10, 80, 80); - * } - * - *
- */ this.type = typeList[0]; - /** - * The file subtype as a string. For example, a file with an `'image'` - * MIME type - * may have a subtype such as ``png`` or ``jpeg``. - * - * @property subtype - * @example - *
- * - * // Use the file input to load a - * // file and display its info. - * - * function setup() { - * background(200); - * - * // Create a file input and place it beneath - * // the canvas. Call displaySubtype() when - * // the file loads. - * let input = createFileInput(displaySubtype); - * input.position(0, 100); - * - * describe('A gray square with a file input beneath it. If the user loads a file, its subtype is written in black.'); - * } - * - * // Display the p5.File's type - * // once it loads. - * function displaySubtype(file) { - * background(200); - * - * // Display the p5.File's subtype. - * text(`This is file's subtype is: ${file.subtype}`, 10, 10, 80, 80); - * } - * - *
- */ this.subtype = typeList[1]; - /** - * The file name as a string. - * - * @property name - * @example - *
- * - * // Use the file input to load a - * // file and display its info. - * - * function setup() { - * background(200); - * - * // Create a file input and place it beneath - * // the canvas. Call displayName() when - * // the file loads. - * let input = createFileInput(displayName); - * input.position(0, 100); - * - * describe('A gray square with a file input beneath it. If the user loads a file, its name is written in black.'); - * } - * - * // Display the p5.File's name - * // once it loads. - * function displayName(file) { - * background(200); - * - * // Display the p5.File's name. - * text(`This is file's name is: ${file.name}`, 10, 10, 80, 80); - * } - * - *
- */ this.name = file.name; - /** - * The number of bytes in the file. - * - * @property size - * @example - *
- * - * // Use the file input to load a - * // file and display its info. - * - * function setup() { - * background(200); - * - * // Create a file input and place it beneath - * // the canvas. Call displaySize() when - * // the file loads. - * let input = createFileInput(displaySize); - * input.position(0, 100); - * - * describe('A gray square with a file input beneath it. If the user loads a file, its size in bytes is written in black.'); - * } - * - * // Display the p5.File's size - * // in bytes once it loads. - * function displaySize(file) { - * background(200); - * - * // Display the p5.File's size. - * text(`This is file has ${file.size} bytes.`, 10, 10, 80, 80); - * } - * - *
- */ this.size = file.size; - /** - * A string containing either the file's image data, text contents, or - * a parsed object in the case of JSON and - * p5.XML objects. - * - * @property data - * @example - *
- * - * // Use the file input to load a - * // file and display its info. - * - * function setup() { - * background(200); - * - * // Create a file input and place it beneath - * // the canvas. Call displayData() when - * // the file loads. - * let input = createFileInput(displayData); - * input.position(0, 100); - * - * describe('A gray square with a file input beneath it. If the user loads a file, its data is written in black.'); - * } - * - * // Display the p5.File's data - * // once it loads. - * function displayData(file) { - * background(200); - * - * // Display the p5.File's data, - * // which looks like a random - * // string of characters. - * text(file.data, 10, 10, 80, 80); - * } - * - *
- */ this.data = undefined; } @@ -5244,9 +5006,230 @@ class File { callback(file); } } -} +}; + +/** + * Underlying + * File + * object. All `File` properties and methods are accessible. + * + * @for p5.File + * @property file + * @example + *
+ * + * // Use the file input to load a + * // file and display its info. + * + * function setup() { + * background(200); + * + * // Create a file input and place it beneath + * // the canvas. Call displayInfo() when + * // the file loads. + * let input = createFileInput(displayInfo); + * input.position(0, 100); + * + * describe('A gray square with a file input beneath it. If the user loads a file, its info is written in black.'); + * } + * + * // Use the p5.File once + * // it loads. + * function displayInfo(file) { + * background(200); + * + * // Display the p5.File's name. + * text(file.name, 10, 10, 80, 40); + * // Display the p5.File's type and subtype. + * text(`${file.type}/${file.subtype}`, 10, 70); + * // Display the p5.File's size in bytes. + * text(file.size, 10, 90); + * } + * + *
+ */ + +/** + * The file + * MIME type + * as a string. For example, `'image'`, `'text'`, and so on. + * + * @for p5.File + * @property type + * @example + *
+ * + * // Use the file input to load a + * // file and display its info. + * + * function setup() { + * background(200); + * + * // Create a file input and place it beneath + * // the canvas. Call displayType() when + * // the file loads. + * let input = createFileInput(displayType); + * input.position(0, 100); + * + * describe('A gray square with a file input beneath it. If the user loads a file, its type is written in black.'); + * } + * + * // Display the p5.File's type + * // once it loads. + * function displayType(file) { + * background(200); + * + * // Display the p5.File's type. + * text(`This is file's type is: ${file.type}`, 10, 10, 80, 80); + * } + * + *
+ */ + +/** + * The file subtype as a string. For example, a file with an `'image'` + * MIME type + * may have a subtype such as ``png`` or ``jpeg``. + * + * @property subtype + * @for p5.File + * @example + *
+ * + * // Use the file input to load a + * // file and display its info. + * + * function setup() { + * background(200); + * + * // Create a file input and place it beneath + * // the canvas. Call displaySubtype() when + * // the file loads. + * let input = createFileInput(displaySubtype); + * input.position(0, 100); + * + * describe('A gray square with a file input beneath it. If the user loads a file, its subtype is written in black.'); + * } + * + * // Display the p5.File's type + * // once it loads. + * function displaySubtype(file) { + * background(200); + * + * // Display the p5.File's subtype. + * text(`This is file's subtype is: ${file.subtype}`, 10, 10, 80, 80); + * } + * + *
+ */ + +/** + * The file name as a string. + * + * @for p5.File + * @property name + * @example + *
+ * + * // Use the file input to load a + * // file and display its info. + * + * function setup() { + * background(200); + * + * // Create a file input and place it beneath + * // the canvas. Call displayName() when + * // the file loads. + * let input = createFileInput(displayName); + * input.position(0, 100); + * + * describe('A gray square with a file input beneath it. If the user loads a file, its name is written in black.'); + * } + * + * // Display the p5.File's name + * // once it loads. + * function displayName(file) { + * background(200); + * + * // Display the p5.File's name. + * text(`This is file's name is: ${file.name}`, 10, 10, 80, 80); + * } + * + *
+ */ +/** + * The number of bytes in the file. + * + * @for p5.File + * @property size + * @example + *
+ * + * // Use the file input to load a + * // file and display its info. + * + * function setup() { + * background(200); + * + * // Create a file input and place it beneath + * // the canvas. Call displaySize() when + * // the file loads. + * let input = createFileInput(displaySize); + * input.position(0, 100); + * + * describe('A gray square with a file input beneath it. If the user loads a file, its size in bytes is written in black.'); + * } + * + * // Display the p5.File's size + * // in bytes once it loads. + * function displaySize(file) { + * background(200); + * + * // Display the p5.File's size. + * text(`This is file has ${file.size} bytes.`, 10, 10, 80, 80); + * } + * + *
+ */ -p5.File = File; +/** + * A string containing either the file's image data, text contents, or + * a parsed object in the case of JSON and + * p5.XML objects. + * + * @for p5.File + * @property data + * @example + *
+ * + * // Use the file input to load a + * // file and display its info. + * + * function setup() { + * background(200); + * + * // Create a file input and place it beneath + * // the canvas. Call displayData() when + * // the file loads. + * let input = createFileInput(displayData); + * input.position(0, 100); + * + * describe('A gray square with a file input beneath it. If the user loads a file, its data is written in black.'); + * } + * + * // Display the p5.File's data + * // once it loads. + * function displayData(file) { + * background(200); + * + * // Display the p5.File's data, + * // which looks like a random + * // string of characters. + * text(file.data, 10, 10, 80, 80); + * } + * + *
+ */ export default p5; diff --git a/src/image/p5.Image.js b/src/image/p5.Image.js index 044e8fab56..444bf5a67c 100644 --- a/src/image/p5.Image.js +++ b/src/image/p5.Image.js @@ -81,67 +81,12 @@ import Renderer from '../core/p5.Renderer'; *
* * @class p5.Image - * @constructor * @param {Number} width * @param {Number} height */ -p5.Image = class { +p5.Image = class Image { constructor(width, height) { - /** - * Image width. - * @type {Number} - * @property {Number} width - * @name width - * @readOnly - * @example - *
- * - * let img; - * - * function preload() { - * img = loadImage('assets/rockies.jpg'); - * } - * - * function setup() { - * image(img, 0, 0); - * let x = img.width / 2; - * let y = img.height / 2; - * let d = 20; - * circle(x, y, d); - * - * describe('An image of a mountain landscape with a white circle drawn in the middle.'); - * } - * - *
- */ this.width = width; - /** - * Image height. - * @type {Number} - * @property height - * @name height - * @readOnly - * @example - *
- * - * let img; - * - * function preload() { - * img = loadImage('assets/rockies.jpg'); - * } - * - * function setup() { - * image(img, 0, 0); - * let x = img.width / 2; - * let y = img.height / 2; - * let d = 20; - * circle(x, y, d); - * - * describe('An image of a mountain landscape with a white circle drawn in the middle.'); - * } - * - *
- */ this.height = height; this.canvas = document.createElement('canvas'); this.canvas.width = this.width; @@ -153,75 +98,6 @@ p5.Image = class { this.gifProperties = null; //For WebGL Texturing only: used to determine whether to reupload texture to GPU this._modified = false; - /** - * An array containing the color of each pixel in the - * p5.Image object. Colors are stored as numbers - * representing red, green, blue, and alpha (RGBA) values. `img.pixels` is a - * one-dimensional array for performance reasons. - * - * Each pixel occupies four elements in the pixels array, one for each - * RGBA value. For example, the pixel at coordinates (0, 0) stores its - * RGBA values at `img.pixels[0]`, `img.pixels[1]`, `img.pixels[2]`, - * and `img.pixels[3]`, respectively. The next pixel at coordinates (1, 0) - * stores its RGBA values at `img.pixels[4]`, `img.pixels[5]`, - * `img.pixels[6]`, and `img.pixels[7]`. And so on. The `img.pixels` array - * for a 100Ɨ100 p5.Image object has - * 100 Ɨ 100 Ɨ 4 = 40,000 elements. - * - * Accessing the RGBA values for a pixel in the - * p5.Image object requires a little math as - * shown below. The img.loadPixels() - * method must be called before accessing the `img.pixels` array. The - * img.updatePixels() method must be - * called after any changes are made. - * - * @property {Number[]} pixels - * @name pixels - * @example - *
- * - * let img = createImage(66, 66); - * img.loadPixels(); - * let numPixels = 4 * img.width * img.height; - * for (let i = 0; i < numPixels; i += 4) { - * // Red. - * img.pixels[i] = 0; - * // Green. - * img.pixels[i + 1] = 0; - * // Blue. - * img.pixels[i + 2] = 0; - * // Alpha. - * img.pixels[i + 3] = 255; - * } - * img.updatePixels(); - * image(img, 17, 17); - * - * describe('A black square drawn in the middle of a gray square.'); - * - *
- * - *
- * - * let img = createImage(66, 66); - * img.loadPixels(); - * let numPixels = 4 * img.width * img.height; - * for (let i = 0; i < numPixels; i += 4) { - * // Red. - * img.pixels[i] = 255; - * // Green. - * img.pixels[i + 1] = 0; - * // Blue. - * img.pixels[i + 2] = 0; - * // Alpha. - * img.pixels[i + 3] = 255; - * } - * img.updatePixels(); - * image(img, 17, 17); - * - * describe('A red square drawn in the middle of a gray square.'); - * - *
- */ this.pixels = []; } @@ -233,7 +109,6 @@ p5.Image = class { * in a number to set the density. If a non-positive number is provided, * it defaults to 1. * - * @method pixelDensity * @param {Number} [density] A scaling factor for the number of pixels per * side * @returns {Number} The current density if called without arguments, or the instance for chaining if setting density. @@ -311,7 +186,6 @@ p5.Image = class { * p5.Image object into the `img.pixels` array. * This method must be called before reading or modifying pixel values. * - * @method loadPixels * @example *
* @@ -374,7 +248,6 @@ p5.Image = class { * then calling `img.updatePixels()` will update the pixels in current * frame. * - * @method updatePixels * @param {Integer} x x-coordinate of the upper-left corner * of the subsection to update. * @param {Integer} y y-coordinate of the upper-left corner @@ -421,7 +294,6 @@ p5.Image = class { *
*/ /** - * @method updatePixels */ updatePixels(x, y, w, h) { p5.Renderer2D.prototype.updatePixels.call(this, x, y, w, h); @@ -451,7 +323,6 @@ p5.Image = class { * Use img.get() to work directly with * p5.Image objects. * - * @method get * @param {Number} x x-coordinate of the pixel. * @param {Number} y y-coordinate of the pixel. * @param {Number} w width of the subsection to be returned. @@ -515,11 +386,9 @@ p5.Image = class { *
*/ /** - * @method get * @return {p5.Image} whole p5.Image */ /** - * @method get * @param {Number} x * @param {Number} y * @return {Number[]} color of the pixel at (x, y) in array format `[R, G, B, A]`. @@ -549,7 +418,6 @@ p5.Image = class { * img.updatePixels() must be called * after using `img.set()` for changes to appear. * - * @method set * @param {Number} x x-coordinate of the pixel. * @param {Number} y y-coordinate of the pixel. * @param {Number|Number[]|Object} a grayscale value | pixel array | @@ -631,7 +499,6 @@ p5.Image = class { * on an image that was 500 × 300 pixels will resize it to * 50 × 30 pixels. * - * @method resize * @param {Number} width resized image width. * @param {Number} height resized image height. * @example @@ -774,7 +641,6 @@ p5.Image = class { * to this one. Calling `img.copy()` will scale pixels from the source * region if it isn't the same size as the destination region. * - * @method copy * @param {p5.Image|p5.Element} srcImage source image. * @param {Integer} sx x-coordinate of the source's upper-left corner. * @param {Integer} sy y-coordinate of the source's upper-left corner. @@ -829,7 +695,6 @@ p5.Image = class { *
*/ /** - * @method copy * @param {Integer} sx * @param {Integer} sy * @param {Integer} sw @@ -849,7 +714,6 @@ p5.Image = class { * this image. Masks are cumulative, once applied to an image * object, they cannot be removed. * - * @method mask * @param {p5.Image} srcImage source image. * * @example @@ -959,7 +823,6 @@ p5.Image = class { * `DILATE` * Increases the light areas. No parameter is used. * - * @method filter * @param {Constant} filterType either THRESHOLD, GRAY, OPAQUE, INVERT, * POSTERIZE, ERODE, DILATE or BLUR. * @param {Number} [filterParam] parameter unique to each filter. @@ -1110,7 +973,6 @@ p5.Image = class { * p5.Image object into this one. The `blendMode` * parameter blends the images' colors to create different effects. * - * @method blend * @param {p5.Image} srcImage source image * @param {Integer} sx x-coordinate of the source's upper-left corner. * @param {Integer} sy y-coordinate of the source's upper-left corner. @@ -1193,7 +1055,6 @@ p5.Image = class { *
*/ /** - * @method blend * @param {Integer} sx * @param {Integer} sy * @param {Integer} sw @@ -1214,7 +1075,6 @@ p5.Image = class { * helper method for web GL mode to indicate that an image has been * changed or unchanged since last upload. gl texture upload will * set this value to false after uploading the texture. - * @method setModified * @param {boolean} val sets whether or not the image has been * modified. * @private @@ -1227,7 +1087,6 @@ p5.Image = class { * helper method for web GL mode to figure out if the image * has been modified and might need to be re-uploaded to texture * memory between frames. - * @method isModified * @private * @return {boolean} a boolean indicating whether or not the * image has been updated or modified since last texture upload. @@ -1253,7 +1112,6 @@ p5.Image = class { * The image will only be downloaded as an animated GIF if the * p5.Image object was loaded from a GIF file. * See saveGif() to create new GIFs. - * @method save * @param {String} filename filename. Defaults to 'untitled'. * @param {String} [extension] file extension, either 'png' or 'jpg'. * Defaults to 'png'. @@ -1296,7 +1154,6 @@ p5.Image = class { /** * Restarts an animated GIF at its first frame. * - * @method reset * @example *
* @@ -1335,7 +1192,6 @@ p5.Image = class { /** * Gets the index of the current frame in an animated GIF. * - * @method getCurrentFrame * @return {Number} index of the GIF's current frame. * @example *
@@ -1366,7 +1222,6 @@ p5.Image = class { /** * Sets the current frame in an animated GIF. * - * @method setFrame * @param {Number} index index of the frame to display. * @example *
@@ -1414,7 +1269,6 @@ p5.Image = class { /** * Returns the number of frames in an animated GIF. * - * @method numFrames * @return {Number} number of frames in the GIF. * * @example @@ -1447,8 +1301,6 @@ p5.Image = class { * Plays an animated GIF that was paused with * img.pause(). * - * @method play - * * @example *
* @@ -1485,8 +1337,6 @@ p5.Image = class { * Pauses an animated GIF. The GIF can be resumed by calling * img.play(). * - * @method pause - * * @example *
* @@ -1526,7 +1376,6 @@ p5.Image = class { * at `index` will have its delay modified. All other frames will keep * their default delay. * - * @method delay * @param {Number} d delay in milliseconds between switching frames. * @param {Number} [index] index of the frame that will have its delay modified. * @@ -1591,4 +1440,134 @@ p5.Image = class { } } }; + +/** + * Image width. + * @type {Number} + * @for p5.Image + * @property {Number} width + * @name width + * @readOnly + * @example + *
+ * + * let img; + * + * function preload() { + * img = loadImage('assets/rockies.jpg'); + * } + * + * function setup() { + * image(img, 0, 0); + * let x = img.width / 2; + * let y = img.height / 2; + * let d = 20; + * circle(x, y, d); + * + * describe('An image of a mountain landscape with a white circle drawn in the middle.'); + * } + * + *
+ */ + +/** + * Image height. + * @type {Number} + * @for p5.Image + * @property height + * @name height + * @readOnly + * @example + *
+ * + * let img; + * + * function preload() { + * img = loadImage('assets/rockies.jpg'); + * } + * + * function setup() { + * image(img, 0, 0); + * let x = img.width / 2; + * let y = img.height / 2; + * let d = 20; + * circle(x, y, d); + * + * describe('An image of a mountain landscape with a white circle drawn in the middle.'); + * } + * + *
+ */ + +/** + * An array containing the color of each pixel in the + * p5.Image object. Colors are stored as numbers + * representing red, green, blue, and alpha (RGBA) values. `img.pixels` is a + * one-dimensional array for performance reasons. + * + * Each pixel occupies four elements in the pixels array, one for each + * RGBA value. For example, the pixel at coordinates (0, 0) stores its + * RGBA values at `img.pixels[0]`, `img.pixels[1]`, `img.pixels[2]`, + * and `img.pixels[3]`, respectively. The next pixel at coordinates (1, 0) + * stores its RGBA values at `img.pixels[4]`, `img.pixels[5]`, + * `img.pixels[6]`, and `img.pixels[7]`. And so on. The `img.pixels` array + * for a 100Ɨ100 p5.Image object has + * 100 Ɨ 100 Ɨ 4 = 40,000 elements. + * + * Accessing the RGBA values for a pixel in the + * p5.Image object requires a little math as + * shown below. The img.loadPixels() + * method must be called before accessing the `img.pixels` array. The + * img.updatePixels() method must be + * called after any changes are made. + * + * @for p5.Image + * @property {Number[]} pixels + * @name pixels + * @example + *
+ * + * let img = createImage(66, 66); + * img.loadPixels(); + * let numPixels = 4 * img.width * img.height; + * for (let i = 0; i < numPixels; i += 4) { + * // Red. + * img.pixels[i] = 0; + * // Green. + * img.pixels[i + 1] = 0; + * // Blue. + * img.pixels[i + 2] = 0; + * // Alpha. + * img.pixels[i + 3] = 255; + * } + * img.updatePixels(); + * image(img, 17, 17); + * + * describe('A black square drawn in the middle of a gray square.'); + * + *
+ * + *
+ * + * let img = createImage(66, 66); + * img.loadPixels(); + * let numPixels = 4 * img.width * img.height; + * for (let i = 0; i < numPixels; i += 4) { + * // Red. + * img.pixels[i] = 255; + * // Green. + * img.pixels[i + 1] = 0; + * // Blue. + * img.pixels[i + 2] = 0; + * // Alpha. + * img.pixels[i + 3] = 255; + * } + * img.updatePixels(); + * image(img, 17, 17); + * + * describe('A red square drawn in the middle of a gray square.'); + * + *
+ */ + export default p5.Image; diff --git a/src/typography/p5.Font.js b/src/typography/p5.Font.js index 15facd22c4..d2dae008d4 100644 --- a/src/typography/p5.Font.js +++ b/src/typography/p5.Font.js @@ -13,7 +13,6 @@ import * as constants from '../core/constants'; /** * A class to describe fonts. * @class p5.Font - * @constructor * @param {p5} [pInst] pointer to p5 instance. * @example *
@@ -36,19 +35,12 @@ import * as constants from '../core/constants'; * *
*/ -p5.Font = class { +p5.Font = class Font { constructor(p){ this.parent = p; this.cache = {}; - /** - * Underlying - * opentype.js - * font object. - * @property font - * @name font - */ this.font = undefined; } @@ -65,7 +57,6 @@ p5.Font = class { * determine the bounding box. By default, `font.textBounds()` will use the * current textSize(). * - * @method textBounds * @param {String} str string of text. * @param {Number} x x-coordinate of the text. * @param {Number} y y-coordinate of the text. @@ -270,7 +261,6 @@ p5.Font = class { * than 0. The value represents the threshold angle to use when determining * whether two edges are collinear. * - * @method textToPoints * @param {String} str string of text. * @param {Number} x x-coordinate of the text. * @param {Number} y y-coordinate of the text. @@ -572,6 +562,16 @@ p5.Font = class { return { x, y }; } }; + +/** + * Underlying + * opentype.js + * font object. + * @for p5.Font + * @property font + * @name font + */ + // path-utils function pathToPoints(cmds, options) { From 1afc553f885a66850be4a648feebabb8a1faa556 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:47:43 -0500 Subject: [PATCH 14/45] Convert p5.Vector and handle static methods --- package.json | 2 +- src/math/p5.Vector.js | 116 +++++++++--------------------------------- utils/convert.js | 1 + 3 files changed, 27 insertions(+), 92 deletions(-) diff --git a/package.json b/package.json index d9cb4489f2..d453e4186e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build": "rollup -c", "preview": "vite", "dev": "grunt yui browserify:dev connect:yui watch:quick", - "docs": "documentation build ./src/app.js -o ./docs/data.json && node ./utils/convert.js", + "docs": "documentation build ./src/**/*.js -o ./docs/data.json && node ./utils/convert.js", "test": "vitest run", "lint": "eslint .", "lint:fix": "eslint --fix ." diff --git a/src/math/p5.Vector.js b/src/math/p5.Vector.js index acf378c9f9..6df0447166 100644 --- a/src/math/p5.Vector.js +++ b/src/math/p5.Vector.js @@ -46,7 +46,6 @@ function vector(p5, fn){ * methods inside the `p5.Vector` class. * * @class p5.Vector - * @constructor * @param {Number} [x] x component of the vector. * @param {Number} [y] y component of the vector. * @param {Number} [z] z component of the vector. @@ -92,7 +91,7 @@ function vector(p5, fn){ *
*
*/ - p5.Vector = class { + p5.Vector = class Vector { // This is how it comes in with createVector() // This check if the first argument is a function constructor(...args) { @@ -110,33 +109,14 @@ function vector(p5, fn){ y = args[1] || 0; z = args[2] || 0; } - /** - * The x component of the vector - * @type {Number} - * @property x - * @name x - */ this.x = x; - /** - * The y component of the vector - * @type {Number} - * @property y - * @name y - */ this.y = y; - /** - * The z component of the vector - * @type {Number} - * @property z - * @name z - */ this.z = z; } /** * Returns a string representation of a vector. This method is useful for * printing vectors to the console while debugging. - * @method toString * @return {String} string representation of the vector. * @example *
@@ -158,7 +138,6 @@ function vector(p5, fn){ * a p5.Vector object, or an array of numbers. * Calling `set()` with no arguments sets the vector's components to 0. * - * @method set * @param {Number} [x] x component of the vector. * @param {Number} [y] y component of the vector. * @param {Number} [z] z component of the vector. @@ -191,7 +170,6 @@ function vector(p5, fn){ *
*/ /** - * @method set * @param {p5.Vector|Number[]} value vector to set. * @chainable */ @@ -217,7 +195,6 @@ function vector(p5, fn){ /** * Returns a copy of the p5.Vector object. * - * @method copy * @return {p5.Vector} copy of the p5.Vector object. * @example *
@@ -255,7 +232,6 @@ function vector(p5, fn){ * p5.Vector object and doesn't change the * originals. * - * @method add * @param {Number} x x component of the vector to be added. * @param {Number} [y] y component of the vector to be added. * @param {Number} [z] z component of the vector to be added. @@ -342,7 +318,6 @@ function vector(p5, fn){ *
*/ /** - * @method add * @param {p5.Vector|Number[]} value The vector to add * @chainable */ @@ -374,7 +349,6 @@ function vector(p5, fn){ * p5.Vector object and doesn't change the * originals. * - * @method rem * @param {Number} x x component of divisor vector. * @param {Number} y y component of divisor vector. * @param {Number} z z component of divisor vector. @@ -423,7 +397,6 @@ function vector(p5, fn){ *
*/ /** - * @method rem * @param {p5.Vector | Number[]} value divisor vector. * @chainable */ @@ -491,7 +464,6 @@ function vector(p5, fn){ * p5.Vector object and doesn't change the * originals. * - * @method sub * @param {Number} x x component of the vector to subtract. * @param {Number} [y] y component of the vector to subtract. * @param {Number} [z] z component of the vector to subtract. @@ -578,7 +550,6 @@ function vector(p5, fn){ *
*/ /** - * @method sub * @param {p5.Vector|Number[]} value the vector to subtract * @chainable */ @@ -611,7 +582,6 @@ function vector(p5, fn){ * p5.Vector object and doesn't change the * originals. * - * @method mult * @param {Number} n The number to multiply with the vector * @chainable * @example @@ -721,7 +691,6 @@ function vector(p5, fn){ */ /** - * @method mult * @param {Number} x number to multiply with the x component of the vector. * @param {Number} y number to multiply with the y component of the vector. * @param {Number} [z] number to multiply with the z component of the vector. @@ -729,13 +698,11 @@ function vector(p5, fn){ */ /** - * @method mult * @param {Number[]} arr array to multiply with the components of the vector. * @chainable */ /** - * @method mult * @param {p5.Vector} v vector to multiply with the components of the original vector. * @chainable */ @@ -829,7 +796,6 @@ function vector(p5, fn){ * p5.Vector object and doesn't change the * originals. * - * @method div * @param {number} n The number to divide the vector by * @chainable * @example @@ -939,7 +905,6 @@ function vector(p5, fn){ */ /** - * @method div * @param {Number} x number to divide with the x component of the vector. * @param {Number} y number to divide with the y component of the vector. * @param {Number} [z] number to divide with the z component of the vector. @@ -947,13 +912,11 @@ function vector(p5, fn){ */ /** - * @method div * @param {Number[]} arr array to divide the components of the vector by. * @chainable */ /** - * @method div * @param {p5.Vector} v vector to divide the components of the original vector by. * @chainable */ @@ -1056,7 +1019,6 @@ function vector(p5, fn){ /** * Returns the magnitude (length) of the vector. * - * @method mag * @return {Number} magnitude of the vector. * @example *
@@ -1078,7 +1040,6 @@ function vector(p5, fn){ /** * Returns the magnitude (length) of the vector squared. * - * @method magSq * @return {number} squared magnitude of the vector. * @example *
@@ -1116,7 +1077,6 @@ function vector(p5, fn){ * The static version of `dot()`, as in `p5.Vector.dot(v1, v2)`, is the same * as calling `v1.dot(v2)`. * - * @method dot * @param {Number} x x component of the vector. * @param {Number} [y] y component of the vector. * @param {Number} [z] z component of the vector. @@ -1178,7 +1138,6 @@ function vector(p5, fn){ *
*/ /** - * @method dot * @param {p5.Vector} v p5.Vector to be dotted. * @return {Number} */ @@ -1198,7 +1157,6 @@ function vector(p5, fn){ * The static version of `cross()`, as in `p5.Vector.cross(v1, v2)`, is the same * as calling `v1.cross(v2)`. * - * @method cross * @param {p5.Vector} v p5.Vector to be crossed. * @return {p5.Vector} cross product as a p5.Vector. * @example @@ -1243,7 +1201,6 @@ function vector(p5, fn){ * Use dist() to calculate the distance between points * using coordinates as in `dist(x1, y1, x2, y2)`. * - * @method dist * @param {p5.Vector} v x, y, and z coordinates of a p5.Vector. * @return {Number} distance. * @example @@ -1319,7 +1276,6 @@ function vector(p5, fn){ * returns a new p5.Vector object and doesn't change * the original. * - * @method normalize * @return {p5.Vector} normalized p5.Vector. * @example *
@@ -1392,7 +1348,6 @@ function vector(p5, fn){ * new p5.Vector object and doesn't change the * original. * - * @method limit * @param {Number} max maximum magnitude for the vector. * @chainable * @example @@ -1464,7 +1419,6 @@ function vector(p5, fn){ * a new p5.Vector object and doesn't change the * original. * - * @method setMag * @param {number} len new length for this vector. * @chainable * @example @@ -1538,7 +1492,6 @@ function vector(p5, fn){ * The static version of `heading()`, as in `p5.Vector.heading(v)`, works the * same way. * - * @method heading * @return {Number} angle of rotation. * @example *
@@ -1616,7 +1569,6 @@ function vector(p5, fn){ * createVector(), `setHeading()` uses * the units of the current angleMode(). * - * @method setHeading * @param {number} angle angle of rotation. * @chainable * @example @@ -1699,7 +1651,6 @@ function vector(p5, fn){ * returns a new p5.Vector object and doesn't change * the original. * - * @method rotate * @param {number} angle angle of rotation. * @chainable * @example @@ -1803,7 +1754,6 @@ function vector(p5, fn){ * angles in the units of the current * angleMode(). * - * @method angleBetween * @param {p5.Vector} value x, y, and z components of a p5.Vector. * @return {Number} angle between the vectors. * @example @@ -1919,7 +1869,6 @@ function vector(p5, fn){ * returns a new p5.Vector object and doesn't change * the original. * - * @method lerp * @param {Number} x x component. * @param {Number} y y component. * @param {Number} z z component. @@ -1991,7 +1940,6 @@ function vector(p5, fn){ *
*/ /** - * @method lerp * @param {p5.Vector} v p5.Vector to lerp toward. * @param {Number} amt * @chainable @@ -2022,7 +1970,6 @@ function vector(p5, fn){ * returns a new p5.Vector object and doesn't change * the original. * - * @method slerp * @param {p5.Vector} v p5.Vector to slerp toward. * @param {Number} amt amount of interpolation between 0.0 (old vector) * and 1.0 (new vector). 0.5 is halfway between. @@ -2181,7 +2128,6 @@ function vector(p5, fn){ * returns a new p5.Vector object and doesn't change * the original. * - * @method reflect * @param {p5.Vector} surfaceNormal p5.Vector * to reflect about. * @chainable @@ -2250,7 +2196,6 @@ function vector(p5, fn){ /** * Returns the vector's components as an array of numbers. * - * @method array * @return {Number[]} array with the vector's components. * @example *
@@ -2279,7 +2224,6 @@ function vector(p5, fn){ * The static version of `equals()`, as in `p5.Vector.equals(v0, v1)`, * interprets both parameters as p5.Vector objects. * - * @method equals * @param {Number} [x] x component of the vector. * @param {Number} [y] y component of the vector. * @param {Number} [z] z component of the vector. @@ -2325,7 +2269,6 @@ function vector(p5, fn){ *
*/ /** - * @method equals * @param {p5.Vector|Array} value vector to compare. * @return {Boolean} */ @@ -2352,7 +2295,6 @@ function vector(p5, fn){ /** * Make a new 2D vector from an angle. * - * @method fromAngle * @static * @param {Number} angle desired angle, in radians. Unaffected by angleMode(). * @param {Number} [length] length of the new vector (defaults to 1). @@ -2409,7 +2351,6 @@ function vector(p5, fn){ /** * Make a new 3D vector from a pair of ISO spherical angles. * - * @method fromAngles * @static * @param {Number} theta polar angle in radians (zero is up). * @param {Number} phi azimuthal angle in radians @@ -2469,7 +2410,6 @@ function vector(p5, fn){ /** * Make a new 2D unit vector with a random heading. * - * @method random2D * @static * @return {p5.Vector} new p5.Vector object. * @example @@ -2520,7 +2460,6 @@ function vector(p5, fn){ /** * Make a new 3D unit vector with a random heading. * - * @method random3D * @static * @return {p5.Vector} new p5.Vector object. * @example @@ -2544,7 +2483,6 @@ function vector(p5, fn){ // Returns a copy of a vector. /** - * @method copy * @static * @param {p5.Vector} v the p5.Vector to create a copy of * @return {p5.Vector} the copy of the p5.Vector object @@ -2556,7 +2494,6 @@ function vector(p5, fn){ // Adds two vectors together and returns a new one. /** - * @method add * @static * @param {p5.Vector} v1 A p5.Vector to add * @param {p5.Vector} v2 A p5.Vector to add @@ -2582,13 +2519,11 @@ function vector(p5, fn){ // Returns a vector remainder when it is divided by another vector /** - * @method rem * @static * @param {p5.Vector} v1 The dividend p5.Vector * @param {p5.Vector} v2 The divisor p5.Vector */ /** - * @method rem * @static * @param {p5.Vector} v1 * @param {p5.Vector} v2 @@ -2607,7 +2542,6 @@ function vector(p5, fn){ * vector (`v2`) is subtracted from the first (`v1`), resulting in `v1-v2`. */ /** - * @method sub * @static * @param {p5.Vector} v1 A p5.Vector to subtract from * @param {p5.Vector} v2 A p5.Vector to subtract @@ -2636,7 +2570,6 @@ function vector(p5, fn){ */ /** - * @method mult * @static * @param {Number} x * @param {Number} y @@ -2645,7 +2578,6 @@ function vector(p5, fn){ */ /** - * @method mult * @static * @param {p5.Vector} v * @param {Number} n @@ -2653,7 +2585,6 @@ function vector(p5, fn){ */ /** - * @method mult * @static * @param {p5.Vector} v0 * @param {p5.Vector} v1 @@ -2661,7 +2592,6 @@ function vector(p5, fn){ */ /** - * @method mult * @static * @param {p5.Vector} v0 * @param {Number[]} arr @@ -2688,7 +2618,6 @@ function vector(p5, fn){ */ /** - * @method rotate * @static * @param {p5.Vector} v * @param {Number} angle @@ -2715,7 +2644,6 @@ function vector(p5, fn){ */ /** - * @method div * @static * @param {Number} x * @param {Number} y @@ -2724,7 +2652,6 @@ function vector(p5, fn){ */ /** - * @method div * @static * @param {p5.Vector} v * @param {Number} n @@ -2732,7 +2659,6 @@ function vector(p5, fn){ */ /** - * @method div * @static * @param {p5.Vector} v0 * @param {p5.Vector} v1 @@ -2740,7 +2666,6 @@ function vector(p5, fn){ */ /** - * @method div * @static * @param {p5.Vector} v0 * @param {Number[]} arr @@ -2767,7 +2692,6 @@ function vector(p5, fn){ * Calculates the dot product of two vectors. */ /** - * @method dot * @static * @param {p5.Vector} v1 first p5.Vector. * @param {p5.Vector} v2 second p5.Vector. @@ -2781,7 +2705,6 @@ function vector(p5, fn){ * Calculates the cross product of two vectors. */ /** - * @method cross * @static * @param {p5.Vector} v1 first p5.Vector. * @param {p5.Vector} v2 second p5.Vector. @@ -2796,7 +2719,6 @@ function vector(p5, fn){ * point as a vector object). */ /** - * @method dist * @static * @param {p5.Vector} v1 The first p5.Vector * @param {p5.Vector} v2 The second p5.Vector @@ -2811,7 +2733,6 @@ function vector(p5, fn){ * new vector. */ /** - * @method lerp * @static * @param {p5.Vector} v1 * @param {p5.Vector} v2 @@ -2842,7 +2763,6 @@ function vector(p5, fn){ * between 2D vectors is always a 2D vector. */ /** - * @method slerp * @static * @param {p5.Vector} v1 old vector. * @param {p5.Vector} v2 new vector. @@ -2871,7 +2791,6 @@ function vector(p5, fn){ * a float (this is simply the equation `sqrt(x*x + y*y + z*z)`.) */ /** - * @method mag * @static * @param {p5.Vector} vecT The vector to return the magnitude of * @return {Number} The magnitude of vecT @@ -2887,7 +2806,6 @@ function vector(p5, fn){ * case of comparing vectors, etc. */ /** - * @method magSq * @static * @param {p5.Vector} vecT the vector to return the squared magnitude of * @return {Number} the squared magnitude of vecT @@ -2900,7 +2818,6 @@ function vector(p5, fn){ * Normalize the vector to length 1 (make it a unit vector). */ /** - * @method normalize * @static * @param {p5.Vector} v The vector to normalize * @param {p5.Vector} [target] The vector to receive the result @@ -2926,7 +2843,6 @@ function vector(p5, fn){ * parameter. */ /** - * @method limit * @static * @param {p5.Vector} v the vector to limit * @param {Number} max @@ -2953,7 +2869,6 @@ function vector(p5, fn){ * parameter. */ /** - * @method setMag * @static * @param {p5.Vector} v the vector to set the magnitude of * @param {number} len @@ -2982,7 +2897,6 @@ function vector(p5, fn){ * consideration, and give the angle in radians or degrees accordingly. */ /** - * @method heading * @static * @param {p5.Vector} v the vector to find the angle of * @return {Number} the angle of rotation @@ -2997,7 +2911,6 @@ function vector(p5, fn){ * give the angle in radians or degrees accordingly. */ /** - * @method angleBetween * @static * @param {p5.Vector} v1 the first vector. * @param {p5.Vector} v2 the second vector. @@ -3012,7 +2925,6 @@ function vector(p5, fn){ * plane in 3D. */ /** - * @method reflect * @static * @param {p5.Vector} incidentVector vector to be reflected. * @param {p5.Vector} surfaceNormal @@ -3041,7 +2953,6 @@ function vector(p5, fn){ * method to copy into your own vector. */ /** - * @method array * @static * @param {p5.Vector} v the vector to convert to an array * @return {Number[]} an Array with the 3 values @@ -3054,7 +2965,6 @@ function vector(p5, fn){ * Equality check against a p5.Vector */ /** - * @method equals * @static * @param {p5.Vector|Array} v1 the first vector to compare * @param {p5.Vector|Array} v2 the second vector to compare @@ -3075,6 +2985,30 @@ function vector(p5, fn){ return v.equals(v2); } }; + + /** + * The x component of the vector + * @type {Number} + * @for p5.Vector + * @property x + * @name x + */ + + /** + * The y component of the vector + * @type {Number} + * @for p5.Vector + * @property y + * @name y + */ + + /** + * The z component of the vector + * @type {Number} + * @for p5.Vector + * @property z + * @name z + */ } export default vector; diff --git a/utils/convert.js b/utils/convert.js index d38f7072e0..2e031d87c7 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -388,6 +388,7 @@ for (const entry of allData) { ...typeObject(entry.returns[0].type).name }, class: className, + static: entry.scope === 'static' && 1, module, submodule }; From e0dd7ae8977b3a40d370d5e4d16e97f3cb870808 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:54:24 -0500 Subject: [PATCH 15/45] Convert p5.Camera, fix p5 prototype methods with @for tag --- src/webgl/p5.Camera.js | 18 ------------------ utils/convert.js | 4 +++- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index 64d64105e5..da0ebf39fb 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -28,7 +28,6 @@ import p5 from '../core/main'; * If no parameters are given, the following default is used: * camera(0, 0, (height/2) / tan(PI/6), 0, 0, 0, 0, 1, 0) * @method camera - * @constructor * @for p5 * @param {Number} [x] camera position value on x axis * @param {Number} [y] camera position value on y axis @@ -738,7 +737,6 @@ p5.Camera = class Camera { * Accepts the same parameters as the global * perspective(). * More information on this function can be found there. - * @method perspective * @for p5.Camera * @example *
@@ -857,7 +855,6 @@ p5.Camera = class Camera { * Accepts the same parameters as the global * ortho(). * More information on this function can be found there. - * @method ortho * @for p5.Camera * @example *
@@ -957,7 +954,6 @@ p5.Camera = class Camera { * Accepts the same parameters as the global * frustum(). * More information on this function can be found there. - * @method frustum * @for p5.Camera * @example *
@@ -1057,7 +1053,6 @@ p5.Camera = class Camera { /** * Rotate camera view about arbitrary axis defined by x,y,z * based on http://learnwebgl.brown37.net/07_cameras/camera_rotating_motion.html - * @method _rotateView * @private */ _rotateView(a, x, y, z) { @@ -1101,7 +1096,6 @@ p5.Camera = class Camera { /** * Panning rotates the camera view to the left and right. - * @method pan * @param {Number} angle amount to rotate camera in current * angleMode units. * Greater than 0 values rotate counterclockwise (to the left). @@ -1159,7 +1153,6 @@ p5.Camera = class Camera { /** * Tilting rotates the camera view up and down. - * @method tilt * @param {Number} angle amount to rotate camera in current * angleMode units. * Greater than 0 values rotate counterclockwise (to the left). @@ -1217,7 +1210,6 @@ p5.Camera = class Camera { /** * Reorients the camera to look at a position in world space. - * @method lookAt * @for p5.Camera * @param {Number} x x position of a point in world space * @param {Number} y y position of a point in world space @@ -1287,7 +1279,6 @@ p5.Camera = class Camera { * Accepts the same parameters as the global * camera(). * More information on this function can be found there. - * @method camera * @for p5.Camera * @example *
@@ -1448,7 +1439,6 @@ p5.Camera = class Camera { /** * Move camera along its local axes while maintaining current camera orientation. - * @method move * @param {Number} x amount to move along camera's left-right axis * @param {Number} y amount to move along camera's up-down axis * @param {Number} z amount to move along camera's forward-backward axis @@ -1521,7 +1511,6 @@ p5.Camera = class Camera { /** * Set camera position in world-space while maintaining current camera * orientation. - * @method setPosition * @param {Number} x x position of a point in world space * @param {Number} y y position of a point in world space * @param {Number} z z position of a point in world space @@ -1585,7 +1574,6 @@ p5.Camera = class Camera { * the target camera. If the target camera is active, it will be reflected * on the screen. * - * @method set * @param {p5.Camera} cam source camera * * @example @@ -1663,7 +1651,6 @@ p5.Camera = class Camera { * interpolation is possible if the ratios of left, right, top and bottom are equal to each other. * For example, when it is changed by orbitControl(). * - * @method slerp * @param {p5.Camera} cam0 first p5.Camera * @param {p5.Camera} cam1 second p5.Camera * @param {Number} amt amount to use for interpolation during slerp @@ -2005,7 +1992,6 @@ p5.Camera = class Camera { /** * Returns a copy of a camera. - * @method copy * @private */ copy() { @@ -2036,7 +2022,6 @@ p5.Camera = class Camera { /** * Returns a camera's local axes: left-right, up-down, and forward-backward, * as defined by vectors in world-space. - * @method _getLocalAxes * @private */ _getLocalAxes() { @@ -2093,7 +2078,6 @@ p5.Camera = class Camera { /** * Orbits the camera about center point. For use with orbitControl(). - * @method _orbit * @private * @param {Number} dTheta change in spherical coordinate theta * @param {Number} dPhi change in spherical coordinate phi @@ -2163,7 +2147,6 @@ p5.Camera = class Camera { /** * Orbits the camera about center point. For use with orbitControl(). * Unlike _orbit(), the direction of rotation always matches the direction of pointer movement. - * @method _orbitFree * @private * @param {Number} dx the x component of the rotation vector. * @param {Number} dy the y component of the rotation vector. @@ -2240,7 +2223,6 @@ p5.Camera = class Camera { /** * Returns true if camera is currently attached to renderer. - * @method _isActive * @private */ _isActive() { diff --git a/utils/convert.js b/utils/convert.js index 2e031d87c7..1f69c5f25a 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -162,9 +162,11 @@ for (const key in submodules) { } function getModuleInfo(entry) { + const entryForTag = entry.tags.find(tag => tag.title === 'for'); + const entryForTagValue = entryForTag && entryForTag.description; const file = entry.context.file; let { module, submodule, for: forEntry } = fileModuleInfo[file] || {}; - forEntry = entry.memberof || forEntry; + forEntry = entry.memberof || entryForTagValue || forEntry; return { module, submodule, forEntry }; } From 254d3b0f7fe3482ba76a776fd524b10cadb6485a Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:55:56 -0500 Subject: [PATCH 16/45] Convert p5.Matrix --- src/webgl/p5.Matrix.js | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/webgl/p5.Matrix.js b/src/webgl/p5.Matrix.js index 8b288c6ed7..c4df042a62 100644 --- a/src/webgl/p5.Matrix.js +++ b/src/webgl/p5.Matrix.js @@ -21,10 +21,9 @@ if (typeof Float32Array !== 'undefined') { * for model and view matrix manipulation in the p5js webgl renderer. * @class p5.Matrix * @private - * @constructor * @param {Array} [mat4] column-major array literal of our 4Ɨ4 matrix */ -p5.Matrix = class { +p5.Matrix = class Matrix { constructor(...args){ // This is default behavior when object @@ -51,13 +50,11 @@ p5.Matrix = class { * Sets the x, y, and z component of the vector using two or three separate * variables, the data from a p5.Matrix, or the values from a float array. * - * @method set * @param {p5.Matrix|Float32Array|Number[]} [inMatrix] the input p5.Matrix or * an Array of length 16 * @chainable */ /** - * @method set * @param {Number[]} elements 16 numbers passed by value to avoid * array copying. * @chainable @@ -93,7 +90,6 @@ p5.Matrix = class { /** * Gets a copy of the vector, returns a p5.Matrix object. * - * @method get * @return {p5.Matrix} the copy of the p5.Matrix object */ get() { @@ -105,7 +101,6 @@ p5.Matrix = class { * If this matrix is 4x4, a 4x4 matrix with exactly the same entries will be * generated. The same is true if this matrix is 3x3. * - * @method copy * @return {p5.Matrix} the result matrix */ copy() { @@ -144,7 +139,6 @@ p5.Matrix = class { /** * return an identity matrix - * @method identity * @return {p5.Matrix} the result matrix */ static identity(pInst){ @@ -153,7 +147,6 @@ p5.Matrix = class { /** * transpose according to a given matrix - * @method transpose * @param {p5.Matrix|Float32Array|Number[]} a the matrix to be * based on to transpose * @chainable @@ -214,7 +207,6 @@ p5.Matrix = class { /** * invert matrix according to a give matrix - * @method invert * @param {p5.Matrix|Float32Array|Number[]} a the matrix to be * based on to invert * @chainable @@ -301,7 +293,6 @@ p5.Matrix = class { /** * Inverts a 3Ɨ3 matrix - * @method invert3x3 * @chainable */ invert3x3() { @@ -343,7 +334,6 @@ p5.Matrix = class { * the 3x3 matrix generated based on that array is set. * If no arguments, it transposes itself and returns it. * - * @method transpose3x3 * @param {Number[]} mat3 1-dimensional array * @chainable */ @@ -370,7 +360,6 @@ p5.Matrix = class { /** * converts a 4Ɨ4 matrix to its 3Ɨ3 inverse transform * commonly used in MVMatrix to NMatrix conversions. - * @method invertTranspose * @param {p5.Matrix} mat4 the matrix to be based on to invert * @chainable * @todo finish implementation @@ -406,7 +395,6 @@ p5.Matrix = class { /** * inspired by Toji's mat4 determinant - * @method determinant * @return {Number} Determinant of our 4Ɨ4 matrix */ determinant() { @@ -430,7 +418,6 @@ p5.Matrix = class { /** * multiply two mat4s - * @method mult * @param {p5.Matrix|Float32Array|Number[]} multMatrix The matrix * we want to multiply by * @chainable @@ -549,7 +536,6 @@ p5.Matrix = class { /** * scales a p5.Matrix by scalars or a vector - * @method scale * @param {p5.Vector|Float32Array|Number[]} s vector to scale by * @chainable */ @@ -584,7 +570,6 @@ p5.Matrix = class { /** * rotate our Matrix around an axis by the given angle. - * @method rotate * @param {Number} a The angle of rotation in radians * @param {p5.Vector|Number[]} axis the axis(es) to rotate around * @chainable @@ -656,7 +641,6 @@ p5.Matrix = class { /** * @todo finish implementing this method! * translates - * @method translate * @param {Number[]} v vector to translate by * @chainable */ @@ -682,7 +666,6 @@ p5.Matrix = class { /** * sets the perspective matrix - * @method perspective * @param {Number} fovy [description] * @param {Number} aspect [description] * @param {Number} near near clipping plane @@ -715,7 +698,6 @@ p5.Matrix = class { /** * sets the ortho matrix - * @method ortho * @param {Number} left [description] * @param {Number} right [description] * @param {Number} bottom [description] @@ -751,7 +733,6 @@ p5.Matrix = class { /** * apply a matrix to a vector with x,y,z,w components * get the results in the form of an array - * @method multiplyVec4 * @param {Number} * @return {Number[]} */ @@ -773,7 +754,6 @@ p5.Matrix = class { * Returns a vector consisting of the first * through third components of the result. * - * @method multiplyPoint * @param {p5.Vector} * @return {p5.Vector} */ @@ -788,7 +768,6 @@ p5.Matrix = class { * Returns the result of dividing the 1st to 3rd components * of the result by the 4th component as a vector. * - * @method multiplyAndNormalizePoint * @param {p5.Vector} * @return {p5.Vector} */ @@ -806,7 +785,6 @@ p5.Matrix = class { * Returns a vector consisting of the first * through third components of the result. * - * @method multiplyDirection * @param {p5.Vector} * @return {p5.Vector} */ @@ -822,7 +800,6 @@ p5.Matrix = class { * a Float32Array of length 9, or a javascript array of length 9. * In addition, it can also be done by enumerating 9 numbers. * - * @method mult3x3 * @param {p5.Matrix|Float32Array|Number[]} multMatrix The matrix * we want to multiply by * @chainable @@ -871,7 +848,6 @@ p5.Matrix = class { * This function is only for 3x3 matrices. * A function that returns a column vector of a 3x3 matrix. * - * @method column * @param {Number} columnIndex matrix column number * @return {p5.Vector} */ @@ -887,7 +863,6 @@ p5.Matrix = class { * This function is only for 3x3 matrices. * A function that returns a row vector of a 3x3 matrix. * - * @method row * @param {Number} rowIndex matrix row number * @return {p5.Vector} */ @@ -904,7 +879,6 @@ p5.Matrix = class { * A 3x3 matrix will return an array of length 3. * A 4x4 matrix will return an array of length 4. * - * @method diagonal * @return {Number[]} An array obtained by arranging the diagonal elements * of the matrix in ascending order of index */ @@ -920,7 +894,6 @@ p5.Matrix = class { * Takes a vector and returns the vector resulting from multiplying to * that vector by this matrix from left. * - * @method multiplyVec3 * @param {p5.Vector} multVector the vector to which this matrix applies * @param {p5.Vector} [target] The vector to receive the result * @return {p5.Vector} @@ -939,7 +912,6 @@ p5.Matrix = class { * This function is only for 4x4 matrices. * Creates a 3x3 matrix whose entries are the top left 3x3 part and returns it. * - * @method createSubMatrix3x3 * @return {p5.Matrix} */ createSubMatrix3x3() { From 354c0d483294b7ea2513be482312e068bb5437cc Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:57:20 -0500 Subject: [PATCH 17/45] Convert p5.RendererGL --- src/webgl/p5.RendererGL.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index d3ee265d0f..3b2774f0be 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -424,7 +424,6 @@ export function readPixelWebGL( * 3D graphics class * @private * @class p5.RendererGL - * @constructor * @extends p5.Renderer * @todo extend class to include public method for offscreen * rendering (FBO). @@ -675,8 +674,6 @@ p5.RendererGL = class RendererGL extends Renderer { * If you need to draw complex shapes every frame which don't change over time, * combining them upfront with `beginGeometry()` and `endGeometry()` and then * drawing that will run faster than repeatedly drawing the individual pieces. - * - * @method beginGeometry */ beginGeometry() { if (this.geometryBuilder) { @@ -691,7 +688,6 @@ p5.RendererGL = class RendererGL extends Renderer { * use buildGeometry() to pass a function that * draws shapes. * - * @method endGeometry * @returns {p5.Geometry} The model that was built. */ endGeometry() { @@ -716,8 +712,6 @@ p5.RendererGL = class RendererGL extends Renderer { * beginGeometry() and * endGeometry() instead of using a callback * function. - * - * @method buildGeometry * @param {Function} callback A function that draws shapes. * @returns {p5.Geometry} The model that was built from the callback function. */ @@ -917,7 +911,6 @@ p5.RendererGL = class RendererGL extends Renderer { ////////////////////////////////////////////// /** * Basic fill material for geometry with a given color - * @method fill * @class p5.RendererGL * @param {Number|Number[]|String|p5.Color} v1 gray value, * red or hue value (depending on the current color mode), @@ -958,7 +951,6 @@ p5.RendererGL = class RendererGL extends Renderer { /** * Basic stroke material for geometry with a given color - * @method stroke * @param {Number|Number[]|String|p5.Color} v1 gray value, * red or hue value (depending on the current color mode), * or color Array, or CSS color string @@ -1271,7 +1263,6 @@ p5.RendererGL = class RendererGL extends Renderer { /** * Change weight of stroke - * @method strokeWeight * @param {Number} stroke weight to be used for drawing * @example *
@@ -1335,7 +1326,6 @@ p5.RendererGL = class RendererGL extends Renderer { * Any pixel manipulation must be done directly to the pixels[] array. * * @private - * @method loadPixels */ loadPixels() { @@ -2007,7 +1997,6 @@ p5.RendererGL = class RendererGL extends Renderer { } /** - * @method activeFramebuffer * @private * @returns {p5.Framebuffer|null} The currently active framebuffer, or null if * the main canvas is the current draw target. From ba1109a4b04931e6f68db480e0e84d84ac7c29db Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 11:58:28 -0500 Subject: [PATCH 18/45] Convert p5.Shader --- src/webgl/p5.Shader.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/webgl/p5.Shader.js b/src/webgl/p5.Shader.js index 0366df75e4..c7fdfdfef5 100644 --- a/src/webgl/p5.Shader.js +++ b/src/webgl/p5.Shader.js @@ -11,13 +11,12 @@ import p5 from '../core/main'; /** * Shader class for WEBGL Mode * @class p5.Shader - * @constructor * @param {p5.RendererGL} renderer an instance of p5.RendererGL that * will provide the GL context for this new p5.Shader * @param {String} vertSrc source code for the vertex shader (as a string) * @param {String} fragSrc source code for the fragment shader (as a string) */ -p5.Shader = class { +p5.Shader = class Shader { constructor(renderer, vertSrc, fragSrc) { // TODO: adapt this to not take ids, but rather, // to take the source for a vertex and fragment shader @@ -41,7 +40,6 @@ p5.Shader = class { * sources for the vertex and fragment shaders (provided * to the constructor). Populates known attributes and * uniforms from the shader. - * @method init * @chainable * @private */ @@ -110,7 +108,6 @@ p5.Shader = class { * Use this method to make a new copy of a shader that gets compiled on a * different context. * - * @method copyToContext * @param {p5|p5.Graphics} context The graphic or instance to copy this shader to. * Pass `window` if you need to copy to the main canvas. * @returns {p5.Shader} A new shader on the target context. @@ -154,7 +151,6 @@ p5.Shader = class { /** * Queries the active attributes for this shader and loads * their names and locations into the attributes array. - * @method _loadAttributes * @private */ _loadAttributes() { @@ -189,7 +185,6 @@ p5.Shader = class { /** * Queries the active uniforms for this shader and loads * their names and locations into the uniforms array. - * @method _loadUniforms * @private */ _loadUniforms() { @@ -253,7 +248,6 @@ p5.Shader = class { /** * initializes (if needed) and binds the shader program. - * @method bindShader * @private */ bindShader() { @@ -269,7 +263,6 @@ p5.Shader = class { } /** - * @method unbindShader * @chainable * @private */ @@ -346,7 +339,6 @@ p5.Shader = class { } /** - * @method useProgram * @chainable * @private */ @@ -377,7 +369,6 @@ p5.Shader = class { * - a p5.Image, p5.Graphics, p5.MediaElement, or p5.Texture * - Example: `setUniform('x', img)` becomes `uniform sampler2D x` * - * @method setUniform * @chainable * @param {String} uniformName the name of the uniform. * Must correspond to the name used in the vertex and fragment shaders @@ -605,7 +596,6 @@ p5.Shader = class { } /** - * @method enableAttrib * @chainable * @private */ @@ -645,7 +635,6 @@ p5.Shader = class { * Once all buffers have been bound, this checks to see if there are any * remaining active attributes, likely left over from previous renders, * and disables them so that they don't affect rendering. - * @method disableRemainingAttributes * @private */ disableRemainingAttributes() { From d0ae735ee3627653a342e57cfeab286a7b8417f9 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 12:00:28 -0500 Subject: [PATCH 19/45] Convert p5.Graphics --- src/core/p5.Graphics.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/core/p5.Graphics.js b/src/core/p5.Graphics.js index f7ff5488a8..7d857f6f70 100644 --- a/src/core/p5.Graphics.js +++ b/src/core/p5.Graphics.js @@ -15,7 +15,6 @@ import * as constants from './constants'; * extensive, but mirror the normal drawing API for p5. * * @class p5.Graphics - * @constructor * @extends p5.Element * @param {Number} w width * @param {Number} h height @@ -23,7 +22,7 @@ import * as constants from './constants'; * @param {p5} [pInst] pointer to p5 instance * @param {HTMLCanvasElement} [canvas] existing html canvas element */ -p5.Graphics = class extends p5.Element { +p5.Graphics = class Graphics extends p5.Element { constructor(w, h, renderer, pInst, canvas) { let canvasTemp; if (canvas) { @@ -77,7 +76,6 @@ p5.Graphics = class extends p5.Element { * with graphics buffer objects. Calling this in draw() will copy the behavior * of the standard canvas. * - * @method reset * @example * *
@@ -127,8 +125,6 @@ p5.Graphics = class extends p5.Element { * Removes a Graphics object from the page and frees any resources * associated with it. * - * @method remove - * * @example *
* let bg; @@ -197,8 +193,6 @@ p5.Graphics = class extends p5.Element { * * This takes the same parameters as the global * createFramebuffer function. - * - * @method createFramebuffer */ createFramebuffer(options) { return new p5.Framebuffer(this, options); From f6f0712747265d510d8190fc2e3e70797b4dff65 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 12:19:24 -0500 Subject: [PATCH 20/45] Convert p5.Table, handle recursive entries --- src/io/p5.Table.js | 116 ++++++++++++++++++--------------------------- utils/convert.js | 21 +++++--- 2 files changed, 61 insertions(+), 76 deletions(-) diff --git a/src/io/p5.Table.js b/src/io/p5.Table.js index 93c4cf35b8..b77b70a06d 100644 --- a/src/io/p5.Table.js +++ b/src/io/p5.Table.js @@ -36,54 +36,11 @@ import p5 from '../core/main'; * scratch, dynamically, or using data from an existing file. * * @class p5.Table - * @constructor * @param {p5.TableRow[]} [rows] An array of p5.TableRow objects */ -p5.Table = class { - /** - * An array containing the names of the columns in the table, if the "header" the table is - * loaded with the "header" parameter. - * @type {String[]} - * @property columns - * @name columns - * @example - *
- * - * // Given the CSV file "mammals.csv" - * // in the project's "assets" folder: - * // - * // id,species,name - * // 0,Capra hircus,Goat - * // 1,Panthera pardus,Leopard - * // 2,Equus zebra,Zebra - * - * let table; - * - * function preload() { - * //my table is comma separated value "csv" - * //and has a header specifying the columns labels - * table = loadTable('assets/mammals.csv', 'csv', 'header'); - * } - * - * function setup() { - * //print the column names - * for (let c = 0; c < table.getColumnCount(); c++) { - * print('column ' + c + ' is named ' + table.columns[c]); - * } - * } - * - *
- */ +p5.Table = class Table { constructor(rows) { this.columns = []; - - /** - * An array containing the p5.TableRow objects that make up the - * rows of the table. The same result as calling getRows() - * @type {p5.TableRow[]} - * @property rows - * @name rows - */ this.rows = []; } @@ -96,7 +53,6 @@ p5.Table = class { * If a p5.TableRow object is included as a parameter, then that row is * duplicated and added to the table. * - * @method addRow * @param {p5.TableRow} [row] row to be added to the table * @return {p5.TableRow} the row that was added * @@ -152,7 +108,6 @@ p5.Table = class { /** * Removes a row from the table object. * - * @method removeRow * @param {Integer} id ID number of the row to remove * * @example @@ -199,7 +154,6 @@ p5.Table = class { * Returns a reference to the specified p5.TableRow. The reference * can then be used to get and set values of the selected row. * - * @method getRow * @param {Integer} rowID ID number of the row to get * @return {p5.TableRow} p5.TableRow object * @@ -242,7 +196,6 @@ p5.Table = class { /** * Gets all rows from the table. Returns an array of p5.TableRows. * - * @method getRows * @return {p5.TableRow[]} Array of p5.TableRows * * @example @@ -293,7 +246,6 @@ p5.Table = class { * row is returned. The column to search may be specified by * either its ID or title. * - * @method findRow * @param {String} value The value to match * @param {Integer|String} column ID number or title of the * column to search @@ -355,7 +307,6 @@ p5.Table = class { * as shown in the example above. The column to search may be * specified by either its ID or title. * - * @method findRows * @param {String} value The value to match * @param {Integer|String} column ID number or title of the * column to search @@ -421,7 +372,6 @@ p5.Table = class { * matching row is returned. The column to search may be * specified by either its ID or title. * - * @method matchRow * @param {String|RegExp} regexp The regular expression to match * @param {String|Integer} column The column ID (number) or * title (string) @@ -478,7 +428,6 @@ p5.Table = class { * used to iterate through all the rows, as shown in the example. The * column to search may be specified by either its ID or title. * - * @method matchRows * @param {String} regexp The regular expression to match * @param {String|Integer} [column] The column ID (number) or * title (string) @@ -543,7 +492,6 @@ p5.Table = class { * Retrieves all values in the specified column, and returns them * as an array. The column may be specified by either its ID or title. * - * @method getColumn * @param {String|Number} column String or Number of the column to return * @return {Array} Array of column values * @@ -593,8 +541,6 @@ p5.Table = class { * Removes all rows from a Table. While all rows are removed, * columns and column titles are maintained. * - * @method clearRows - * * @example *
* @@ -634,7 +580,6 @@ p5.Table = class { * may be easily referenced later by name. (If no title is * specified, the new column's title will be null.) * - * @method addColumn * @param {String} [title] title of the given column * * @example @@ -680,7 +625,6 @@ p5.Table = class { /** * Returns the total number of columns in a Table. * - * @method getColumnCount * @return {Integer} Number of columns in this table * @example *
@@ -716,7 +660,6 @@ p5.Table = class { /** * Returns the total number of rows in a Table. * - * @method getRowCount * @return {Integer} Number of rows in this table * @example *
@@ -756,7 +699,6 @@ p5.Table = class { * rows are processed. A specific column may be referenced by * either its ID or title. * - * @method removeTokens * @param {String} chars String listing characters to be removed * @param {String|Integer} [column] Column ID (number) * or name (string) @@ -827,7 +769,6 @@ p5.Table = class { * values in all columns and rows are trimmed. A specific column * may be referenced by either its ID or title. * - * @method trim * @param {String|Integer} [column] Column ID (number) * or name (string) * @example @@ -892,7 +833,6 @@ p5.Table = class { * removeColumn(0) would remove the first column, removeColumn(1) * would remove the second column, and so on. * - * @method removeColumn * @param {String|Integer} column columnName (string) or ID (number) * * @example @@ -952,7 +892,6 @@ p5.Table = class { * The row is specified by its ID, while the column may be specified * by either its ID or title. * - * @method set * @param {Integer} row row ID * @param {String|Integer} column column ID (Number) * or title (String) @@ -1000,7 +939,6 @@ p5.Table = class { * The row is specified by its ID, while the column may be specified * by either its ID or title. * - * @method setNum * @param {Integer} row row ID * @param {String|Integer} column column ID (Number) * or title (String) @@ -1045,7 +983,6 @@ p5.Table = class { * The row is specified by its ID, while the column may be specified * by either its ID or title. * - * @method setString * @param {Integer} row row ID * @param {String|Integer} column column ID (Number) * or title (String) @@ -1089,7 +1026,6 @@ p5.Table = class { * The row is specified by its ID, while the column may be specified by * either its ID or title. * - * @method get * @param {Integer} row row ID * @param {String|Integer} column columnName (string) or * ID (number) @@ -1133,7 +1069,6 @@ p5.Table = class { * The row is specified by its ID, while the column may be specified by * either its ID or title. * - * @method getNum * @param {Integer} row row ID * @param {String|Integer} column columnName (string) or * ID (number) @@ -1175,7 +1110,6 @@ p5.Table = class { * The row is specified by its ID, while the column may be specified by * either its ID or title. * - * @method getString * @param {Integer} row row ID * @param {String|Integer} column columnName (string) or * ID (number) @@ -1225,7 +1159,6 @@ p5.Table = class { * passed in, each row object will be stored with that attribute as its * title. * - * @method getObject * @param {String} [headerColumn] Name of the column which should be used to * title each row object (optional) * @return {Object} @@ -1285,7 +1218,6 @@ p5.Table = class { /** * Retrieves all table data and returns it as a multidimensional array. * - * @method getArray * @return {Array} * * @example @@ -1325,4 +1257,50 @@ p5.Table = class { return tableArray; } }; + +/** + * An array containing the names of the columns in the table, if the "header" the table is + * loaded with the "header" parameter. + * @type {String[]} + * @for p5.Table + * @property columns + * @name columns + * @example + *
+ * + * // Given the CSV file "mammals.csv" + * // in the project's "assets" folder: + * // + * // id,species,name + * // 0,Capra hircus,Goat + * // 1,Panthera pardus,Leopard + * // 2,Equus zebra,Zebra + * + * let table; + * + * function preload() { + * //my table is comma separated value "csv" + * //and has a header specifying the columns labels + * table = loadTable('assets/mammals.csv', 'csv', 'header'); + * } + * + * function setup() { + * //print the column names + * for (let c = 0; c < table.getColumnCount(); c++) { + * print('column ' + c + ' is named ' + table.columns[c]); + * } + * } + * + *
+ */ + +/** + * An array containing the p5.TableRow objects that make up the + * rows of the table. The same result as calling getRows() + * @for p5.Table + * @type {p5.TableRow[]} + * @property rows + * @name rows + */ + export default p5; diff --git a/utils/convert.js b/utils/convert.js index 1f69c5f25a..40ef277914 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -2,16 +2,23 @@ const fs = require('fs'); const path = require('path'); const data = JSON.parse(fs.readFileSync(path.join(__dirname, '../docs/data.json'))); -const allData = data.flatMap(entry => { + +function getEntries(entry) { return [ entry, - ...entry.members.global, - ...entry.members.inner, - ...entry.members.instance, - ...entry.members.events, - ...entry.members.static + ...getAllEntries(entry.members.global), + ...getAllEntries(entry.members.inner), + ...getAllEntries(entry.members.instance), + ...getAllEntries(entry.members.events), + ...getAllEntries(entry.members.static) ]; -}); +} + +function getAllEntries(arr) { + return arr.flatMap(getEntries); +} + +const allData = getAllEntries(data); const converted = { project: {}, // Unimplemented, probably not needed From aed275bfd8c4ec1983ed5cf6db96f37bca8b688b Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 12:20:39 -0500 Subject: [PATCH 21/45] Convert p5.Color --- src/color/p5.Color.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/color/p5.Color.js b/src/color/p5.Color.js index a94c36f54c..040f96393b 100644 --- a/src/color/p5.Color.js +++ b/src/color/p5.Color.js @@ -334,7 +334,6 @@ const colorPatterns = { * of this class. * * @class p5.Color - * @constructor * @param {p5} [pInst] pointer to p5 instance. * * @param {Number[]|String} vals an array containing the color values @@ -361,7 +360,6 @@ p5.Color = class Color { * Returns the color formatted as a string. Doing so can be useful for * debugging, or for using p5.js with other libraries. * - * @method toString * @param {String} [format] how the color string will be formatted. * Leaving this empty formats the string as rgba(r, g, b, a). * '#rgb' '#rgba' '#rrggbb' and '#rrggbbaa' format as hexadecimal color codes. @@ -565,7 +563,6 @@ p5.Color = class Color { * colorMode(). In the default RGB mode it's * between 0 and 255. * - * @method setRed * @param {Number} red the new red value. * * @example @@ -595,7 +592,6 @@ p5.Color = class Color { * colorMode(). In the default RGB mode it's * between 0 and 255. * - * @method setGreen * @param {Number} green the new green value. * * @example @@ -625,7 +621,6 @@ p5.Color = class Color { * colorMode(). In the default RGB mode it's * between 0 and 255. * - * @method setBlue * @param {Number} blue the new blue value. * * @example @@ -655,7 +650,6 @@ p5.Color = class Color { * colorMode(). In the default RGB mode it's * between 0 and 255. * - * @method setAlpha * @param {Number} alpha the new alpha value. * * @example From f10eaa67eb8fdb7f1418cc5bb6618ddb3ffb0145 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 12:21:59 -0500 Subject: [PATCH 22/45] Convert p5.XML --- src/io/p5.XML.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/io/p5.XML.js b/src/io/p5.XML.js index 430716f36c..7b80b538d6 100644 --- a/src/io/p5.XML.js +++ b/src/io/p5.XML.js @@ -11,7 +11,6 @@ import p5 from '../core/main'; * loadXML() to load external XML files and create XML objects. * * @class p5.XML - * @constructor * @example *
* // The following short XML file called "mammals.xml" is parsed @@ -63,7 +62,6 @@ p5.XML = class { * Gets a copy of the element's parent. Returns the parent as another * p5.XML object. * - * @method getParent * @return {p5.XML} element parent * @example *
@@ -100,7 +98,6 @@ p5.XML = class { /** * Gets the element's full name, which is returned as a String. * - * @method getName * @return {String} the name of the node * @example<animal *
@@ -135,7 +132,6 @@ p5.XML = class { /** * Sets the element's name, which is specified as a String. * - * @method setName * @param {String} the new name of the node * @example<animal *
@@ -182,7 +178,6 @@ p5.XML = class { * Checks whether or not the element has any children, and returns the result * as a boolean. * - * @method hasChildren * @return {boolean} * @example<animal *
@@ -219,7 +214,6 @@ p5.XML = class { * array of Strings. This is the same as looping through and calling getName() * on each child element individually. * - * @method listChildren * @return {String[]} names of the children of the element * @example<animal *
@@ -260,7 +254,6 @@ p5.XML = class { * the name parameter is specified, then it will return all children that match * that name. * - * @method getChildren * @param {String} [name] element name * @return {p5.XML[]} children of the element * @example<animal @@ -310,7 +303,6 @@ p5.XML = class { * or the child of the given index.It returns undefined if no matching * child is found. * - * @method getChild * @param {String|Integer} name element name or index * @return {p5.XML} * @example<animal @@ -371,7 +363,6 @@ p5.XML = class { * reference to an existing p5.XML object. * A reference to the newly created child is returned as an p5.XML object. * - * @method addChild * @param {p5.XML} node a p5.XML Object which will be the child to be added * @example *
@@ -420,7 +411,6 @@ p5.XML = class { /** * Removes the element specified by name or index. * - * @method removeChild * @param {String|Integer} name element name or index * @example *
@@ -492,7 +482,6 @@ p5.XML = class { /** * Counts the specified element's number of attributes, returned as an Number. * - * @method getAttributeCount * @return {Integer} * @example *
@@ -529,7 +518,6 @@ p5.XML = class { * Gets all of the specified element's attributes, and returns them as an * array of Strings. * - * @method listAttributes * @return {String[]} an array of strings containing the names of attributes * @example *
@@ -571,7 +559,6 @@ p5.XML = class { /** * Checks whether or not an element has the specified attribute. * - * @method hasAttribute * @param {String} the attribute to be checked * @return {boolean} true if attribute found else false * @example @@ -619,7 +606,6 @@ p5.XML = class { * is returned. If no defaultValue is specified and the attribute doesn't * exist, the value 0 is returned. * - * @method getNum * @param {String} name the non-null full name of the attribute * @param {Number} [defaultValue] the default value of the attribute * @return {Number} @@ -666,7 +652,6 @@ p5.XML = class { * is returned. If no defaultValue is specified and the attribute doesn't * exist, null is returned. * - * @method getString * @param {String} name the non-null full name of the attribute * @param {Number} [defaultValue] the default value of the attribute * @return {String} @@ -711,7 +696,6 @@ p5.XML = class { * Sets the content of an element's attribute. The first parameter specifies * the attribute name, while the second specifies the new content. * - * @method setAttribute * @param {String} name the full name of the attribute * @param {Number|String|Boolean} value the value of the attribute * @example @@ -752,7 +736,6 @@ p5.XML = class { * Returns the content of an element. If there is no such content, * defaultValue is returned if specified, otherwise null is returned. * - * @method getContent * @param {String} [defaultValue] value returned if no content is found * @return {String} * @example @@ -792,7 +775,6 @@ p5.XML = class { /** * Sets the element's content. * - * @method setContent * @param {String} text the new content * @example *
@@ -834,7 +816,6 @@ p5.XML = class { * Serializes the element into a string. This function is useful for preparing * the content to be sent over a http request or saved to file. * - * @method serialize * @return {String} Serialized string of the element * @example *
From bb818515105f78f8acf8fc5daa16e9c213079de8 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 12:24:46 -0500 Subject: [PATCH 23/45] Convert p5 --- src/core/main.js | 259 ++++++++++++++++++++++++----------------------- 1 file changed, 130 insertions(+), 129 deletions(-) diff --git a/src/core/main.js b/src/core/main.js index bc66725824..c86ddef8cd 100644 --- a/src/core/main.js +++ b/src/core/main.js @@ -23,7 +23,6 @@ import * as constants from './constants'; * "instance" - all properties and methods are bound to this p5 object * * @class p5 - * @constructor * @param {function(p5)} sketch a closure that can set optional preload(), * setup(), and/or draw() properties on the * given p5 instance @@ -32,133 +31,6 @@ import * as constants from './constants'; */ class p5 { constructor(sketch, node) { - ////////////////////////////////////////////// - // PUBLIC p5 PROPERTIES AND METHODS - ////////////////////////////////////////////// - - /** - * Called directly before setup(), the preload() function is used to handle - * asynchronous loading of external files in a blocking way. If a preload - * function is defined, setup() will wait until any load calls within have - * finished. Nothing besides load calls (loadImage, loadJSON, loadFont, - * loadStrings, etc.) should be inside the preload function. If asynchronous - * loading is preferred, the load methods can instead be called in setup() - * or anywhere else with the use of a callback parameter. - * - * By default the text "loading..." will be displayed. To make your own - * loading page, include an HTML element with id "p5_loading" in your - * page. More information here. - * - * @method preload - * @example - *
- * let img; - * let c; - * function preload() { - * // preload() runs once - * img = loadImage('assets/laDefense.jpg'); - * } - * - * function setup() { - * // setup() waits until preload() is done - * img.loadPixels(); - * // get color of middle pixel - * c = img.get(img.width / 2, img.height / 2); - * } - * - * function draw() { - * background(c); - * image(img, 25, 25, 50, 50); - * } - *
- * - * @alt - * nothing displayed - * - */ - - /** - * The setup() function is called once when the program starts. It's used to - * define initial environment properties such as screen size and background - * color and to load media such as images and fonts as the program starts. - * There can only be one setup() function for each program and it shouldn't - * be called again after its initial execution. - * - * Note: Variables declared within setup() are not accessible within other - * functions, including draw(). - * - * @method setup - * @example - *
- * let a = 0; - * - * function setup() { - * background(0); - * noStroke(); - * fill(102); - * } - * - * function draw() { - * rect(a++ % width, 10, 2, 80); - * } - *
- * - * @alt - * nothing displayed - * - */ - - /** - * Called directly after setup(), the draw() function continuously executes - * the lines of code contained inside its block until the program is stopped - * or noLoop() is called. Note if noLoop() is called in setup(), draw() will - * still be executed once before stopping. draw() is called automatically and - * should never be called explicitly. - * - * It should always be controlled with noLoop(), redraw() and loop(). After - * noLoop() stops the code in draw() from executing, redraw() causes the - * code inside draw() to execute once, and loop() will cause the code - * inside draw() to resume executing continuously. - * - * The number of times draw() executes in each second may be controlled with - * the frameRate() function. - * - * There can only be one draw() function for each sketch, and draw() must - * exist if you want the code to run continuously, or to process events such - * as mousePressed(). Sometimes, you might have an empty call to draw() in - * your program, as shown in the above example. - * - * It is important to note that the drawing coordinate system will be reset - * at the beginning of each draw() call. If any transformations are performed - * within draw() (ex: scale, rotate, translate), their effects will be - * undone at the beginning of draw(), so transformations will not accumulate - * over time. On the other hand, styling applied (ex: fill, stroke, etc) will - * remain in effect. - * - * @method draw - * @example - *
- * let yPos = 0; - * function setup() { - * // setup() runs once - * frameRate(30); - * } - * function draw() { - * // draw() loops forever, until stopped - * background(204); - * yPos = yPos - 1; - * if (yPos < 0) { - * yPos = height; - * } - * line(0, yPos, width, yPos); - * } - *
- * - * @alt - * nothing displayed - * - */ - ////////////////////////////////////////////// // PRIVATE p5 PROPERTIES AND METHODS ////////////////////////////////////////////// @@ -451,7 +323,6 @@ class p5 { * variables and objects created by the p5 library will be removed, any * other global variables created by your code will remain. * - * @method remove * @example *
* function draw() { @@ -746,6 +617,136 @@ class p5 { } } +////////////////////////////////////////////// +// PUBLIC p5 PROPERTIES AND METHODS +////////////////////////////////////////////// + +/** + * Called directly before setup(), the preload() function is used to handle + * asynchronous loading of external files in a blocking way. If a preload + * function is defined, setup() will wait until any load calls within have + * finished. Nothing besides load calls (loadImage, loadJSON, loadFont, + * loadStrings, etc.) should be inside the preload function. If asynchronous + * loading is preferred, the load methods can instead be called in setup() + * or anywhere else with the use of a callback parameter. + * + * By default the text "loading..." will be displayed. To make your own + * loading page, include an HTML element with id "p5_loading" in your + * page. More information here. + * + * @method preload + * @for p5 + * @example + *
+ * let img; + * let c; + * function preload() { + * // preload() runs once + * img = loadImage('assets/laDefense.jpg'); + * } + * + * function setup() { + * // setup() waits until preload() is done + * img.loadPixels(); + * // get color of middle pixel + * c = img.get(img.width / 2, img.height / 2); + * } + * + * function draw() { + * background(c); + * image(img, 25, 25, 50, 50); + * } + *
+ * + * @alt + * nothing displayed + * + */ + +/** + * The setup() function is called once when the program starts. It's used to + * define initial environment properties such as screen size and background + * color and to load media such as images and fonts as the program starts. + * There can only be one setup() function for each program and it shouldn't + * be called again after its initial execution. + * + * Note: Variables declared within setup() are not accessible within other + * functions, including draw(). + * + * @method setup + * @for p5 + * @example + *
+ * let a = 0; + * + * function setup() { + * background(0); + * noStroke(); + * fill(102); + * } + * + * function draw() { + * rect(a++ % width, 10, 2, 80); + * } + *
+ * + * @alt + * nothing displayed + * + */ + +/** + * Called directly after setup(), the draw() function continuously executes + * the lines of code contained inside its block until the program is stopped + * or noLoop() is called. Note if noLoop() is called in setup(), draw() will + * still be executed once before stopping. draw() is called automatically and + * should never be called explicitly. + * + * It should always be controlled with noLoop(), redraw() and loop(). After + * noLoop() stops the code in draw() from executing, redraw() causes the + * code inside draw() to execute once, and loop() will cause the code + * inside draw() to resume executing continuously. + * + * The number of times draw() executes in each second may be controlled with + * the frameRate() function. + * + * There can only be one draw() function for each sketch, and draw() must + * exist if you want the code to run continuously, or to process events such + * as mousePressed(). Sometimes, you might have an empty call to draw() in + * your program, as shown in the above example. + * + * It is important to note that the drawing coordinate system will be reset + * at the beginning of each draw() call. If any transformations are performed + * within draw() (ex: scale, rotate, translate), their effects will be + * undone at the beginning of draw(), so transformations will not accumulate + * over time. On the other hand, styling applied (ex: fill, stroke, etc) will + * remain in effect. + * + * @for p5 + * @method draw + * @example + *
+ * let yPos = 0; + * function setup() { + * // setup() runs once + * frameRate(30); + * } + * function draw() { + * // draw() loops forever, until stopped + * background(204); + * yPos = yPos - 1; + * if (yPos < 0) { + * yPos = height; + * } + * line(0, yPos, width, yPos); + * } + *
+ * + * @alt + * nothing displayed + * + */ + // This is a pointer to our global mode p5 instance, if we're in // global mode. p5.instance = null; From d195e4c5e6270885ccb826c5c093d38ff5559818 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 12:32:24 -0500 Subject: [PATCH 24/45] Convert p5.Renderer, fix @function tags confusing the script --- src/core/p5.Renderer.js | 6 +++--- utils/convert.js | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/p5.Renderer.js b/src/core/p5.Renderer.js index 72f9a7263f..096ddc7772 100644 --- a/src/core/p5.Renderer.js +++ b/src/core/p5.Renderer.js @@ -13,13 +13,12 @@ import * as constants from '../core/constants'; * Renderer2D and Renderer3D classes, respectively. * * @class p5.Renderer - * @constructor * @extends p5.Element * @param {HTMLElement} elt DOM node that is wrapped * @param {p5} [pInst] pointer to p5 instance * @param {Boolean} [isMainCanvas] whether we're using it as main canvas */ -class Renderer extends p5.Element { +p5.Renderer = class Renderer extends p5.Element { constructor(elt, pInst, isMainCanvas) { super(elt, pInst); this.canvas = elt; @@ -516,7 +515,8 @@ class Renderer extends p5.Element { return this; } -} +}; + /** * Helper fxn to measure ascent and descent. * Adapted from http://stackoverflow.com/a/25355178 diff --git a/utils/convert.js b/utils/convert.js index 40ef277914..b6d0740724 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -342,6 +342,9 @@ for (const entry of allData) { if (entry.kind === 'function' && entry.properties.length === 0) { const { module, submodule, forEntry } = getModuleInfo(entry); + // Ignore functions that aren't methods + if (entry.tags.some(tag => tag.title === 'function')) continue; + // If a previous version of this same method exists, then this is probably // an overload on that method const prevItem = (classMethods[entry.memberof] || {})[entry.name] || {}; From 137b920de07dd1a86740065f427e31eb95fc72a8 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 11 Feb 2024 12:33:36 -0500 Subject: [PATCH 25/45] Remove docs mentioning @constructor --- contributor_docs/inline_documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributor_docs/inline_documentation.md b/contributor_docs/inline_documentation.md index d83f389882..bd495b4a54 100644 --- a/contributor_docs/inline_documentation.md +++ b/contributor_docs/inline_documentation.md @@ -161,7 +161,7 @@ define(function (require) { ## Constructors -Constructors are defined with `@class`. Each constructor should have the tag `@class` followed by the name of the class, as well as the tag `@constructor`, and any `@param` tags required. +Constructors are defined with `@class`. Each constructor should have the tag `@class` followed by the name of the class, and any `@param` tags required. ```js /** From ec917ae3b0805bf844d5066c7af8179f5ec6d979 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 10:23:58 -0500 Subject: [PATCH 26/45] Fix submodules overwriting modules --- utils/convert.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/convert.js b/utils/convert.js index b6d0740724..bdba6879de 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -165,6 +165,9 @@ for (const key in modules) { converted.modules[key] = modules[key]; } for (const key in submodules) { + // Some modules also list themselves as submodules as a default category + // of sorts. Skip adding these submodules to not overwrite the module itself. + if (converted.modules[key]) continue; converted.modules[key] = submodules[key]; } From 936e3f1dba0f646cd6992480302ab2eb9ea96477 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 10:38:03 -0500 Subject: [PATCH 27/45] Fix mistaken @class tags in RendererGL --- src/webgl/p5.RendererGL.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index 7e29e0e683..f928d4d5e2 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -843,9 +843,6 @@ p5.RendererGL = class RendererGL extends Renderer { } - /** - * @class p5.RendererGL - */ _update() { // reset model view and apply initial camera transform // (containing only look at info; no projection). @@ -899,7 +896,6 @@ p5.RendererGL = class RendererGL extends Renderer { ////////////////////////////////////////////// /** * Basic fill material for geometry with a given color - * @class p5.RendererGL * @param {Number|Number[]|String|p5.Color} v1 gray value, * red or hue value (depending on the current color mode), * or color Array, or CSS color string From 6d6a222997a517689d690e4390e30c2c07e473fd Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 10:44:11 -0500 Subject: [PATCH 28/45] Remove more @method tags from ES6 classes --- src/webgl/text.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/webgl/text.js b/src/webgl/text.js index b5d642cc81..292a7d59cf 100644 --- a/src/webgl/text.js +++ b/src/webgl/text.js @@ -52,7 +52,6 @@ class ImageInfos { } /** * - * @method findImage * @param {Integer} space * @return {Object} contains the ImageData, and pixel index into that * ImageData where the free space was allocated. @@ -158,7 +157,6 @@ class FontInfo { this.glyphInfos = {}; } /** - * @method getGlyphInfo * @param {Glyph} glyph the x positions of points in the curve * @returns {Object} the glyphInfo for that glyph * @@ -292,7 +290,6 @@ class FontInfo { this.p1 = p1; } /** - * @method toQuadratic * @return {Object} the quadratic approximation * * converts the cubic to a quadtratic approximation by @@ -310,7 +307,6 @@ class FontInfo { } /** - * @method quadError * @return {Number} the error * * calculates the magnitude of error of this curve's @@ -326,7 +322,6 @@ class FontInfo { } /** - * @method split * @param {Number} t the value (0-1) at which to split * @return {Cubic} the second part of the curve * @@ -348,7 +343,6 @@ class FontInfo { } /** - * @method splitInflections * @return {Cubic[]} the non-inflecting pieces of this cubic * * returns an array containing 0, 1 or 2 cubics split resulting From 36dc9937f570691ea33117341353b0a23bd08ce5 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 11:11:06 -0500 Subject: [PATCH 29/45] Fix broken inline code due to typo --- utils/convert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/convert.js b/utils/convert.js index bdba6879de..3ef5bfe87d 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -37,7 +37,7 @@ function descriptionString(node) { return node.value; } else if (node.type === 'paragraph') { return '

' + node.children.map(n => descriptionString(n)).join('') + '

'; - } else if (node.type === 'includeCode') { + } else if (node.type === 'inlineCode') { return '' + node.value + ''; } else if (node.value) { return node.value; From de89b2df39a13cd5a60855114e0aa5264f7feeee Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 11:25:41 -0500 Subject: [PATCH 30/45] Handle lists --- utils/convert.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/convert.js b/utils/convert.js index 3ef5bfe87d..2eab257330 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -39,6 +39,11 @@ function descriptionString(node) { return '

' + node.children.map(n => descriptionString(n)).join('') + '

'; } else if (node.type === 'inlineCode') { return '' + node.value + ''; + } else if (node.type === 'list') { + const tag = node.type === 'ordered' ? 'ol' : 'ul'; + return `<${tag}>` + node.children.map(n => descriptionString(n)).join('') + ``; + } else if (node.type === 'listItem') { + return '
  • ' + node.children.map(n => descriptionString(n)).join('') + '
  • '; } else if (node.value) { return node.value; } else if (node.children) { From 0ae7925254b9b4db32e744b41175e56cad7d98ad Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 11:34:17 -0500 Subject: [PATCH 31/45] Ensure some whitespace between

    s --- utils/convert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/convert.js b/utils/convert.js index 2eab257330..4104955b3c 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -36,7 +36,7 @@ function descriptionString(node) { } else if (node.type === 'text') { return node.value; } else if (node.type === 'paragraph') { - return '

    ' + node.children.map(n => descriptionString(n)).join('') + '

    '; + return '

    ' + node.children.map(n => descriptionString(n)).join('') + '

    \n'; } else if (node.type === 'inlineCode') { return '' + node.value + ''; } else if (node.type === 'list') { From b9b884e0141815c22baff2b34f4099530fb39ca4 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 12:23:19 -0500 Subject: [PATCH 32/45] better array handling, more consistent

    s --- utils/convert.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/utils/convert.js b/utils/convert.js index 4104955b3c..c4edb6fb62 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -30,24 +30,26 @@ const converted = { consts: {} }; -function descriptionString(node) { +function descriptionString(node, parent) { if (!node) { return ''; } else if (node.type === 'text') { return node.value; } else if (node.type === 'paragraph') { - return '

    ' + node.children.map(n => descriptionString(n)).join('') + '

    \n'; + const content = node.children.map(n => descriptionString(n, node)).join(''); + if (parent && parent.children.length === 1) return content; + return '

    ' + content + '

    \n'; } else if (node.type === 'inlineCode') { return '' + node.value + ''; } else if (node.type === 'list') { const tag = node.type === 'ordered' ? 'ol' : 'ul'; - return `<${tag}>` + node.children.map(n => descriptionString(n)).join('') + ``; + return `<${tag}>` + node.children.map(n => descriptionString(n, node)).join('') + ``; } else if (node.type === 'listItem') { - return '
  • ' + node.children.map(n => descriptionString(n)).join('') + '
  • '; + return '
  • ' + node.children.map(n => descriptionString(n, node)).join('') + '
  • '; } else if (node.value) { return node.value; } else if (node.children) { - return node.children.map(n => descriptionString(n)).join(''); + return node.children.map(n => descriptionString(n, node)).join(''); } else { return ''; } @@ -65,9 +67,18 @@ function typeObject(node) { }; } else if (node.type === 'TypeApplication') { const { type: typeName } = typeObject(node.expression); + if ( + typeName === 'Array' && + node.applications.length === 1 && + node.applications[0].type === 'NameExpression' + ) { + return { + type: `${typeObject(node.applications[0]).type}[]` + }; + } const args = node.applications.map(n => typeObject(n).type); return { - type: `${typeName}<${args.join(', ')}>` + type: `${typeName}<${args.join(', ')}>` }; } else if (node.type === 'UndefinedLiteral') { return { type: 'undefined' }; @@ -246,7 +257,7 @@ for (const entry of allData) { }), return: entry.returns[0] && { description: descriptionString(entry.returns[0].description), - ...typeObject(entry.returns[0].type).name + ...typeObject(entry.returns[0].type) }, is_constructor: 1, module, @@ -399,13 +410,13 @@ for (const entry of allData) { }), return: entry.returns[0] && { description: descriptionString(entry.returns[0].description), - ...typeObject(entry.returns[0].type).name + ...typeObject(entry.returns[0].type) } } ], return: prevItem.return || entry.returns[0] && { description: descriptionString(entry.returns[0].description), - ...typeObject(entry.returns[0].type).name + ...typeObject(entry.returns[0].type) }, class: className, static: entry.scope === 'static' && 1, From bdd8318e957b748da6e2cae607991fa88646f56b Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 12:45:47 -0500 Subject: [PATCH 33/45] Fix nested folders not getting looked at --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index afe6f37674..b6b9a885b5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build": "rollup -c", "preview": "vite", "dev": "grunt yui browserify:dev connect:yui watch:quick", - "docs": "documentation build ./src/**/*.js -o ./docs/data.json && node ./utils/convert.js", + "docs": "documentation build ./src/**/*.js ./src/**/**/*.js -o ./docs/data.json && node ./utils/convert.js", "test": "vitest run", "lint": "eslint .", "lint:fix": "eslint --fix ." From 096e885e15c9d8a3fd52be078e2207643d5cf304 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 18 Feb 2024 13:05:17 -0500 Subject: [PATCH 34/45] Add entries for consts --- utils/convert.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/utils/convert.js b/utils/convert.js index c4edb6fb62..fa34365b3b 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -231,6 +231,21 @@ function getParams(entry) { for (const entry of allData) { if (entry.kind === 'constant') { constUsage[entry.name] = new Set(); + + const { module, submodule, forEntry } = getModuleInfo(entry); + + const item = { + itemtype: 'property', + name: entry.name, + ...locationInfo(entry), + ...typeObject(entry.type), + description: descriptionString(entry.description), + module, + submodule, + class: forEntry || 'p5' + }; + + converted.classitems.push(item); } } From ad28d39be3be904f26c33fc637a3d14f1bf964eb Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 23 Feb 2024 18:41:45 -0500 Subject: [PATCH 35/45] Output to the location the old file was in --- utils/convert.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/convert.js b/utils/convert.js index fa34365b3b..1c928cd026 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -454,4 +454,5 @@ for (const key in constUsage) { converted.consts[key] = [...constUsage[key]]; } -fs.writeFileSync(path.join(__dirname, '../docs/converted.json'), JSON.stringify(converted, null, 2)); +fs.writeFileSync(path.join(__dirname, '../docs/reference/data.json'), JSON.stringify(converted, null, 2)); +fs.writeFileSync(path.join(__dirname, '../docs/reference/data.min.json'), JSON.stringify(converted)); From 6afe0aa5ebc3223c703274b1a2e1f72285ad7ac2 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 23 Feb 2024 18:42:14 -0500 Subject: [PATCH 36/45] Fix bit that was breaking tests --- src/core/p5.Renderer.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/p5.Renderer.js b/src/core/p5.Renderer.js index 096ddc7772..e297c3f6f5 100644 --- a/src/core/p5.Renderer.js +++ b/src/core/p5.Renderer.js @@ -535,8 +535,7 @@ function calculateOffset(object) { } return [currentLeft, currentTop]; } -// This caused the test to failed. -Renderer.prototype.textSize = function(s) { +p5.Renderer.prototype.textSize = function(s) { if (typeof s === 'number') { this._setProperty('_textSize', s); if (!this._leadingSet) { @@ -549,4 +548,4 @@ Renderer.prototype.textSize = function(s) { return this._textSize; }; -export default Renderer; +export default p5.Renderer; From 2b3b0b35570938f008b3eeabeab988d719d514a1 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 23 Feb 2024 19:30:26 -0500 Subject: [PATCH 37/45] Output to parameterData.json too --- utils/convert.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/utils/convert.js b/utils/convert.js index 1c928cd026..be68a9476f 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -454,5 +454,53 @@ for (const key in constUsage) { converted.consts[key] = [...constUsage[key]]; } + +// ============================================================================ +// parameterData.json +// ============================================================================ + +function buildParamDocs(docs) { + let newClassItems = {}; + // the fields we need for the FES, discard everything else + let allowed = new Set(['name', 'class', 'module', 'params', 'overloads']); + for (let classitem of docs.classitems) { + if (classitem.name && classitem.class) { + for (let key in classitem) { + if (!allowed.has(key)) { + delete classitem[key]; + } + } + if (classitem.hasOwnProperty('overloads')) { + for (let overload of classitem.overloads) { + // remove line number and return type + if (overload.line) { + delete overload.line; + } + + if (overload.return) { + delete overload.return; + } + } + } + if (!newClassItems[classitem.class]) { + newClassItems[classitem.class] = {}; + } + + newClassItems[classitem.class][classitem.name] = classitem; + } + } + + let out = fs.createWriteStream( + path.join(__dirname, '../docs/parameterData.json'), + { + flags: 'w', + mode: '0644' + } + ); + out.write(JSON.stringify(newClassItems, null, 2)); + out.end(); +} + fs.writeFileSync(path.join(__dirname, '../docs/reference/data.json'), JSON.stringify(converted, null, 2)); fs.writeFileSync(path.join(__dirname, '../docs/reference/data.min.json'), JSON.stringify(converted)); +buildParamDocs(JSON.parse(JSON.stringify(converted))); From 98944e02026be087deb38d7ddc4905be58067ed1 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 23 Feb 2024 19:30:39 -0500 Subject: [PATCH 38/45] Get some of the error_helpers tests working --- test/js/chai_helpers.js | 2 ++ test/js/p5_helpers.js | 20 ++++++++++++-------- test/unit/core/error_helpers.js | 11 ++++++++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/test/js/chai_helpers.js b/test/js/chai_helpers.js index 72217e08ec..542fd8ea5b 100644 --- a/test/js/chai_helpers.js +++ b/test/js/chai_helpers.js @@ -1,3 +1,5 @@ +import p5 from '../../src/app.js'; + // Setup chai var expect = chai.expect; var assert = chai.assert; diff --git a/test/js/p5_helpers.js b/test/js/p5_helpers.js index 09603e0c9c..cb73e3839b 100644 --- a/test/js/p5_helpers.js +++ b/test/js/p5_helpers.js @@ -1,6 +1,10 @@ /* eslint no-unused-vars: 0 */ -function promisedSketch(sketch_fn) { +import p5 from '../../src/app.js'; + +p5._throwValidationErrors = true; + +export function promisedSketch(sketch_fn) { var myInstance; var promise = new Promise(function(resolve, reject) { myInstance = new p5(function(sketch) { @@ -14,7 +18,7 @@ function promisedSketch(sketch_fn) { return promise; } -function testSketchWithPromise(name, sketch_fn) { +export function testSketchWithPromise(name, sketch_fn) { var test_fn = function() { return promisedSketch(sketch_fn); }; @@ -24,7 +28,7 @@ function testSketchWithPromise(name, sketch_fn) { return test(name, test_fn); } -function testWithDownload(name, fn, asyncFn = false) { +export function testWithDownload(name, fn, asyncFn = false) { var test_fn = function(done) { // description of this is also on // https://github.com/processing/p5.js/pull/4418/ @@ -72,11 +76,11 @@ function testWithDownload(name, fn, asyncFn = false) { } // Tests should run only for the unminified script -function testUnMinified(name, test_fn) { +export function testUnMinified(name, test_fn) { return !window.IS_TESTING_MINIFIED_VERSION ? test(name, test_fn) : null; } -function parallelSketches(sketch_fns) { +export function parallelSketches(sketch_fns) { var setupPromises = []; var resultPromises = []; var endCallbacks = []; @@ -111,10 +115,10 @@ function parallelSketches(sketch_fns) { }; } -var P5_SCRIPT_URL = '../../lib/p5.js'; -var P5_SCRIPT_TAG = ''; +export const P5_SCRIPT_URL = '../../lib/p5.js'; +export const P5_SCRIPT_TAG = ''; -function createP5Iframe(html) { +export function createP5Iframe(html) { html = html || P5_SCRIPT_TAG; var elt = document.createElement('iframe'); diff --git a/test/unit/core/error_helpers.js b/test/unit/core/error_helpers.js index b084278a7b..cdf05691f3 100644 --- a/test/unit/core/error_helpers.js +++ b/test/unit/core/error_helpers.js @@ -1,4 +1,9 @@ import p5 from '../../../src/app.js'; +import { testUnMinified, createP5Iframe, P5_SCRIPT_TAG } from '../../js/p5_helpers.js'; +import '../../js/chai_helpers.js'; + +const setup = beforeEach; +const teardown = afterEach; suite('Error Helpers', function() { var myp5; @@ -497,7 +502,7 @@ suite('Error Helpers', function() { 'detects capitatilization mistake in global mode', function() { return new Promise(function(resolve) { - iframe = createP5Iframe( + const iframe = createP5Iframe( [ P5_SCRIPT_TAG, ''].join( '\n' ) @@ -952,7 +957,7 @@ suite('Tests for p5.js sketch_reader', function() { }; const prepSketchReaderTest = (arr, resolve) => { - iframe = createP5Iframe( + const iframe = createP5Iframe( [P5_SCRIPT_TAG, WAIT_AND_RESOLVE, ''].join( '\n' ) From 50f279a601c1925a3050f3f08a78742e8feae272 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 23 Feb 2024 19:45:32 -0500 Subject: [PATCH 39/45] Fix validation errors not resetting --- test/unit/core/error_helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/core/error_helpers.js b/test/unit/core/error_helpers.js index cdf05691f3..073545596f 100644 --- a/test/unit/core/error_helpers.js +++ b/test/unit/core/error_helpers.js @@ -8,7 +8,7 @@ const teardown = afterEach; suite('Error Helpers', function() { var myp5; - beforeAll(function() { + beforeEach(function() { new p5(function(p) { p.setup = function() { myp5 = p; @@ -17,7 +17,7 @@ suite('Error Helpers', function() { }); }); - afterAll(function() { + afterEach(function() { myp5.remove(); }); From 8ed8db9e72f9b62463b304185c7dbed2213eb58d Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 23 Feb 2024 20:09:21 -0500 Subject: [PATCH 40/45] Fix typo in random import --- src/math/index.js | 4 ++-- test/unit/core/error_helpers.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/math/index.js b/src/math/index.js index 14d18e9493..2acb397b21 100644 --- a/src/math/index.js +++ b/src/math/index.js @@ -1,11 +1,11 @@ import calculation from './calculation.js'; import noise from './noise.js'; -import random from './noise.js'; +import random from './random.js'; import trigonometry from './trigonometry.js'; import math from './math.js'; import vector from './p5.Vector.js'; -export default function(p5, fn){ +export default function(p5){ p5.registerAddon(calculation); p5.registerAddon(noise); p5.registerAddon(random); diff --git a/test/unit/core/error_helpers.js b/test/unit/core/error_helpers.js index 073545596f..eb5e8054da 100644 --- a/test/unit/core/error_helpers.js +++ b/test/unit/core/error_helpers.js @@ -1,7 +1,10 @@ import p5 from '../../../src/app.js'; +import setupMath from '../../../src/math'; import { testUnMinified, createP5Iframe, P5_SCRIPT_TAG } from '../../js/p5_helpers.js'; import '../../js/chai_helpers.js'; +setupMath(p5); + const setup = beforeEach; const teardown = afterEach; From 288ba4c872ed5035bc4779623f8106d640b3f832 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 23 Feb 2024 20:33:22 -0500 Subject: [PATCH 41/45] Add tests for new format changes --- src/core/friendly_errors/validate_params.js | 13 +++++++ test/unit/core/error_helpers.js | 41 +++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/src/core/friendly_errors/validate_params.js b/src/core/friendly_errors/validate_params.js index 71ba87f50b..618e3cbda0 100644 --- a/src/core/friendly_errors/validate_params.js +++ b/src/core/friendly_errors/validate_params.js @@ -297,6 +297,19 @@ if (typeof IS_MINIFIED !== 'undefined') { }; } + // Handle specific constants in types, e.g. in endShape: + // @param {CLOSE} [close] + // Rather than trying to parse the types out of the description, we + // can use the constant directly from the type + if (type in constants) { + return { + name: type, + builtin: 'constant', + names: [type], + values: { [constants[type]]: true } + }; + } + // function if (lowerType.slice(0, 'function'.length) === 'function') { lowerType = 'function'; diff --git a/test/unit/core/error_helpers.js b/test/unit/core/error_helpers.js index eb5e8054da..1994f0b60f 100644 --- a/test/unit/core/error_helpers.js +++ b/test/unit/core/error_helpers.js @@ -364,6 +364,47 @@ suite('Error Helpers', function() { }); }); + suite('validateParameters: union types', function() { + testUnMinified('set() with Number', function() { + assert.doesNotThrow(function() { + p5._validateParameters('set', [0, 0, 0]); + }); + }); + testUnMinified('set() with Number[]', function() { + assert.doesNotThrow(function() { + p5._validateParameters('set', [0, 0, [0, 0, 0, 255]]); + }); + }); + testUnMinified('set() with Object', function() { + assert.doesNotThrow(function() { + p5._validateParameters('set', [0, 0, myp5.color(0)]); + }); + }); + testUnMinified('set() with Boolean', function() { + assert.validationError(function() { + p5._validateParameters('set', [0, 0, true]); + }); + }); + }); + + suite('validateParameters: specific constants', function() { + testUnMinified('endShape() with no args', function() { + assert.doesNotThrow(function() { + p5._validateParameters('endShape', []); + }); + }); + testUnMinified('endShape() with CLOSE', function() { + assert.doesNotThrow(function() { + p5._validateParameters('endShape', [myp5.CLOSE]); + }); + }); + testUnMinified('endShape() with unrelated constant', function() { + assert.validationError(function() { + p5._validateParameters('endShape', [myp5.RADIANS]); + }); + }); + }); + suite('helpForMisusedAtTopLevelCode', function() { var help = function(msg) { var log = []; From 2813514587c2e8feb8311a1fb89742b4446ee0e7 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Wed, 20 Mar 2024 09:45:26 -0400 Subject: [PATCH 42/45] Fix constants not showing up due to examples being omitted --- utils/convert.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/convert.js b/utils/convert.js index be68a9476f..28a0457090 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -234,12 +234,15 @@ for (const entry of allData) { const { module, submodule, forEntry } = getModuleInfo(entry); + const examples = entry.examples.map(getExample); const item = { itemtype: 'property', name: entry.name, ...locationInfo(entry), ...typeObject(entry.type), description: descriptionString(entry.description), + example: examples.length > 0 ? examples : undefined, + alt: getAlt(entry), module, submodule, class: forEntry || 'p5' From 080521a3d4c077252ddd6fcecfec02a761b0b4a8 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Thu, 21 Mar 2024 17:27:37 -0400 Subject: [PATCH 43/45] Convert p5.Element --- src/core/p5.Element.js | 104 ++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 63 deletions(-) diff --git a/src/core/p5.Element.js b/src/core/p5.Element.js index 6ea0acffc5..d35048fd6d 100644 --- a/src/core/p5.Element.js +++ b/src/core/p5.Element.js @@ -17,7 +17,6 @@ import p5 from './main'; * createButton(). * * @class p5.Element - * @constructor * @param {HTMLElement} elt wrapped DOM element. * @param {p5} [pInst] pointer to p5 instance. * @@ -52,53 +51,10 @@ import p5 from './main'; */ p5.Element = class { constructor(elt, pInst) { - /** - * Underlying - * HTMLElement - * object. Its properties and methods can be used directly. - * - * @example - *
    - * - * function setup() { - * // Create a canvas element and - * // assign it to cnv. - * let cnv = createCanvas(100, 100); - * - * background(200); - * - * // Set the border style for the - * // canvas. - * cnv.elt.style.border = '5px dashed deeppink'; - * - * describe('A gray square with a pink border drawn with dashed lines.'); - * } - * - *
    - * - * @property elt - * @name elt - * @readOnly - */ this.elt = elt; - /** - * @private - * @type {p5.Element} - * @name _pInst - */ this._pInst = this._pixelsState = pInst; this._events = {}; - /** - * @type {Number} - * @property width - * @name width - */ this.width = this.elt.offsetWidth; - /** - * @type {Number} - * @property height - * @name height - */ this.height = this.elt.offsetHeight; } @@ -120,7 +76,6 @@ p5.Element = class { * Calling `myElement.parent()` without an argument returns this element's * parent. * - * @method parent * @param {String|p5.Element|Object} parent ID, p5.Element, * or HTMLElement of desired parent element. * @chainable @@ -210,7 +165,6 @@ p5.Element = class { *
    */ /** - * @method parent * @return {p5.Element} */ parent(p) { @@ -235,7 +189,6 @@ p5.Element = class { * * Calling `myElement.id()` without an argument returns its ID as a string. * - * @method id * @param {String} id ID of the element. * @chainable * @@ -263,7 +216,6 @@ p5.Element = class { *
    */ /** - * @method id * @return {String} ID of the element. */ id(id) { @@ -284,7 +236,6 @@ p5.Element = class { * * Calling `myElement.class()` without an argument returns a string with its current classes. * - * @method class * @param {String} class class to add. * @chainable * @@ -314,7 +265,6 @@ p5.Element = class { *
    */ /** - * @method class * @return {String} element's classes, if any. */ class(c) { @@ -333,7 +283,6 @@ p5.Element = class { * Note: Some mobile browsers may also trigger this event when the element * receives a quick tap. * - * @method mousePressed * @param {Function|Boolean} fxn function to call when the mouse is * pressed over the element. * `false` disables the function. @@ -405,7 +354,6 @@ p5.Element = class { * Calls a function when the mouse is pressed twice over the element. * Calling `myElement.doubleClicked(false)` disables the function. * - * @method doubleClicked * @param {Function|Boolean} fxn function to call when the mouse is * double clicked over the element. * `false` disables the function. @@ -475,7 +423,6 @@ p5.Element = class { * * Calling `myElement.mouseWheel(false)` disables the function. * - * @method mouseWheel * @param {Function|Boolean} fxn function to call when the mouse wheel is * scrolled over the element. * `false` disables the function. @@ -577,7 +524,6 @@ p5.Element = class { * Note: Some mobile browsers may also trigger this event when the element * receives a quick tap. * - * @method mouseReleased * @param {Function|Boolean} fxn function to call when the mouse is * pressed over the element. * `false` disables the function. @@ -642,7 +588,6 @@ p5.Element = class { * Note: Some mobile browsers may also trigger this event when the element * receives a quick tap. * - * @method mouseClicked * @param {Function|Boolean} fxn function to call when the mouse is * pressed and released over the element. * `false` disables the function. @@ -704,7 +649,6 @@ p5.Element = class { * Calls a function when the mouse moves over the element. Calling * `myElement.mouseMoved(false)` disables the function. * - * @method mouseMoved * @param {Function|Boolean} fxn function to call when the mouse * moves over the element. * `false` disables the function. @@ -766,7 +710,6 @@ p5.Element = class { * Calls a function when the mouse moves onto the element. Calling * `myElement.mouseOver(false)` disables the function. * - * @method mouseOver * @param {Function|Boolean} fxn function to call when the mouse * moves onto the element. * `false` disables the function. @@ -829,7 +772,6 @@ p5.Element = class { * Calls a function when the mouse moves off the element. Calling * `myElement.mouseOut(false)` disables the function. * - * @method mouseOut * @param {Function|Boolean} fxn function to call when the mouse * moves off the element. * `false` disables the function. @@ -894,7 +836,6 @@ p5.Element = class { * * Note: Touch functions only work on mobile devices. * - * @method touchStarted * @param {Function|Boolean} fxn function to call when the touch * starts. * `false` disables the function. @@ -960,7 +901,6 @@ p5.Element = class { * * Note: Touch functions only work on mobile devices. * - * @method touchMoved * @param {Function|Boolean} fxn function to call when the touch * moves over the element. * `false` disables the function. @@ -1026,7 +966,6 @@ p5.Element = class { * * Note: Touch functions only work on mobile devices. * - * @method touchEnded * @param {Function|Boolean} fxn function to call when the touch * ends. * `false` disables the function. @@ -1091,7 +1030,6 @@ p5.Element = class { * Calls a function when a file is dragged over the element. Calling * `myElement.dragOver(false)` disables the function. * - * @method dragOver * @param {Function|Boolean} fxn function to call when the file is * dragged over the element. * `false` disables the function. @@ -1154,7 +1092,6 @@ p5.Element = class { * Calls a function when a file is dragged off the element. Calling * Calling `myElement.dragLeave(false)` disables the function. * - * @method dragLeave * @param {Function|Boolean} fxn function to call when the file is * dragged off the element. * `false` disables the function. @@ -1273,4 +1210,45 @@ p5.Element = class { } }; +/** + * Underlying + * HTMLElement + * object. Its properties and methods can be used directly. + * + * @example + *
    + * + * function setup() { + * // Create a canvas element and + * // assign it to cnv. + * let cnv = createCanvas(100, 100); + * + * background(200); + * + * // Set the border style for the + * // canvas. + * cnv.elt.style.border = '5px dashed deeppink'; + * + * describe('A gray square with a pink border drawn with dashed lines.'); + * } + * + *
    + * + * @property elt + * @for p5.Element + * @readOnly + */ + +/** + * @type {Number} + * @property width + * @for p5.Element + */ + +/** + * @type {Number} + * @property height + * @for p5.Element + */ + export default p5.Element; From 1f6c69bc3633d753ed72405b84aaca0bb3807b6a Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Wed, 10 Apr 2024 14:21:30 +0100 Subject: [PATCH 44/45] Prevent some comments from being read as documentation --- src/color/p5.Color.js | 6 +++--- src/core/internationalization.js | 10 +++++----- src/core/p5.Renderer2D.js | 2 +- src/image/filters.js | 2 +- translations/dev.js | 2 +- translations/index.js | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/color/p5.Color.js b/src/color/p5.Color.js index 040f96393b..08371b3c4c 100644 --- a/src/color/p5.Color.js +++ b/src/color/p5.Color.js @@ -11,7 +11,7 @@ import p5 from '../core/main'; import * as constants from '../core/constants'; import color_conversion from './color_conversion'; -/** +/* * CSS named colors. */ const namedColors = { @@ -165,7 +165,7 @@ const namedColors = { yellowgreen: '#9acd32' }; -/** +/* * These regular expressions are used to build up the patterns for matching * viable CSS color strings: fragmenting the regexes in this way increases the * legibility and comprehensibility of the code. @@ -178,7 +178,7 @@ const INTEGER = /(\d{1,3})/; // Match integers: 79, 255, etc. const DECIMAL = /((?:\d+(?:\.\d+)?)|(?:\.\d+))/; // Match 129.6, 79, .9, etc. const PERCENT = new RegExp(`${DECIMAL.source}%`); // Match 12.9%, 79%, .9%, etc. -/** +/* * Full color string patterns. The capture groups are necessary. */ const colorPatterns = { diff --git a/src/core/internationalization.js b/src/core/internationalization.js index e3b0f77a5b..f7b677d6f1 100644 --- a/src/core/internationalization.js +++ b/src/core/internationalization.js @@ -23,7 +23,7 @@ if (typeof IS_MINIFIED === 'undefined') { } } -/** +/* * This is our i18next "backend" plugin. It tries to fetch languages * from a CDN. */ @@ -119,7 +119,7 @@ export let translator = (key, values) => { }; // (We'll set this to a real value in the init function below!) -/** +/* * Set up our translation function, with loaded languages */ export const initialize = () => { @@ -164,21 +164,21 @@ export const initialize = () => { return i18init; }; -/** +/* * Returns a list of languages we have translations loaded for */ export const availableTranslatorLanguages = () => { return i18next.languages; }; -/** +/* * Returns the current language selected for translation */ export const currentTranslatorLanguage = language => { return i18next.language; }; -/** +/* * Sets the current language for translation * Returns a promise that resolved when loading is finished, * or rejects if it fails. diff --git a/src/core/p5.Renderer2D.js b/src/core/p5.Renderer2D.js index e5943bdda1..6a6ec0c589 100644 --- a/src/core/p5.Renderer2D.js +++ b/src/core/p5.Renderer2D.js @@ -3,7 +3,7 @@ import * as constants from './constants'; import Renderer from './p5.Renderer'; -/** +/* * p5.Renderer2D * The 2D graphics canvas renderer class. * extends p5.Renderer diff --git a/src/image/filters.js b/src/image/filters.js index e178b9585a..fe9f6b6f04 100644 --- a/src/image/filters.js +++ b/src/image/filters.js @@ -1,4 +1,4 @@ -/** +/* * This module defines the filters for use with image buffers. * * This module is basically a collection of functions stored in an object diff --git a/translations/dev.js b/translations/dev.js index 09c09e6cb9..b34a51704b 100644 --- a/translations/dev.js +++ b/translations/dev.js @@ -4,7 +4,7 @@ export { default as ko_translation } from './ko/translation'; export { default as zh_translation } from './zh/translation'; export { default as hi_translation } from './hi/translation'; -/** +/* * When adding a new language, add a new "export" statement above this. * For example, if we were to add fr ( French ), we would write: * export { default as fr_translation } from './fr/translation'; diff --git a/translations/index.js b/translations/index.js index 4bcf7bf102..772a52d739 100644 --- a/translations/index.js +++ b/translations/index.js @@ -3,7 +3,7 @@ import en from './en/translation'; // Only one language is imported above. This is intentional as other languages // will be hosted online and then downloaded whenever needed -/** +/* * Here, we define a default/fallback language which we can use without internet. * You won't have to change this when adding a new language. * @@ -15,7 +15,7 @@ export default { } }; -/** +/* * This is a list of languages that we have added so far. * If you have just added a new language (yay!), add its key to the list below * (`en` is english, `es` es espaƱol). Also add its export to From 7b0a34058264fd5f78d373e547dfa4288d99639f Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sun, 14 Apr 2024 08:30:45 -0600 Subject: [PATCH 45/45] Add typedefs for all constants and remove all generic Constant types --- docs/converted.json | 27999 +++++++++++++++++++++++++++++ docs/parameterData.json.bak | 16154 +++++++++++++++++ src/accessibility/describe.js | 4 +- src/accessibility/outputs.js | 4 +- src/color/p5.Color.js | 2 + src/color/setting.js | 4 +- src/core/constants.js | 366 +- src/core/environment.js | 4 +- src/core/internationalization.js | 5 + src/core/p5.Graphics.js | 2 +- src/core/p5.Renderer2D.js | 9 +- src/core/rendering.js | 6 +- src/core/shape/2d_primitives.js | 2 +- src/core/shape/attributes.js | 8 +- src/dom/dom.js | 6 +- src/events/acceleration.js | 2 +- src/events/mouse.js | 2 +- src/image/filters.js | 2 + src/image/loading_displaying.js | 22 +- src/image/p5.Image.js | 6 +- src/image/pixels.js | 12 +- src/math/trigonometry.js | 4 +- src/typography/attributes.js | 8 +- src/webgl/interaction.js | 6 +- src/webgl/material.js | 6 +- translations/index.js | 1 + utils/convert.js | 4 +- 27 files changed, 44454 insertions(+), 196 deletions(-) create mode 100644 docs/converted.json create mode 100644 docs/parameterData.json.bak diff --git a/docs/converted.json b/docs/converted.json new file mode 100644 index 0000000000..c5b5010368 --- /dev/null +++ b/docs/converted.json @@ -0,0 +1,27999 @@ +{ + "project": {}, + "files": {}, + "modules": { + "Environment": { + "name": "Environment", + "submodules": { + "Environment": 1 + }, + "classes": {} + }, + "Color": { + "name": "Color", + "submodules": { + "Color Conversion": 1, + "Creating & Reading": 1, + "Setting": 1 + }, + "classes": {} + }, + "Constants": { + "name": "Constants", + "submodules": { + "Constants": 1 + }, + "classes": {} + }, + "Structure": { + "name": "Structure", + "submodules": { + "Structure": 1 + }, + "classes": {} + }, + "DOM": { + "name": "DOM", + "submodules": { + "DOM": 1 + }, + "classes": {} + }, + "Rendering": { + "name": "Rendering", + "submodules": { + "Rendering": 1 + }, + "classes": {} + }, + "Foundation": { + "name": "Foundation", + "submodules": { + "Foundation": 1 + }, + "classes": {} + }, + "Shape": { + "name": "Shape", + "submodules": { + "2D Primitives": 1, + "Attributes": 1, + "Curves": 1, + "Vertex": 1, + "3D Primitives": 1, + "3D Models": 1 + }, + "classes": {} + }, + "Transform": { + "name": "Transform", + "submodules": { + "Transform": 1 + }, + "classes": {} + }, + "Data": { + "name": "Data", + "submodules": { + "LocalStorage": 1, + "Dictionary": 1, + "Array Functions": 1, + "Conversion": 1, + "String Functions": 1 + }, + "classes": {} + }, + "Events": { + "name": "Events", + "submodules": { + "Acceleration": 1, + "Keyboard": 1, + "Mouse": 1, + "Touch": 1 + }, + "classes": {} + }, + "Image": { + "name": "Image", + "submodules": { + "Image": 1, + "Loading & Displaying": 1, + "Pixels": 1 + }, + "classes": {} + }, + "IO": { + "name": "IO", + "submodules": { + "Input": 1, + "Output": 1, + "Table": 1, + "Time & Date": 1 + }, + "classes": {} + }, + "Math": { + "name": "Math", + "submodules": { + "Calculation": 1, + "Vector": 1, + "Noise": 1, + "Random": 1, + "Trigonometry": 1 + }, + "classes": {} + }, + "Typography": { + "name": "Typography", + "submodules": { + "Attributes": 1, + "Loading & Displaying": 1 + }, + "classes": {} + }, + "3D": { + "name": "3D", + "submodules": { + "Interaction": 1, + "Lights": 1, + "Material": 1, + "Camera": 1 + }, + "classes": {} + }, + "Color Conversion": { + "name": "Color Conversion", + "module": "Color", + "is_submodule": 1 + }, + "Creating & Reading": { + "name": "Creating & Reading", + "module": "Color", + "is_submodule": 1 + }, + "Setting": { + "name": "Setting", + "module": "Color", + "is_submodule": 1 + }, + "2D Primitives": { + "name": "2D Primitives", + "module": "Shape", + "is_submodule": 1 + }, + "Attributes": { + "name": "Attributes", + "module": "Shape", + "is_submodule": 1 + }, + "Curves": { + "name": "Curves", + "module": "Shape", + "is_submodule": 1 + }, + "Vertex": { + "name": "Vertex", + "module": "Shape", + "is_submodule": 1 + }, + "3D Primitives": { + "name": "3D Primitives", + "module": "Shape", + "is_submodule": 1 + }, + "3D Models": { + "name": "3D Models", + "module": "Shape", + "is_submodule": 1 + }, + "LocalStorage": { + "name": "LocalStorage", + "module": "Data", + "is_submodule": 1 + }, + "Dictionary": { + "name": "Dictionary", + "module": "Data", + "is_submodule": 1 + }, + "Array Functions": { + "name": "Array Functions", + "module": "Data", + "is_submodule": 1 + }, + "Conversion": { + "name": "Conversion", + "module": "Data", + "is_submodule": 1 + }, + "String Functions": { + "name": "String Functions", + "module": "Data", + "is_submodule": 1 + }, + "Acceleration": { + "name": "Acceleration", + "module": "Events", + "is_submodule": 1 + }, + "Keyboard": { + "name": "Keyboard", + "module": "Events", + "is_submodule": 1 + }, + "Mouse": { + "name": "Mouse", + "module": "Events", + "is_submodule": 1 + }, + "Touch": { + "name": "Touch", + "module": "Events", + "is_submodule": 1 + }, + "Loading & Displaying": { + "name": "Loading & Displaying", + "module": "Image", + "is_submodule": 1 + }, + "Pixels": { + "name": "Pixels", + "module": "Image", + "is_submodule": 1 + }, + "Input": { + "name": "Input", + "module": "IO", + "is_submodule": 1 + }, + "Output": { + "name": "Output", + "module": "IO", + "is_submodule": 1 + }, + "Table": { + "name": "Table", + "module": "IO", + "is_submodule": 1 + }, + "Time & Date": { + "name": "Time & Date", + "module": "IO", + "is_submodule": 1 + }, + "Calculation": { + "name": "Calculation", + "module": "Math", + "is_submodule": 1 + }, + "Vector": { + "name": "Vector", + "module": "Math", + "is_submodule": 1 + }, + "Noise": { + "name": "Noise", + "module": "Math", + "is_submodule": 1 + }, + "Random": { + "name": "Random", + "module": "Math", + "is_submodule": 1 + }, + "Trigonometry": { + "name": "Trigonometry", + "module": "Math", + "is_submodule": 1 + }, + "Interaction": { + "name": "Interaction", + "module": "3D", + "is_submodule": 1 + }, + "Lights": { + "name": "Lights", + "module": "3D", + "is_submodule": 1 + }, + "Material": { + "name": "Material", + "module": "3D", + "is_submodule": 1 + }, + "Camera": { + "name": "Camera", + "module": "3D", + "is_submodule": 1 + } + }, + "classes": { + "p5": { + "name": "p5", + "file": "src/core/main.js", + "line": 32, + "description": "

    This is the p5 instance constructor.

    \n

    A p5 instance holds all the properties and methods related to\na p5 sketch. It expects an incoming sketch closure and it can also\ntake an optional node parameter for attaching the generated p5 canvas\nto a node. The sketch closure takes the newly created p5 instance as\nits sole argument and may optionally set preload(),\nsetup(), and/or\ndraw() properties on it for running a sketch.

    \n

    A p5 sketch can run in \"global\" or \"instance\" mode:\n\"global\" - all properties and methods are attached to the window\n\"instance\" - all properties and methods are bound to this p5 object

    \n", + "example": [], + "params": [ + { + "name": "sketch", + "description": "a closure that can set optional preload(),\nsetup(), and/or draw() properties on the\ngiven p5 instance" + }, + { + "name": "node", + "description": "element to attach canvas to", + "optional": 1, + "type": "HTMLElement" + } + ], + "return": { + "description": "a p5 instance", + "type": "p5" + }, + "is_constructor": 1, + "module": "Structure", + "submodule": "Structure" + }, + "p5.Color": { + "name": "p5.Color", + "file": "src/color/p5.Color.js", + "line": 343, + "description": "

    A class to describe a color. Each p5.Color object stores the color mode\nand level maxes that were active during its construction. These values are\nused to interpret the arguments passed to the object's constructor. They\nalso determine output formatting such as when\nsaturation() is called.

    \n

    Color is stored internally as an array of ideal RGBA values in floating\npoint form, normalized from 0 to 1. These values are used to calculate the\nclosest screen colors, which are RGBA levels from 0 to 255. Screen colors\nare sent to the renderer.

    \n

    When different color representations are calculated, the results are cached\nfor performance. These values are normalized, floating-point numbers.

    \n

    color() is the recommended way to create an instance\nof this class.

    \n", + "example": [], + "params": [ + { + "name": "pInst", + "description": "pointer to p5 instance.", + "optional": 1, + "type": "p5" + }, + { + "name": "vals", + "description": "an array containing the color values\nfor red, green, blue and alpha channel\nor CSS color.", + "type": "Number[]|String" + } + ], + "is_constructor": 1, + "module": "Color", + "submodule": "Creating & Reading" + }, + "FetchResources": { + "name": "FetchResources", + "file": "src/core/internationalization.js", + "line": 30, + "description": "This is our i18next \"backend\" plugin. It tries to fetch languages\nfrom a CDN.", + "example": [], + "params": [], + "is_constructor": 1 + }, + "p5.Element": { + "name": "p5.Element", + "file": "src/core/p5.Element.js", + "line": 53, + "description": "

    A class to describe an\nHTML element.\nSketches can use many elements. Common elements include the drawing canvas,\nbuttons, sliders, webcam feeds, and so on.

    \n

    All elements share the methods of the p5.Element class. They're created\nwith functions such as createCanvas() and\ncreateButton().

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n\n background(200);\n\n // Create a button element and\n // place it beneath the canvas.\n let btn = createButton('change');\n btn.position(0, 100);\n\n // Call randomColor() when\n // the button is pressed.\n btn.mousePressed(randomColor);\n\n describe('A gray square with a button that says \"change\" beneath it. The square changes color when the user presses the button.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    " + ], + "params": [ + { + "name": "elt", + "description": "wrapped DOM element.", + "type": "HTMLElement" + }, + { + "name": "pInst", + "description": "pointer to p5 instance.", + "optional": 1, + "type": "p5" + } + ], + "is_constructor": 1, + "module": "DOM", + "submodule": "DOM" + }, + "p5.Graphics": { + "name": "p5.Graphics", + "file": "src/core/p5.Graphics.js", + "line": 25, + "extends": "p5.Element", + "description": "Thin wrapper around a renderer, to be used for creating a\ngraphics buffer object. Use this class if you need\nto draw into an off-screen graphics buffer. The two parameters define the\nwidth and height in pixels. The fields and methods for this class are\nextensive, but mirror the normal drawing API for p5.", + "example": [], + "params": [ + { + "name": "w", + "description": "width", + "type": "Number" + }, + { + "name": "h", + "description": "height", + "type": "Number" + }, + { + "name": "renderer", + "description": "the renderer to use, either P2D or WEBGL", + "type": "Constant" + }, + { + "name": "pInst", + "description": "pointer to p5 instance", + "optional": 1, + "type": "p5" + }, + { + "name": "canvas", + "description": "existing html canvas element", + "optional": 1, + "type": "HTMLCanvasElement" + } + ], + "is_constructor": 1, + "module": "Rendering", + "submodule": "Rendering" + }, + "p5.Renderer": { + "name": "p5.Renderer", + "file": "src/core/p5.Renderer.js", + "line": 21, + "extends": "p5.Element", + "description": "Main graphics and rendering context, as well as the base API\nimplementation for p5.js \"core\". To be used as the superclass for\nRenderer2D and Renderer3D classes, respectively.", + "example": [], + "params": [ + { + "name": "elt", + "description": "DOM node that is wrapped", + "type": "HTMLElement" + }, + { + "name": "pInst", + "description": "pointer to p5 instance", + "optional": 1, + "type": "p5" + }, + { + "name": "isMainCanvas", + "description": "whether we're using it as main canvas", + "optional": 1, + "type": "Boolean" + } + ], + "is_constructor": 1, + "module": "Rendering", + "submodule": "Rendering" + }, + "p5.TypedDict": { + "name": "p5.TypedDict", + "file": "src/data/p5.TypedDict.js", + "line": 89, + "description": "Base class for all p5.Dictionary types. Specifically\ntyped Dictionary classes inherit from this class.", + "example": [], + "params": [], + "is_constructor": 1, + "module": "Data", + "submodule": "Dictionary" + }, + "p5.StringDict": { + "name": "p5.StringDict", + "file": "src/data/p5.TypedDict.js", + "line": 384, + "extends": "p5.TypedDict", + "description": "A simple Dictionary class for Strings.", + "example": [], + "params": [], + "is_constructor": 1, + "module": "Data", + "submodule": "Dictionary" + }, + "p5.NumberDict": { + "name": "p5.NumberDict", + "file": "src/data/p5.TypedDict.js", + "line": 402, + "extends": "p5.TypedDict", + "description": "A simple Dictionary class for Numbers.", + "example": [], + "params": [], + "is_constructor": 1, + "module": "Data", + "submodule": "Dictionary" + }, + "p5.MediaElement": { + "name": "p5.MediaElement", + "file": "src/dom/dom.js", + "line": 3676, + "extends": "p5.Element", + "description": "

    A class to handle audio and video.

    \n

    p5.MediaElement extends p5.Element with\nmethods to handle audio and video. p5.MediaElement objects are created by\ncalling createVideo,\ncreateAudio, and\ncreateCapture.

    \n", + "example": [ + "
    \n\nlet capture;\n\nfunction setup() {\n createCanvas(100, 100);\n\n // Create a p5.MediaElement using createCapture().\n capture = createCapture(VIDEO);\n capture.hide();\n}\n\nfunction draw() {\n // Display the video stream and invert the colors.\n image(capture, 0, 0, width, width * capture.height / capture.width);\n filter(INVERT);\n}\n\n
    " + ], + "params": [ + { + "name": "elt", + "description": "DOM node that is wrapped", + "type": "String" + } + ], + "is_constructor": 1, + "module": "DOM", + "submodule": "DOM" + }, + "p5.File": { + "name": "p5.File", + "file": "src/dom/dom.js", + "line": 4958, + "description": "

    A class to describe a file.

    \n

    p5.File objects are used by\nmyElement.drop() and\ncreated by\ncreateFileInput.

    \n", + "example": [ + "
    \n\n// Use the file input to load a\n// file and display its info.\n\nfunction setup() {\n background(200);\n\n // Create a file input and place it beneath\n // the canvas. Call displayInfo() when\n // the file loads.\n let input = createFileInput(displayInfo);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user loads a file, its info is written in black.');\n}\n\n// Display the p5.File's info\n// once it loads.\nfunction displayInfo(file) {\n background(200);\n\n // Display the p5.File's name.\n text(file.name, 10, 10, 80, 40);\n // Display the p5.File's type and subtype.\n text(`${file.type}/${file.subtype}`, 10, 70);\n // Display the p5.File's size in bytes.\n text(file.size, 10, 90);\n}\n\n
    \n\n
    \n\n// Use the file input to select an image to\n// load and display.\nlet img;\n\nfunction setup() {\n // Create a file input and place it beneath\n // the canvas. Call handleImage() when\n // the file image loads.\n let input = createFileInput(handleImage);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user selects an image file to load, it is displayed on the square.');\n}\n\nfunction draw() {\n background(200);\n\n // Draw the image if it's ready.\n if (img) {\n image(img, 0, 0, width, height);\n }\n}\n\n// Use the p5.File's data once\n// it loads.\nfunction handleImage(file) {\n // Check the p5.File's type.\n if (file.type === 'image') {\n // Create an image using using\n // the p5.File's data.\n img = createImg(file.data, '');\n\n // Hide the image element so it\n // doesn't appear twice.\n img.hide();\n } else {\n img = null;\n }\n}\n\n
    " + ], + "params": [ + { + "name": "file", + "description": "wrapped file.", + "type": "File" + } + ], + "is_constructor": 1, + "module": "DOM", + "submodule": "DOM" + }, + "p5.Image": { + "name": "p5.Image", + "file": "src/image/p5.Image.js", + "line": 87, + "description": "

    A class to describe an image. Images are rectangular grids of pixels that\ncan be displayed and modified.

    \n

    Existing images can be loaded by calling\nloadImage(). Blank images can be created by\ncalling createImage(). p5.Image objects\nhave methods for common tasks such as applying filters and modifying\npixel values.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n\n describe('An image of a brick wall.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(GRAY);\n image(img, 0, 0);\n\n describe('A grayscale image of a brick wall.');\n}\n\n
    \n\n
    \n\nbackground(200);\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let x = 0; x < img.width; x += 1) {\n for (let y = 0; y < img.height; y += 1) {\n img.set(x, y, 0);\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    " + ], + "params": [ + { + "name": "width", + "type": "Number" + }, + { + "name": "height", + "type": "Number" + } + ], + "is_constructor": 1, + "module": "Image", + "submodule": "Image" + }, + "p5.Table": { + "name": "p5.Table", + "file": "src/io/p5.Table.js", + "line": 41, + "description": "Table objects store data with multiple rows and columns, much\nlike in a traditional spreadsheet. Tables can be generated from\nscratch, dynamically, or using data from an existing file.", + "example": [], + "params": [ + { + "name": "rows", + "description": "An array of p5.TableRow objects", + "optional": 1, + "type": "p5.TableRow[]" + } + ], + "is_constructor": 1, + "module": "IO", + "submodule": "Table" + }, + "p5.TableRow": { + "name": "p5.TableRow", + "file": "src/io/p5.TableRow.js", + "line": 23, + "description": "

    A TableRow object represents a single row of data values,\nstored in columns, from a table.

    \n

    A Table Row contains both an ordered array, and an unordered\nJSON object.

    \n", + "example": [], + "params": [ + { + "name": "str", + "description": "optional: populate the row with a\nstring of values, separated by the\nseparator", + "optional": 1, + "type": "String" + }, + { + "name": "separator", + "description": "comma separated values (csv) by default", + "optional": 1, + "type": "String" + } + ], + "is_constructor": 1, + "module": "IO", + "submodule": "Table" + }, + "p5.XML": { + "name": "p5.XML", + "file": "src/io/p5.XML.js", + "line": 51, + "description": "XML is a representation of an XML object, able to parse XML code. Use\nloadXML() to load external XML files and create XML objects.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let children = xml.getChildren('animal');\n\n for (let i = 0; i < children.length; i++) {\n let id = children[i].getNum('id');\n let coloring = children[i].getString('species');\n let name = children[i].getContent();\n print(id + ', ' + coloring + ', ' + name);\n }\n\n describe('no image displayed');\n}\n\n// Sketch prints:\n// 0, Capra hircus, Goat\n// 1, Panthera pardus, Leopard\n// 2, Equus zebra, Zebra\n
    " + ], + "params": [], + "is_constructor": 1, + "module": "IO", + "submodule": "Input" + }, + "p5.Vector": { + "name": "p5.Vector", + "file": "src/math/p5.Vector.js", + "line": 94, + "description": "

    A class to describe a two or three-dimensional vector. A vector is like an\narrow pointing in space. Vectors have both magnitude (length) and\ndirection.

    \n

    p5.Vector objects are often used to program motion because they simplify\nthe math. For example, a moving ball has a position and a velocity.\nPosition describes where the ball is in space. The ball's position vector\nextends from the origin to the ball's center. Velocity describes the ball's\nspeed and the direction it's moving. If the ball is moving straight up, its\nvelocity vector points straight up. Adding the ball's velocity vector to\nits position vector moves it, as in pos.add(vel). Vector math relies on\nmethods inside the p5.Vector class.

    \n", + "example": [ + "
    \n\nlet p1 = createVector(25, 25);\nlet p2 = createVector(75, 75);\n\nstrokeWeight(5);\npoint(p1);\npoint(p2.x, p2.y);\n\ndescribe('Two black dots on a gray square, one at the top left and the other at the bottom right.');\n\n
    \n\n
    \n\nlet pos;\nlet vel;\n\nfunction setup() {\n createCanvas(100, 100);\n pos = createVector(width / 2, height);\n vel = createVector(0, -1);\n}\n\nfunction draw() {\n background(200);\n\n pos.add(vel);\n\n if (pos.y < 0) {\n pos.y = height;\n }\n\n strokeWeight(5);\n point(pos);\n\n describe('A black dot moves from bottom to top on a gray square. The dot reappears at the bottom when it reaches the top.');\n}\n\n
    " + ], + "params": [ + { + "name": "x", + "description": "x component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "y component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z component of the vector.", + "optional": 1, + "type": "Number" + } + ], + "is_constructor": 1, + "module": "Math", + "submodule": "Vector" + }, + "p5.Font": { + "name": "p5.Font", + "file": "src/typography/p5.Font.js", + "line": 38, + "description": "A class to describe fonts.", + "example": [ + "
    \n\nlet font;\n\nfunction preload() {\n // Creates a p5.Font object.\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n fill('deeppink');\n textFont(font);\n textSize(36);\n text('p5*js', 10, 50);\n\n describe('The text \"p5*js\" written in pink on a white background.');\n}\n\n
    " + ], + "params": [ + { + "name": "pInst", + "description": "pointer to p5 instance.", + "optional": 1, + "type": "p5" + } + ], + "is_constructor": 1, + "module": "Typography", + "submodule": "Loading & Displaying" + }, + "p5.Camera": { + "name": "p5.Camera", + "file": "src/webgl/p5.Camera.js", + "line": 485, + "description": "

    This class describes a camera for use in p5's\n\nWebGL mode. It contains camera position, orientation, and projection\ninformation necessary for rendering a 3D scene.

    \n

    New p5.Camera objects can be made through the\ncreateCamera() function and controlled through\nthe methods described below. A camera created in this way will use a default\nposition in the scene and a default perspective projection until these\nproperties are changed through the various methods available. It is possible\nto create multiple cameras, in which case the current camera\ncan be set through the setCamera() method.

    \n

    Note:\nThe methods below operate in two coordinate systems: the 'world' coordinate\nsystem describe positions in terms of their relationship to the origin along\nthe X, Y and Z axes whereas the camera's 'local' coordinate system\ndescribes positions from the camera's point of view: left-right, up-down,\nand forward-backward. The move() method,\nfor instance, moves the camera along its own axes, whereas the\nsetPosition()\nmethod sets the camera's position in world-space.

    \n

    The camera object properties\neyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ\nwhich describes camera position, orientation, and projection\nare also accessible via the camera object generated using\ncreateCamera()

    \n", + "example": [ + "
    \n\nlet cam;\nlet delta = 0.01;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // set initial pan angle\n cam.pan(-0.8);\n describe(\n 'camera view pans left and right across a series of rotating 3D boxes.'\n );\n}\n\nfunction draw() {\n background(200);\n\n // pan camera according to angle 'delta'\n cam.pan(delta);\n\n // every 160 frames, switch direction\n if (frameCount % 160 === 0) {\n delta *= -1;\n }\n\n rotateX(frameCount * 0.01);\n translate(-100, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n}\n\n
    " + ], + "alt": "camera view pans left and right across a series of rotating 3D boxes.", + "params": [ + { + "name": "rendererGL", + "description": "instance of WebGL renderer", + "type": "rendererGL" + } + ], + "is_constructor": 1, + "module": "3D", + "submodule": "Camera" + }, + "p5.Framebuffer": { + "name": "p5.Framebuffer", + "file": "src/webgl/p5.Framebuffer.js", + "line": 80, + "description": "An object that one can draw to and then read as a texture. While similar\nto a p5.Graphics, using a p5.Framebuffer as a texture will generally run\nmuch faster, as it lives within the same WebGL context as the canvas it\nis created on. It only works in WebGL mode.", + "example": [], + "params": [ + { + "name": "target", + "description": "A p5 global instance or p5.Graphics", + "type": "p5.Graphics|p5" + }, + { + "name": "settings", + "description": "A settings object", + "optional": 1, + "type": "Object" + } + ], + "is_constructor": 1, + "module": "Rendering" + }, + "p5.Geometry": { + "name": "p5.Geometry", + "file": "src/webgl/p5.Geometry.js", + "line": 21, + "description": "p5 Geometry class", + "example": [], + "params": [ + { + "name": "detailX", + "description": "number of vertices along the x-axis.", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "number of vertices along the y-axis.", + "optional": 1, + "type": "Integer" + }, + { + "name": "callback", + "description": "function to call upon object instantiation.", + "optional": 1, + "type": "function" + } + ], + "is_constructor": 1, + "module": "Shape", + "submodule": "3D Primitives" + }, + "p5.Shader": { + "name": "p5.Shader", + "file": "src/webgl/p5.Shader.js", + "line": 19, + "description": "Shader class for WEBGL Mode", + "example": [], + "params": [ + { + "name": "renderer", + "description": "an instance of p5.RendererGL that\nwill provide the GL context for this new p5.Shader", + "type": "p5.RendererGL" + }, + { + "name": "vertSrc", + "description": "source code for the vertex shader (as a string)", + "type": "String" + }, + { + "name": "fragSrc", + "description": "source code for the fragment shader (as a string)", + "type": "String" + } + ], + "is_constructor": 1, + "module": "3D", + "submodule": "Material" + } + }, + "classitems": [ + { + "itemtype": "property", + "name": "namedColors", + "file": "src/color/p5.Color.js", + "line": 17, + "description": "CSS named colors.", + "module": "Color", + "submodule": "Creating & Reading", + "class": "p5" + }, + { + "itemtype": "property", + "name": "WHITESPACE", + "file": "src/color/p5.Color.js", + "line": 176, + "description": "

    These regular expressions are used to build up the patterns for matching\nviable CSS color strings: fragmenting the regexes in this way increases the\nlegibility and comprehensibility of the code.

    \n

    Note that RGB values of .9 are not parsed by IE, but are supported here for\ncolor string consistency.

    \n", + "module": "Color", + "submodule": "Creating & Reading", + "class": "p5" + }, + { + "itemtype": "property", + "name": "colorPatterns", + "file": "src/color/p5.Color.js", + "line": 184, + "description": "Full color string patterns. The capture groups are necessary.", + "module": "Color", + "submodule": "Creating & Reading", + "class": "p5" + }, + { + "itemtype": "property", + "name": "VERSION", + "file": "src/core/constants.js", + "line": 14, + "type": "string", + "description": "Version of this p5.js.", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "P2D", + "file": "src/core/constants.js", + "line": 23, + "description": "The default, two-dimensional renderer.", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "WEBGL", + "file": "src/core/constants.js", + "line": 44, + "description": "

    One of the two render modes in p5.js, used for computationally intensive tasks like 3D rendering and shaders.

    \n

    WEBGL differs from the default P2D renderer in the following ways:

    \n

    To learn more about WEBGL mode, check out all the interactive WEBGL tutorials in the \"Learn\" section of this website, or read the wiki article \"Getting started with WebGL in p5\".

    \n", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "WEBGL2", + "file": "src/core/constants.js", + "line": 52, + "description": "One of the two possible values of a WebGL canvas (either WEBGL or WEBGL2),\nwhich can be used to determine what capabilities the rendering environment\nhas.", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ARROW", + "file": "src/core/constants.js", + "line": 59, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CROSS", + "file": "src/core/constants.js", + "line": 64, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "HAND", + "file": "src/core/constants.js", + "line": 69, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "MOVE", + "file": "src/core/constants.js", + "line": 74, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TEXT", + "file": "src/core/constants.js", + "line": 79, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "WAIT", + "file": "src/core/constants.js", + "line": 84, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "HALF_PI", + "file": "src/core/constants.js", + "line": 105, + "description": "HALF_PI is a mathematical constant with the value\n1.57079632679489661923. It is half the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions sin() and cos().", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "PI", + "file": "src/core/constants.js", + "line": 123, + "description": "PI is a mathematical constant with the value\n3.14159265358979323846. It is the ratio of the circumference\nof a circle to its diameter. It is useful in combination with\nthe trigonometric functions sin() and cos().", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "QUARTER_PI", + "file": "src/core/constants.js", + "line": 141, + "description": "QUARTER_PI is a mathematical constant with the value 0.7853982.\nIt is one quarter the ratio of the circumference of a circle to\nits diameter. It is useful in combination with the trigonometric\nfunctions sin() and cos().", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TAU", + "file": "src/core/constants.js", + "line": 159, + "description": "TAU is an alias for TWO_PI, a mathematical constant with the\nvalue 6.28318530717958647693. It is twice the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions sin() and cos().", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TWO_PI", + "file": "src/core/constants.js", + "line": 177, + "description": "TWO_PI is a mathematical constant with the value\n6.28318530717958647693. It is twice the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions sin() and cos().", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "DEGREES", + "file": "src/core/constants.js", + "line": 191, + "description": "Constant to be used with the angleMode() function, to set the mode in\nwhich p5.js interprets and calculates angles (either DEGREES or RADIANS).", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "RADIANS", + "file": "src/core/constants.js", + "line": 205, + "description": "Constant to be used with the angleMode() function, to set the mode\nin which p5.js interprets and calculates angles (either RADIANS or DEGREES).", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CORNER", + "file": "src/core/constants.js", + "line": 214, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CORNERS", + "file": "src/core/constants.js", + "line": 219, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "RADIUS", + "file": "src/core/constants.js", + "line": 224, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "RIGHT", + "file": "src/core/constants.js", + "line": 229, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LEFT", + "file": "src/core/constants.js", + "line": 234, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CENTER", + "file": "src/core/constants.js", + "line": 239, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TOP", + "file": "src/core/constants.js", + "line": 244, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BOTTOM", + "file": "src/core/constants.js", + "line": 249, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BASELINE", + "file": "src/core/constants.js", + "line": 255, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "POINTS", + "file": "src/core/constants.js", + "line": 261, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LINES", + "file": "src/core/constants.js", + "line": 267, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LINE_STRIP", + "file": "src/core/constants.js", + "line": 273, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LINE_LOOP", + "file": "src/core/constants.js", + "line": 279, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TRIANGLES", + "file": "src/core/constants.js", + "line": 285, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TRIANGLE_FAN", + "file": "src/core/constants.js", + "line": 291, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TRIANGLE_STRIP", + "file": "src/core/constants.js", + "line": 297, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "QUADS", + "file": "src/core/constants.js", + "line": 302, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "QUAD_STRIP", + "file": "src/core/constants.js", + "line": 308, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TESS", + "file": "src/core/constants.js", + "line": 314, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CLOSE", + "file": "src/core/constants.js", + "line": 319, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "OPEN", + "file": "src/core/constants.js", + "line": 324, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CHORD", + "file": "src/core/constants.js", + "line": 329, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "PIE", + "file": "src/core/constants.js", + "line": 334, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "PROJECT", + "file": "src/core/constants.js", + "line": 340, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "SQUARE", + "file": "src/core/constants.js", + "line": 346, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ROUND", + "file": "src/core/constants.js", + "line": 351, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BEVEL", + "file": "src/core/constants.js", + "line": 356, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "MITER", + "file": "src/core/constants.js", + "line": 361, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "RGB", + "file": "src/core/constants.js", + "line": 368, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "HSB", + "file": "src/core/constants.js", + "line": 377, + "type": "string", + "description": "HSB (hue, saturation, brightness) is a type of color model.\nYou can learn more about it at\nHSB.", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "HSL", + "file": "src/core/constants.js", + "line": 382, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "AUTO", + "file": "src/core/constants.js", + "line": 393, + "type": "string", + "description": "AUTO allows us to automatically set the width or height of an element (but not both),\nbased on the current height and width of the element. Only one parameter can\nbe passed to the size function as AUTO, at a time.", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ALT", + "file": "src/core/constants.js", + "line": 400, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BACKSPACE", + "file": "src/core/constants.js", + "line": 405, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CONTROL", + "file": "src/core/constants.js", + "line": 410, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "DELETE", + "file": "src/core/constants.js", + "line": 415, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "DOWN_ARROW", + "file": "src/core/constants.js", + "line": 420, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ENTER", + "file": "src/core/constants.js", + "line": 425, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ESCAPE", + "file": "src/core/constants.js", + "line": 430, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LEFT_ARROW", + "file": "src/core/constants.js", + "line": 435, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "OPTION", + "file": "src/core/constants.js", + "line": 440, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "RETURN", + "file": "src/core/constants.js", + "line": 445, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "RIGHT_ARROW", + "file": "src/core/constants.js", + "line": 450, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "SHIFT", + "file": "src/core/constants.js", + "line": 455, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TAB", + "file": "src/core/constants.js", + "line": 460, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "UP_ARROW", + "file": "src/core/constants.js", + "line": 465, + "type": "number", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BLEND", + "file": "src/core/constants.js", + "line": 473, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "REMOVE", + "file": "src/core/constants.js", + "line": 479, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ADD", + "file": "src/core/constants.js", + "line": 485, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "DARKEST", + "file": "src/core/constants.js", + "line": 492, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LIGHTEST", + "file": "src/core/constants.js", + "line": 498, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "DIFFERENCE", + "file": "src/core/constants.js", + "line": 503, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "SUBTRACT", + "file": "src/core/constants.js", + "line": 508, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "EXCLUSION", + "file": "src/core/constants.js", + "line": 513, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "MULTIPLY", + "file": "src/core/constants.js", + "line": 518, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "SCREEN", + "file": "src/core/constants.js", + "line": 523, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "REPLACE", + "file": "src/core/constants.js", + "line": 529, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "OVERLAY", + "file": "src/core/constants.js", + "line": 534, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "HARD_LIGHT", + "file": "src/core/constants.js", + "line": 539, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "SOFT_LIGHT", + "file": "src/core/constants.js", + "line": 544, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "DODGE", + "file": "src/core/constants.js", + "line": 550, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BURN", + "file": "src/core/constants.js", + "line": 556, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "THRESHOLD", + "file": "src/core/constants.js", + "line": 563, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "GRAY", + "file": "src/core/constants.js", + "line": 568, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "OPAQUE", + "file": "src/core/constants.js", + "line": 573, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "INVERT", + "file": "src/core/constants.js", + "line": 578, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "POSTERIZE", + "file": "src/core/constants.js", + "line": 583, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "DILATE", + "file": "src/core/constants.js", + "line": 588, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ERODE", + "file": "src/core/constants.js", + "line": 593, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BLUR", + "file": "src/core/constants.js", + "line": 598, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "NORMAL", + "file": "src/core/constants.js", + "line": 605, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "ITALIC", + "file": "src/core/constants.js", + "line": 610, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BOLD", + "file": "src/core/constants.js", + "line": 615, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BOLDITALIC", + "file": "src/core/constants.js", + "line": 620, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CHAR", + "file": "src/core/constants.js", + "line": 625, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "WORD", + "file": "src/core/constants.js", + "line": 630, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LINEAR", + "file": "src/core/constants.js", + "line": 642, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "QUADRATIC", + "file": "src/core/constants.js", + "line": 647, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "BEZIER", + "file": "src/core/constants.js", + "line": 652, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CURVE", + "file": "src/core/constants.js", + "line": 657, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "STROKE", + "file": "src/core/constants.js", + "line": 664, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "FILL", + "file": "src/core/constants.js", + "line": 669, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "TEXTURE", + "file": "src/core/constants.js", + "line": 674, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "IMMEDIATE", + "file": "src/core/constants.js", + "line": 679, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "IMAGE", + "file": "src/core/constants.js", + "line": 687, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "NEAREST", + "file": "src/core/constants.js", + "line": 695, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "REPEAT", + "file": "src/core/constants.js", + "line": 700, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CLAMP", + "file": "src/core/constants.js", + "line": 705, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "MIRROR", + "file": "src/core/constants.js", + "line": 710, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "FLAT", + "file": "src/core/constants.js", + "line": 717, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "SMOOTH", + "file": "src/core/constants.js", + "line": 722, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LANDSCAPE", + "file": "src/core/constants.js", + "line": 729, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "PORTRAIT", + "file": "src/core/constants.js", + "line": 734, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "GRID", + "file": "src/core/constants.js", + "line": 744, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "AXES", + "file": "src/core/constants.js", + "line": 750, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "LABEL", + "file": "src/core/constants.js", + "line": 756, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "FALLBACK", + "file": "src/core/constants.js", + "line": 761, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "CONTAIN", + "file": "src/core/constants.js", + "line": 767, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "COVER", + "file": "src/core/constants.js", + "line": 773, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "UNSIGNED_BYTE", + "file": "src/core/constants.js", + "line": 779, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "UNSIGNED_INT", + "file": "src/core/constants.js", + "line": 785, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "FLOAT", + "file": "src/core/constants.js", + "line": 791, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "HALF_FLOAT", + "file": "src/core/constants.js", + "line": 797, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "RGBA", + "file": "src/core/constants.js", + "line": 803, + "type": "string", + "description": "", + "module": "Constants", + "submodule": "Constants", + "class": "p5" + }, + { + "itemtype": "property", + "name": "initialize", + "file": "src/core/internationalization.js", + "line": 125, + "description": "Set up our translation function, with loaded languages", + "class": "p5" + }, + { + "itemtype": "property", + "name": "availableTranslatorLanguages", + "file": "src/core/internationalization.js", + "line": 170, + "description": "Returns a list of languages we have translations loaded for", + "class": "p5" + }, + { + "itemtype": "property", + "name": "currentTranslatorLanguage", + "file": "src/core/internationalization.js", + "line": 177, + "description": "Returns the current language selected for translation", + "class": "p5" + }, + { + "itemtype": "property", + "name": "setTranslatorLanguage", + "file": "src/core/internationalization.js", + "line": 186, + "description": "Sets the current language for translation\nReturns a promise that resolved when loading is finished,\nor rejects if it fails.", + "class": "p5" + }, + { + "itemtype": "property", + "name": "languages", + "file": "s", + "line": 24, + "description": "This is a list of languages that we have added so far.\nIf you have just added a new language (yay!), add its key to the list below\n(en is english, es es espaƱol). Also add its export to\ndev.js, which is another file in this folder.", + "class": "p5" + }, + { + "itemtype": "property", + "name": "styleEmpty", + "file": "src/core/p5.Renderer2D.js", + "line": 11, + "type": "string", + "description": "p5.Renderer2D\nThe 2D graphics canvas renderer class.\nextends p5.Renderer", + "class": "p5" + }, + { + "itemtype": "property", + "name": "Filters", + "file": "src/image/filters.js", + "line": 16, + "description": "

    This module defines the filters for use with image buffers.

    \n

    This module is basically a collection of functions stored in an object\nas opposed to modules. The functions are destructive, modifying\nthe passed in canvas rather than creating a copy.

    \n

    Generally speaking users of this module will use the Filters.apply method\non a canvas to create an effect.

    \n

    A number of functions are borrowed/adapted from\nhttp://www.html5rocks.com/en/tutorials/canvas/imagefilters/\nor the java processing implementation.

    \n", + "class": "p5" + }, + { + "itemtype": "property", + "name": "frameCount", + "file": "src/core/environment.js", + "line": 117, + "type": "Integer", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Display the value of\n // frameCount.\n textSize(30);\n textAlign(CENTER, CENTER);\n text(frameCount, 50, 50);\n\n describe('The number 0 written in black in the middle of a gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Set the frameRate to 30.\n frameRate(30);\n\n textSize(30);\n textAlign(CENTER, CENTER);\n}\n\nfunction draw() {\n background(200);\n\n // Display the value of\n // frameCount.\n text(frameCount, 50, 50);\n\n describe('A number written in black in the middle of a gray square. Its value increases rapidly.');\n}\n\n
    " + ], + "description": "

    Tracks the number of frames drawn since the sketch started.

    \n

    frameCount's value is 0 inside setup(). It\nincrements by 1 each time the code in draw()\nfinishes executing.

    \n" + }, + { + "itemtype": "property", + "name": "deltaTime", + "file": "src/core/environment.js", + "line": 162, + "type": "Integer", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nlet x = 0;\nlet speed = 0.05;\n\nfunction setup() {\n // Set the frameRate to 30.\n frameRate(30);\n}\n\nfunction draw() {\n background(200);\n\n // Use deltaTime to calculate\n // a change in position.\n let deltaX = speed * deltaTime;\n\n // Update the x variable.\n x += deltaX;\n\n // Reset x to 0 if it's\n // greater than 100.\n if (x > 100) {\n x = 0;\n }\n\n // Use x to set the circle's\n // position.\n circle(x, 50, 20);\n\n describe('A white circle moves from left to right on a gray background. It reappears on the left side when it reaches the right side.');\n}\n\n
    " + ], + "description": "Tracks the amount of time, in milliseconds, it took for\ndraw to draw the previous frame. deltaTime is\nuseful for simulating physics." + }, + { + "itemtype": "property", + "name": "focused", + "file": "src/core/environment.js", + "line": 191, + "type": "Boolean", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\n// Open this example in two separate browser\n// windows placed side-by-side to demonstrate.\n\nfunction draw() {\n // Change the background color\n // when the browser window\n // goes in/out of focus.\n if (focused === true) {\n background(0, 255, 0);\n } else {\n background(255, 0, 0);\n }\n\n describe('A square changes color from green to red when the browser window is out of focus.');\n}\n\n
    " + ], + "description": "Tracks whether the browser window is focused and can receive user input.\nfocused is true if the window if focused and false if not." + }, + { + "itemtype": "property", + "name": "webglVersion", + "file": "src/core/environment.js", + "line": 545, + "type": "String", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Display the current WebGL version.\n text(webglVersion, 42, 54);\n\n describe('The text \"p2d\" written in black on a gray background.');\n}\n\n
    \n\n
    \n\nlet font;\n\nfunction preload() {\n // Load a font to use.\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n // Create a canvas using WEBGL mode.\n createCanvas(100, 50, WEBGL);\n background(200);\n\n // Display the current WebGL version.\n fill(0);\n textFont(font);\n text(webglVersion, -15, 5);\n\n describe('The text \"webgl2\" written in black on a gray background.');\n}\n\n
    \n\n
    \n\nlet font;\n\nfunction preload() {\n // Load a font to use.\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n // Create a canvas using WEBGL mode.\n createCanvas(100, 50, WEBGL);\n\n // Set WebGL to version 1.\n setAttributes({ version: 1 });\n\n background(200);\n\n // Display the current WebGL version.\n fill(0);\n textFont(font);\n text(webglVersion, -14, 5);\n\n describe('The text \"webgl\" written in black on a gray background.');\n}\n\n
    " + ], + "description": "

    A string variable with the WebGL version in use. Its value equals one of\nthe followin string constants:

    \n
    • WEBGL2 whose value is 'webgl2',
    • WEBGL whose value is 'webgl', or
    • P2D whose value is 'p2d'. This is the default for 2D sketches.

    See setAttributes() for ways to set the\nWebGL version.

    \n" + }, + { + "itemtype": "property", + "name": "displayWidth", + "file": "src/core/environment.js", + "line": 575, + "type": "Number", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n // Set the canvas' width and height\n // using the display's dimensions.\n createCanvas(displayWidth, displayHeight);\n\n background(200);\n\n describe('A gray canvas that is the same size as the display.');\n}\n\n
    " + ], + "alt": "This example does not render anything.", + "description": "

    A numeric variable that stores the width of the screen display. Its value\ndepends on the current pixelDensity().\ndisplayWidth is useful for running full-screen programs.

    \n

    Note: The actual screen width can be computed as\ndisplayWidth * pixelDensity().

    \n" + }, + { + "itemtype": "property", + "name": "displayHeight", + "file": "src/core/environment.js", + "line": 605, + "type": "Number", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n // Set the canvas' width and height\n // using the display's dimensions.\n createCanvas(displayWidth, displayHeight);\n\n background(200);\n\n describe('A gray canvas that is the same size as the display.');\n}\n\n
    " + ], + "alt": "This example does not render anything.", + "description": "

    A numeric variable that stores the height of the screen display. Its value\ndepends on the current pixelDensity().\ndisplayHeight is useful for running full-screen programs.

    \n

    Note: The actual screen height can be computed as\ndisplayHeight * pixelDensity().

    \n" + }, + { + "itemtype": "property", + "name": "windowWidth", + "file": "src/core/environment.js", + "line": 632, + "type": "Number", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n // Set the canvas' width and height\n // using the browser's dimensions.\n createCanvas(windowWidth, windowHeight);\n\n background(200);\n\n describe('A gray canvas that takes up the entire browser window.');\n}\n\n
    " + ], + "alt": "This example does not render anything.", + "description": "A numeric variable that stores the width of the browser's\nlayout viewport.\nThis viewport is the area within the browser that's available for drawing." + }, + { + "itemtype": "property", + "name": "windowHeight", + "file": "src/core/environment.js", + "line": 659, + "type": "Number", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n // Set the canvas' width and height\n // using the browser's dimensions.\n createCanvas(windowWidth, windowHeight);\n\n background(200);\n\n describe('A gray canvas that takes up the entire browser window.');\n}\n\n
    " + ], + "alt": "This example does not render anything.", + "description": "A numeric variable that stores the height of the browser's\nlayout viewport.\nThis viewport is the area within the browser that's available for drawing." + }, + { + "itemtype": "property", + "name": "width", + "file": "src/core/environment.js", + "line": 817, + "type": "Number", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Display the canvas' width.\n text(width, 42, 54);\n\n describe('The number 100 written in black on a gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(50, 100);\n\n background(200);\n\n // Display the canvas' width.\n text(width, 21, 54);\n\n describe('The number 50 written in black on a gray rectangle.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100);\n\n background(200);\n\n // Display the canvas' width.\n text(width, 42, 54);\n\n describe('The number 100 written in black on a gray square. When the mouse is pressed, the square becomes a rectangle and the number becomes 50.');\n}\n\n// If the mouse is pressed, reisze\n// the canvas and display its new\n// width.\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n resizeCanvas(50, 100);\n background(200);\n text(width, 21, 54);\n }\n}\n\n
    " + ], + "description": "

    A numeric variable that stores the width of the drawing canvas. Its\ndefault value is 100.

    \n

    Calling createCanvas() or\nresizeCanvas() changes the value of\nwidth. Calling noCanvas() sets its value to\n0.

    \n" + }, + { + "itemtype": "property", + "name": "height", + "file": "src/core/environment.js", + "line": 886, + "type": "Number", + "module": "Environment", + "submodule": "Environment", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Display the canvas' height.\n text(height, 42, 54);\n\n describe('The number 100 written in black on a gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 50);\n\n background(200);\n\n // Display the canvas' height.\n text(height, 42, 27);\n\n describe('The number 50 written in black on a gray rectangle.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100);\n\n background(200);\n\n // Display the canvas' height.\n text(height, 42, 54);\n\n describe('The number 100 written in black on a gray square. When the mouse is pressed, the square becomes a rectangle and the number becomes 50.');\n}\n\n// If the mouse is pressed, reisze\n// the canvas and display its new\n// height.\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n resizeCanvas(100, 50);\n background(200);\n text(height, 42, 27);\n }\n}\n\n
    " + ], + "description": "

    A numeric variable that stores the height of the drawing canvas. Its\ndefault value is 100.

    \n

    Calling createCanvas() or\nresizeCanvas() changes the value of\nheight. Calling noCanvas() sets its value to\n0.

    \n" + }, + { + "itemtype": "property", + "name": "deviceOrientation", + "file": "src/events/acceleration.js", + "line": 21, + "type": "Constant", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [], + "description": "The system variable deviceOrientation always contains the orientation of\nthe device. The value of this variable will either be set 'landscape'\nor 'portrait'. If no data is available it will be set to 'undefined'.\neither LANDSCAPE or PORTRAIT." + }, + { + "itemtype": "property", + "name": "accelerationX", + "file": "src/events/acceleration.js", + "line": 44, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\n// Move a touchscreen device to register\n// acceleration changes.\nfunction draw() {\n background(220, 50);\n fill('magenta');\n ellipse(width / 2, height / 2, accelerationX);\n describe('Magnitude of device acceleration is displayed as ellipse size.');\n}\n\n
    " + ], + "description": "The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared." + }, + { + "itemtype": "property", + "name": "accelerationY", + "file": "src/events/acceleration.js", + "line": 66, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\n// Move a touchscreen device to register\n// acceleration changes.\nfunction draw() {\n background(220, 50);\n fill('magenta');\n ellipse(width / 2, height / 2, accelerationY);\n describe('Magnitude of device acceleration is displayed as ellipse size');\n}\n\n
    " + ], + "description": "The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared." + }, + { + "itemtype": "property", + "name": "accelerationZ", + "file": "src/events/acceleration.js", + "line": 89, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\n// Move a touchscreen device to register\n// acceleration changes.\nfunction draw() {\n background(220, 50);\n fill('magenta');\n ellipse(width / 2, height / 2, accelerationZ);\n describe('Magnitude of device acceleration is displayed as ellipse size');\n}\n\n
    " + ], + "description": "The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared." + }, + { + "itemtype": "property", + "name": "pAccelerationX", + "file": "src/events/acceleration.js", + "line": 99, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [], + "description": "The system variable pAccelerationX always contains the acceleration of the\ndevice along the x axis in the frame previous to the current frame. Value\nis represented as meters per second squared." + }, + { + "itemtype": "property", + "name": "pAccelerationY", + "file": "src/events/acceleration.js", + "line": 109, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [], + "description": "The system variable pAccelerationY always contains the acceleration of the\ndevice along the y axis in the frame previous to the current frame. Value\nis represented as meters per second squared." + }, + { + "itemtype": "property", + "name": "pAccelerationZ", + "file": "src/events/acceleration.js", + "line": 119, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [], + "description": "The system variable pAccelerationZ always contains the acceleration of the\ndevice along the z axis in the frame previous to the current frame. Value\nis represented as meters per second squared." + }, + { + "itemtype": "property", + "name": "rotationX", + "file": "src/events/acceleration.js", + "line": 163, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(200);\n //rotateZ(radians(rotationZ));\n rotateX(radians(rotationX));\n //rotateY(radians(rotationY));\n box(200, 200, 200);\n describe(`red horizontal line right, green vertical line bottom.\n black background.`);\n}\n\n
    " + ], + "description": "

    The system variable rotationX always contains the rotation of the\ndevice along the x axis. If the sketch \nangleMode() is set to DEGREES, the value will be -180 to 180. If\nit is set to RADIANS, the value will be -PI to PI.

    \n

    Note: The order the rotations are called is important, ie. if used\ntogether, it must be called in the order Z-X-Y or there might be\nunexpected behaviour.

    \n" + }, + { + "itemtype": "property", + "name": "rotationY", + "file": "src/events/acceleration.js", + "line": 196, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(200);\n //rotateZ(radians(rotationZ));\n //rotateX(radians(rotationX));\n rotateY(radians(rotationY));\n box(200, 200, 200);\n describe(`red horizontal line right, green vertical line bottom.\n black background.`);\n}\n\n
    " + ], + "description": "

    The system variable rotationY always contains the rotation of the\ndevice along the y axis. If the sketch \nangleMode() is set to DEGREES, the value will be -90 to 90. If\nit is set to RADIANS, the value will be -PI/2 to PI/2.

    \n

    Note: The order the rotations are called is important, ie. if used\ntogether, it must be called in the order Z-X-Y or there might be\nunexpected behaviour.

    \n" + }, + { + "itemtype": "property", + "name": "rotationZ", + "file": "src/events/acceleration.js", + "line": 233, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(200);\n rotateZ(radians(rotationZ));\n //rotateX(radians(rotationX));\n //rotateY(radians(rotationY));\n box(200, 200, 200);\n describe(`red horizontal line right, green vertical line bottom.\n black background.`);\n}\n\n
    " + ], + "description": "

    The system variable rotationZ always contains the rotation of the\ndevice along the z axis. If the sketch \nangleMode() is set to DEGREES, the value will be 0 to 360. If\nit is set to RADIANS, the value will be 0 to 2*PI.

    \n

    Unlike rotationX and rotationY, this variable is available for devices\nwith a built-in compass only.

    \n

    Note: The order the rotations are called is important, ie. if used\ntogether, it must be called in the order Z-X-Y or there might be\nunexpected behaviour.

    \n" + }, + { + "itemtype": "property", + "name": "pRotationX", + "file": "src/events/acceleration.js", + "line": 277, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\n// A simple if statement looking at whether\n// rotationX - pRotationX < 0 is true or not will be\n// sufficient for determining the rotate direction\n// in most cases.\n\n// Some extra logic is needed to account for cases where\n// the angles wrap around.\nlet rotateDirection = 'clockwise';\n\n// Simple range conversion to make things simpler.\n// This is not absolutely necessary but the logic\n// will be different in that case.\n\nlet rX = rotationX + 180;\nlet pRX = pRotationX + 180;\n\nif ((rX - pRX > 0 && rX - pRX < 270) || rX - pRX < -270) {\n rotateDirection = 'clockwise';\n} else if (rX - pRX < 0 || rX - pRX > 270) {\n rotateDirection = 'counter-clockwise';\n}\n\nprint(rotateDirection);\ndescribe('no image to display.');\n\n
    " + ], + "description": "

    The system variable pRotationX always contains the rotation of the\ndevice along the x axis in the frame previous to the current frame.\nIf the sketch angleMode() is set to DEGREES,\nthe value will be -180 to 180. If it is set to RADIANS, the value will\nbe -PI to PI.

    \n

    pRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis.

    \n" + }, + { + "itemtype": "property", + "name": "pRotationY", + "file": "src/events/acceleration.js", + "line": 320, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\n// A simple if statement looking at whether\n// rotationY - pRotationY < 0 is true or not will be\n// sufficient for determining the rotate direction\n// in most cases.\n\n// Some extra logic is needed to account for cases where\n// the angles wrap around.\nlet rotateDirection = 'clockwise';\n\n// Simple range conversion to make things simpler.\n// This is not absolutely necessary but the logic\n// will be different in that case.\n\nlet rY = rotationY + 180;\nlet pRY = pRotationY + 180;\n\nif ((rY - pRY > 0 && rY - pRY < 270) || rY - pRY < -270) {\n rotateDirection = 'clockwise';\n} else if (rY - pRY < 0 || rY - pRY > 270) {\n rotateDirection = 'counter-clockwise';\n}\nprint(rotateDirection);\ndescribe('no image to display.');\n\n
    " + ], + "description": "

    The system variable pRotationY always contains the rotation of the\ndevice along the y axis in the frame previous to the current frame.\nIf the sketch angleMode() is set to DEGREES,\nthe value will be -90 to 90. If it is set to RADIANS, the value will\nbe -PI/2 to PI/2.

    \n

    pRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis.

    \n" + }, + { + "itemtype": "property", + "name": "pRotationZ", + "file": "src/events/acceleration.js", + "line": 359, + "type": "Number", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\n// A simple if statement looking at whether\n// rotationZ - pRotationZ < 0 is true or not will be\n// sufficient for determining the rotate direction\n// in most cases.\n\n// Some extra logic is needed to account for cases where\n// the angles wrap around.\nlet rotateDirection = 'clockwise';\n\nif (\n (rotationZ - pRotationZ > 0 && rotationZ - pRotationZ < 270) ||\n rotationZ - pRotationZ < -270\n) {\n rotateDirection = 'clockwise';\n} else if (rotationZ - pRotationZ < 0 || rotationZ - pRotationZ > 270) {\n rotateDirection = 'counter-clockwise';\n}\nprint(rotateDirection);\ndescribe('no image to display.');\n\n
    " + ], + "description": "

    The system variable pRotationZ always contains the rotation of the\ndevice along the z axis in the frame previous to the current frame.\nIf the sketch angleMode() is set to DEGREES,\nthe value will be 0 to 360. If it is set to RADIANS, the value will\nbe 0 to 2*PI.

    \n

    pRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis.

    \n" + }, + { + "itemtype": "property", + "name": "turnAxis", + "file": "src/events/acceleration.js", + "line": 413, + "type": "String", + "module": "Events", + "submodule": "Acceleration", + "class": "p5", + "example": [ + "
    \n\n// Run this example on a mobile device\n// Rotate the device by 90 degrees in the\n// X-axis to change the value.\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when device turns`);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when x-axis turns`);\n}\nfunction deviceTurned() {\n if (turnAxis === 'X') {\n if (value === 0) {\n value = 255;\n } else if (value === 255) {\n value = 0;\n }\n }\n}\n\n
    " + ], + "description": "When a device is rotated, the axis that triggers the deviceTurned()\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned()." + }, + { + "itemtype": "property", + "name": "keyIsPressed", + "file": "src/events/keyboard.js", + "line": 31, + "type": "Boolean", + "module": "Events", + "submodule": "Keyboard", + "class": "p5", + "example": [ + "
    \n\nfunction draw() {\n if (keyIsPressed === true) {\n fill(0);\n } else {\n fill(255);\n }\n rect(25, 25, 50, 50);\n describe('50-by-50 white rect that turns black on keypress.');\n}\n\n
    " + ], + "description": "The boolean system variable keyIsPressed is true if any key is pressed\nand false if no keys are pressed." + }, + { + "itemtype": "property", + "name": "key", + "file": "src/events/keyboard.js", + "line": 58, + "type": "String", + "module": "Events", + "submodule": "Keyboard", + "class": "p5", + "example": [ + "
    \n// Click any key to display it!\n// (Not Guaranteed to be Case Sensitive)\nfunction setup() {\n fill(245, 123, 158);\n textSize(50);\n}\n\nfunction draw() {\n background(200);\n text(key, 33, 65); // Display last key pressed.\n describe('canvas displays any key value that is pressed in pink font.');\n}\n
    " + ], + "description": "The system variable key always contains the value of the most recent\nkey on the keyboard that was typed. To get the proper capitalization, it\nis best to use it within keyTyped(). For non-ASCII keys, use the keyCode\nvariable." + }, + { + "itemtype": "property", + "name": "keyCode", + "file": "src/events/keyboard.js", + "line": 96, + "type": "Integer", + "module": "Events", + "submodule": "Keyboard", + "class": "p5", + "example": [ + "
    \nlet fillVal = 126;\nfunction draw() {\n fill(fillVal);\n rect(25, 25, 50, 50);\n describe(`Grey rect center. turns white when up arrow pressed and black when down.\n Display key pressed and its keyCode in a yellow box.`);\n}\n\nfunction keyPressed() {\n if (keyCode === UP_ARROW) {\n fillVal = 255;\n } else if (keyCode === DOWN_ARROW) {\n fillVal = 0;\n }\n}\n
    \n
    \nfunction draw() {}\nfunction keyPressed() {\n background('yellow');\n text(`${key} ${keyCode}`, 10, 40);\n print(key, ' ', keyCode);\n}\n
    " + ], + "description": "The variable keyCode is used to detect special keys such as BACKSPACE,\nDELETE, ENTER, RETURN, TAB, ESCAPE, SHIFT, CONTROL, OPTION, ALT, UP_ARROW,\nDOWN_ARROW, LEFT_ARROW, RIGHT_ARROW.\nYou can also check for custom keys by looking up the keyCode of any key\non a site like this: keycode.info." + }, + { + "itemtype": "property", + "name": "movedX", + "file": "src/events/mouse.js", + "line": 41, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nlet x = 50;\nfunction setup() {\n rectMode(CENTER);\n}\n\nfunction draw() {\n if (x > 48) {\n x -= 2;\n } else if (x < 48) {\n x += 2;\n }\n x += floor(movedX / 5);\n background(237, 34, 93);\n fill(0);\n rect(x, 50, 50, 50);\n describe(`box moves left and right according to mouse movement\n then slowly back towards the center`);\n}\n\n
    " + ], + "description": "The variable movedX contains the horizontal movement of the mouse since the last frame" + }, + { + "itemtype": "property", + "name": "movedY", + "file": "src/events/mouse.js", + "line": 71, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nlet y = 50;\nfunction setup() {\n rectMode(CENTER);\n}\n\nfunction draw() {\n if (y > 48) {\n y -= 2;\n } else if (y < 48) {\n y += 2;\n }\n y += floor(movedY / 5);\n background(237, 34, 93);\n fill(0);\n rect(50, y, 50, 50);\n describe(`box moves up and down according to mouse movement then\n slowly back towards the center`);\n}\n\n
    " + ], + "description": "The variable movedY contains the vertical movement of the mouse since the last frame" + }, + { + "itemtype": "property", + "name": "mouseX", + "file": "src/events/mouse.js", + "line": 102, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\n// Move the mouse across the canvas\nfunction draw() {\n background(244, 248, 252);\n line(mouseX, 0, mouseX, 100);\n describe('horizontal black line moves left and right with mouse x-position');\n}\n\n
    " + ], + "description": "The system variable mouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the canvas. The value at\nthe top-left corner is (0, 0) for 2-D and (-width/2, -height/2) for WebGL.\nIf touch is used instead of mouse input, mouseX will hold the x value\nof the most recent touch point." + }, + { + "itemtype": "property", + "name": "mouseY", + "file": "src/events/mouse.js", + "line": 126, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\n// Move the mouse across the canvas\nfunction draw() {\n background(244, 248, 252);\n line(0, mouseY, 100, mouseY);\n describe('vertical black line moves up and down with mouse y-position');\n}\n\n
    " + ], + "description": "The system variable mouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the canvas. The value at\nthe top-left corner is (0, 0) for 2-D and (-width/2, -height/2) for WebGL.\nIf touch is used instead of mouse input, mouseY will hold the y value\nof the most recent touch point." + }, + { + "itemtype": "property", + "name": "pmouseX", + "file": "src/events/mouse.js", + "line": 157, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\n// Move the mouse across the canvas to leave a trail\nfunction setup() {\n //slow down the frameRate to make it more visible\n frameRate(10);\n}\n\nfunction draw() {\n background(244, 248, 252);\n line(mouseX, mouseY, pmouseX, pmouseY);\n print(pmouseX + ' -> ' + mouseX);\n describe(`line trail is created from cursor movements.\n faster movement make longer line.`);\n}\n\n
    " + ], + "description": "The system variable pmouseX always contains the horizontal position of\nthe mouse or finger in the frame previous to the current frame, relative to\n(0, 0) of the canvas. The value at the top-left corner is (0, 0) for 2-D and\n(-width/2, -height/2) for WebGL. Note: pmouseX will be reset to the current mouseX\nvalue at the start of each touch event." + }, + { + "itemtype": "property", + "name": "pmouseY", + "file": "src/events/mouse.js", + "line": 187, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n //draw a square only if the mouse is not moving\n if (mouseY === pmouseY && mouseX === pmouseX) {\n rect(20, 20, 60, 60);\n }\n\n print(pmouseY + ' -> ' + mouseY);\n describe(`60-by-60 black rect center, fuchsia background.\n rect flickers on mouse movement`);\n}\n\n
    " + ], + "description": "The system variable pmouseY always contains the vertical position of\nthe mouse or finger in the frame previous to the current frame, relative to\n(0, 0) of the canvas. The value at the top-left corner is (0, 0) for 2-D and\n(-width/2, -height/2) for WebGL. Note: pmouseY will be reset to the current mouseY\nvalue at the start of each touch event." + }, + { + "itemtype": "property", + "name": "winMouseX", + "file": "src/events/mouse.js", + "line": 224, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nlet myCanvas;\n\nfunction setup() {\n //use a variable to store a pointer to the canvas\n myCanvas = createCanvas(100, 100);\n let body = document.getElementsByTagName('body')[0];\n myCanvas.parent(body);\n}\n\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n\n //move the canvas to the horizontal mouse position\n //relative to the window\n myCanvas.position(winMouseX + 1, windowHeight / 2);\n\n //the y of the square is relative to the canvas\n rect(20, mouseY, 60, 60);\n describe(`60-by-60 black rect y moves with mouse y and fuchsia\n canvas moves with mouse x`);\n}\n\n
    " + ], + "description": "The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window." + }, + { + "itemtype": "property", + "name": "winMouseY", + "file": "src/events/mouse.js", + "line": 261, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nlet myCanvas;\n\nfunction setup() {\n //use a variable to store a pointer to the canvas\n myCanvas = createCanvas(100, 100);\n let body = document.getElementsByTagName('body')[0];\n myCanvas.parent(body);\n}\n\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n\n //move the canvas to the vertical mouse position\n //relative to the window\n myCanvas.position(windowWidth / 2, winMouseY + 1);\n\n //the x of the square is relative to the canvas\n rect(mouseX, 20, 60, 60);\n describe(`60-by-60 black rect x moves with mouse x and\n fuchsia canvas y moves with mouse y`);\n}\n\n
    " + ], + "description": "The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window." + }, + { + "itemtype": "property", + "name": "pwinMouseX", + "file": "src/events/mouse.js", + "line": 300, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nlet myCanvas;\n\nfunction setup() {\n //use a variable to store a pointer to the canvas\n myCanvas = createCanvas(100, 100);\n noStroke();\n fill(237, 34, 93);\n}\n\nfunction draw() {\n clear();\n //the difference between previous and\n //current x position is the horizontal mouse speed\n let speed = abs(winMouseX - pwinMouseX);\n //change the size of the circle\n //according to the horizontal speed\n ellipse(50, 50, 10 + speed * 5, 10 + speed * 5);\n //move the canvas to the mouse position\n myCanvas.position(winMouseX + 1, winMouseY + 1);\n describe(`fuchsia ellipse moves with mouse x and y.\n Grows and shrinks with mouse speed`);\n}\n\n
    " + ], + "description": "The system variable pwinMouseX always contains the horizontal position\nof the mouse in the frame previous to the current frame, relative to\n(0, 0) of the window. Note: pwinMouseX will be reset to the current winMouseX\nvalue at the start of each touch event." + }, + { + "itemtype": "property", + "name": "pwinMouseY", + "file": "src/events/mouse.js", + "line": 339, + "type": "Number", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nlet myCanvas;\n\nfunction setup() {\n //use a variable to store a pointer to the canvas\n myCanvas = createCanvas(100, 100);\n noStroke();\n fill(237, 34, 93);\n}\n\nfunction draw() {\n clear();\n //the difference between previous and\n //current y position is the vertical mouse speed\n let speed = abs(winMouseY - pwinMouseY);\n //change the size of the circle\n //according to the vertical speed\n ellipse(50, 50, 10 + speed * 5, 10 + speed * 5);\n //move the canvas to the mouse position\n myCanvas.position(winMouseX + 1, winMouseY + 1);\n describe(`fuchsia ellipse moves with mouse x and y.\n Grows and shrinks with mouse speed`);\n}\n\n
    " + ], + "description": "The system variable pwinMouseY always contains the vertical position of\nthe mouse in the frame previous to the current frame, relative to (0, 0)\nof the window. Note: pwinMouseY will be reset to the current winMouseY\nvalue at the start of each touch event." + }, + { + "itemtype": "property", + "name": "mouseButton", + "file": "src/events/mouse.js", + "line": 376, + "type": "Constant", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n\n if (mouseIsPressed === true) {\n if (mouseButton === LEFT) {\n ellipse(50, 50, 50, 50);\n }\n if (mouseButton === RIGHT) {\n rect(25, 25, 50, 50);\n }\n if (mouseButton === CENTER) {\n triangle(23, 75, 50, 20, 78, 75);\n }\n }\n\n print(mouseButton);\n describe(`50-by-50 black ellipse appears on center of fuchsia\n canvas on mouse click/press.`);\n}\n\n
    " + ], + "description": "p5 automatically tracks if the mouse button is pressed and which\nbutton is pressed. The value of the system variable mouseButton is either\nLEFT, RIGHT, or CENTER depending on which button was pressed last.\nWarning: different browsers may track mouseButton differently." + }, + { + "itemtype": "property", + "name": "mouseIsPressed", + "file": "src/events/mouse.js", + "line": 405, + "type": "Boolean", + "module": "Events", + "submodule": "Mouse", + "class": "p5", + "example": [ + "
    \n\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n\n if (mouseIsPressed === true) {\n ellipse(50, 50, 50, 50);\n } else {\n rect(25, 25, 50, 50);\n }\n\n print(mouseIsPressed);\n describe(`black 50-by-50 rect becomes ellipse with mouse click/press.\n fuchsia background.`);\n}\n\n
    " + ], + "description": "The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not." + }, + { + "itemtype": "property", + "name": "touches", + "file": "src/events/touch.js", + "line": 38, + "type": "Object[]", + "module": "Events", + "submodule": "Touch", + "class": "p5", + "example": [ + "
    \n\n// On a touchscreen device, touch\n// the canvas using one or more fingers\n// at the same time\nfunction draw() {\n clear();\n let display = touches.length + ' touches';\n text(display, 5, 10);\n describe(`Number of touches currently registered are displayed\n on the canvas`);\n}\n\n
    " + ], + "description": "

    The system variable touches[] contains an array of the positions of all\ncurrent touch points, relative to (0, 0) of the canvas, and IDs identifying a\nunique touch as it moves. Each element in the array is an object with x, y,\nand id properties.

    \n

    The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops).

    \n" + }, + { + "itemtype": "property", + "name": "pixels", + "file": "src/image/pixels.js", + "line": 104, + "type": "Number[]", + "module": "Image", + "submodule": "Pixels", + "class": "p5", + "example": [ + "
    \n\nloadPixels();\nlet x = 50;\nlet y = 50;\nlet d = pixelDensity();\nfor (let i = 0; i < d; i += 1) {\n for (let j = 0; j < d; j += 1) {\n let index = 4 * ((y * d + j) * width * d + (x * d + i));\n // Red.\n pixels[index] = 0;\n // Green.\n pixels[index + 1] = 0;\n // Blue.\n pixels[index + 2] = 0;\n // Alpha.\n pixels[index + 3] = 255;\n }\n}\nupdatePixels();\n\ndescribe('A black dot in the middle of a gray rectangle.');\n\n
    \n\n
    \n\nloadPixels();\nlet d = pixelDensity();\nlet halfImage = 4 * (d * width) * (d * height / 2);\nfor (let i = 0; i < halfImage; i += 4) {\n // Red.\n pixels[i] = 255;\n // Green.\n pixels[i + 1] = 0;\n // Blue.\n pixels[i + 2] = 0;\n // Alpha.\n pixels[i + 3] = 255;\n}\nupdatePixels();\n\ndescribe('A red rectangle drawn above a gray rectangle.');\n\n
    \n\n
    \n\nlet pink = color(255, 102, 204);\nloadPixels();\nlet d = pixelDensity();\nlet halfImage = 4 * (d * width) * (d * height / 2);\nfor (let i = 0; i < halfImage; i += 4) {\n pixels[i] = red(pink);\n pixels[i + 1] = green(pink);\n pixels[i + 2] = blue(pink);\n pixels[i + 3] = alpha(pink);\n}\nupdatePixels();\n\ndescribe('A pink rectangle drawn above a gray rectangle.');\n\n
    " + ], + "description": "

    An array containing the color of each pixel on the canvas. Colors are\nstored as numbers representing red, green, blue, and alpha (RGBA) values.\npixels is a one-dimensional array for performance reasons.

    \n

    Each pixel occupies four elements in the pixels array, one for each RGBA\nvalue. For example, the pixel at coordinates (0, 0) stores its RGBA values\nat pixels[0], pixels[1], pixels[2], and pixels[3], respectively.\nThe next pixel at coordinates (1, 0) stores its RGBA values at pixels[4],\npixels[5], pixels[6], and pixels[7]. And so on. The pixels array\nfor a 100Ɨ100 canvas has 100 Ɨ 100 Ɨ 4 = 40,000 elements.

    \n

    Some displays use several smaller pixels to set the color at a single\npoint. The pixelDensity() function returns\nthe pixel density of the canvas. High density displays often have a\npixelDensity() of 2. On such a display, the\npixels array for a 100Ɨ100 canvas has 200 Ɨ 200 Ɨ 4 =\n160,000 elements.

    \n

    Accessing the RGBA values for a point on the canvas requires a little math\nas shown below. The loadPixels() function\nmust be called before accessing the pixels array. The\nupdatePixels() function must be called\nafter any changes are made.

    \n" + }, + { + "itemtype": "property", + "name": "disableFriendlyErrors", + "file": "src/core/main.js", + "line": 777, + "type": "Boolean", + "module": "Structure", + "submodule": "Structure", + "class": "p5", + "example": [ + "
    \np5.disableFriendlyErrors = true;\n\nfunction setup() {\n createCanvas(100, 50);\n}\n
    " + ], + "description": "

    Turn off some features of the friendly error system (FES), which can give\na significant boost to performance when needed.

    \n

    Note that this will disable the parts of the FES that cause performance\nslowdown (like argument checking). Friendly errors that have no performance\ncost (like giving a descriptive error if a file load fails, or warning you\nif you try to override p5.js functions in the global space),\nwill remain in place.

    \n

    See \ndisabling the friendly error system.

    \n" + }, + { + "itemtype": "property", + "name": "src", + "file": "src/dom/dom.js", + "line": 4958, + "module": "DOM", + "submodule": "DOM", + "class": "p5", + "example": [ + "
    \n\nlet beat;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n beat = createAudio('assets/beat.mp3');\n\n describe('The text \"https://p5js.org/reference/assets/beat.mp3\" written in black on a gray background.');\n}\n\nfunction draw() {\n background(200);\n\n textWrap(CHAR);\n text(beat.src, 10, 10, 80, 80);\n}\n\n
    " + ], + "description": "Path to the media element's source as a string." + }, + { + "itemtype": "property", + "name": "let", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nlet x = 2;\nconsole.log(x); // prints 2 to the console\nx = 1;\nconsole.log(x); // prints 1 to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    Creates and names a new variable. A variable is a container for a value.

    \n

    Variables that are declared with let will have block-scope.\nThis means that the variable only exists within the\n\nblock that it is created within.

    \n

    From the MDN entry:\nDeclares a block scope local variable, optionally initializing it to a value.

    \n" + }, + { + "itemtype": "property", + "name": "const", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\n// define myFavNumber as a constant and give it the value 7\nconst myFavNumber = 7;\nconsole.log('my favorite number is: ' + myFavNumber);\n\n
    \n\n
    \n\nconst bigCats = ['lion', 'tiger', 'panther'];\nbigCats.push('leopard');\nconsole.log(bigCats);\n// bigCats = ['cat']; // throws error as re-assigning not allowed for const\n\n
    \n\n
    \n\nconst wordFrequency = {};\nwordFrequency['hello'] = 2;\nwordFrequency['bye'] = 1;\nconsole.log(wordFrequency);\n// wordFrequency = { 'a': 2, 'b': 3}; // throws error here\n\n
    " + ], + "alt": "These examples do not render anything", + "description": "

    Creates and names a new constant. Like a variable created with let,\na constant that is created with const is a container for a value,\nhowever constants cannot be reassigned once they are declared. Although it is\nnoteworthy that for non-primitive data types like objects & arrays, their\nelements can still be changeable. So if a variable is assigned an array, you\ncan still add or remove elements from the array but cannot reassign another\narray to it. Also unlike let, you cannot declare variables without value\nusing const.

    \n

    Constants have block-scope. This means that the constant only exists within\nthe \nblock that it is created within. A constant cannot be redeclared within a scope in which it\nalready exists.

    \n

    From the MDN entry:\nDeclares a read-only named constant.\nConstants are block-scoped, much like variables defined using the 'let' statement.\nThe value of a constant can't be changed through reassignment, and it can't be redeclared.

    \n" + }, + { + "itemtype": "property", + "name": "null", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nconsole.log(100 <= 100); // prints true to the console\nconsole.log(99 <= 100); // prints true to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    The less than or equal to operator <=\nevaluates to true if the left value is less than or equal to\nthe right value.

    \n

    There is more info on comparison operators on MDN.

    \n" + }, + { + "itemtype": "property", + "name": "if-else", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nlet a = 4;\nif (a > 0) {\n console.log('positive');\n} else {\n console.log('negative');\n}\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    The if-else statement helps control the flow of your code.

    \n

    A condition is placed between the parenthesis following 'if',\nwhen that condition evalues to truthy,\nthe code between the following curly braces is run.\nAlternatively, when the condition evaluates to falsy,\nthe code between the curly braces of 'else' block is run instead. Writing an\nelse block is optional.

    \n

    From the MDN entry:\nThe 'if' statement executes a statement if a specified condition is truthy.\nIf the condition is falsy, another statement can be executed

    \n" + }, + { + "itemtype": "property", + "name": "function", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nlet myName = 'Hridi';\nfunction sayHello(name) {\n console.log('Hello ' + name + '!');\n}\nsayHello(myName); // calling the function, prints \"Hello Hridi!\" to console.\n\n
    \n\n
    \n\nlet square = number => number * number;\nconsole.log(square(5));\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    Creates and names a function.\nA function is a set of statements that perform a task.

    \n

    Optionally, functions can have parameters. Parameters\nare variables that are scoped to the function, that can be assigned a value\nwhen calling the function.Multiple parameters can be given by seperating them\nwith commmas.

    \n

    From the MDN entry:\nDeclares a function with the specified parameters.

    \n" + }, + { + "itemtype": "property", + "name": "return", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nfunction calculateSquare(x) {\n return x * x;\n}\nconst result = calculateSquare(4); // returns 16\nconsole.log(result); // prints '16' to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "Specifies the value to be returned by a function.\nFor more info checkout \nthe MDN entry for return." + }, + { + "itemtype": "property", + "name": "boolean", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nlet myBoolean = false;\nconsole.log(typeof myBoolean); // prints 'boolean' to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    A boolean is one of the 7 primitive data types in Javascript.\nA boolean can only be true or false.

    \n

    From the MDN entry:\nBoolean represents a logical entity and can have two values: true, and false.

    \n" + }, + { + "itemtype": "property", + "name": "string", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nlet mood = 'chill';\nconsole.log(typeof mood); // prints 'string' to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    A string is one of the 7 primitive data types in Javascript.\nA string is a series of text characters. In Javascript, a string value must\nbe surrounded by either single-quotation marks(') or double-quotation marks(\").

    \n

    From the MDN entry:\nA string is a sequence of characters used to represent text.

    \n" + }, + { + "itemtype": "property", + "name": "number", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nlet num = 46.5;\nconsole.log(typeof num); // prints 'number' to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    A number is one of the 7 primitive data types in Javascript.\nA number can be a whole number or a decimal number.

    \n

    The MDN entry for number

    \n" + }, + { + "itemtype": "property", + "name": "object", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nlet author = {\n name: 'Ursula K Le Guin',\n books: [\n 'The Left Hand of Darkness',\n 'The Dispossessed',\n 'A Wizard of Earthsea'\n ]\n};\nconsole.log(author.name); // prints 'Ursula K Le Guin' to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "From MDN's object basics:\nAn object is a collection of related data and/or\nfunctionality (which usually consists of several variables and functions ā€”\nwhich are called properties and methods when they are inside objects.)" + }, + { + "itemtype": "property", + "name": "class", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nclass Rectangle {\n constructor(name, height, width) {\n this.name = name;\n this.height = height;\n this.width = width;\n }\n}\nlet square = new Rectangle('square', 1, 1); // creating new instance of Polygon Class.\nconsole.log(square.width); // prints '1' to the console\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    Creates and names a class which is a template for\nthe creation of objects.

    \n

    From the MDN entry:\nThe class declaration creates a new Class with a given name using\nprototype-based inheritance.

    \n" + }, + { + "itemtype": "property", + "name": "for", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\nfor (let i = 0; i < 9; i++) {\n console.log(i);\n}\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    for creates a loop that is useful for executing one\nsection of code multiple times.

    \n

    A 'for loop' consists of three different expressions inside of a parenthesis,\nall of which are optional.These expressions are used to control the number of\ntimes the loop is run.The first expression is a statement that is used to set\nthe initial state for the loop.The second expression is a condition that you\nwould like to check before each loop. If this expression returns false then\nthe loop will exit.The third expression is executed at the end of each loop.\nThese expression are separated by ; (semi-colon).In case of an empty expression,\nonly a semi-colon is written.

    \n

    The code inside of the loop body (in between the curly braces) is executed between the evaluation of the second\nand third expression.

    \n

    As with any loop, it is important to ensure that the loop can 'exit', or that\nthe test condition will eventually evaluate to false. The test condition with a for loop\nis the second expression detailed above. Ensuring that this expression can eventually\nbecome false ensures that your loop doesn't attempt to run an infinite amount of times,\nwhich can crash your browser.

    \n

    From the MDN entry:\nCreates a loop that executes a specified statement until the test condition evaluates to false.\nThe condition is evaluated after executing the statement, resulting in the specified statement executing at least once.

    \n" + }, + { + "itemtype": "property", + "name": "while", + "file": "src/core/reference.js", + "line": 1, + "module": "Foundation", + "submodule": "Foundation", + "class": "p5", + "example": [ + "
    \n\n// This example logs the lines below to the console\n// 4\n// 3\n// 2\n// 1\n// 0\nlet num = 5;\nwhile (num > 0) {\n num = num - 1;\n console.log(num);\n}\n\n
    " + ], + "alt": "This example does not render anything", + "description": "

    while creates a loop that is useful for executing\none section of code multiple times.

    \n

    With a 'while loop', the code inside of the loop body (between the curly\nbraces) is run repeatedly until the test condition (inside of the parenthesis)\nevaluates to false. The condition is tested before executing the code body\nwith while, so if the condition is initially false\nthe loop body, or statement, will never execute.

    \n

    As with any loop, it is important to ensure that the loop can 'exit', or that\nthe test condition will eventually evaluate to false. This is to keep your loop\nfrom trying to run an infinite amount of times, which can crash your browser.

    \n

    From the MDN entry:\nThe while statement creates a loop that executes a specified statement as long\nas the test condition evaluates to true.The condition is evaluated before\nexecuting the statement.

    \n" + }, + { + "itemtype": "property", + "name": "drawingContext", + "file": "src/core/rendering.js", + "line": 573, + "module": "Rendering", + "submodule": "Rendering", + "class": "p5", + "example": [ + "
    \n\nfunction setup() {\n drawingContext.shadowOffsetX = 5;\n drawingContext.shadowOffsetY = -5;\n drawingContext.shadowBlur = 10;\n drawingContext.shadowColor = 'black';\n background(200);\n ellipse(width / 2, height / 2, 50, 50);\n}\n\n
    " + ], + "alt": "white ellipse with shadow blur effect around edges", + "description": "The p5.js API provides a lot of functionality for creating graphics, but there is\nsome native HTML5 Canvas functionality that is not exposed by p5. You can still call\nit directly using the variable drawingContext, as in the example shown. This is\nthe equivalent of calling canvas.getContext('2d'); or canvas.getContext('webgl');.\nSee this\n\nreference for the native canvas API for possible drawing functions you can call." + }, + { + "itemtype": "property", + "name": "elt", + "file": "src/core/p5.Element.js", + "line": 83, + "module": "DOM", + "submodule": "DOM", + "class": "p5.Element", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Set the border style for the\n // canvas.\n cnv.elt.style.border = '5px dashed deeppink';\n\n describe('A gray square with a pink border drawn with dashed lines.');\n}\n\n
    " + ], + "description": "Underlying\nHTMLElement\nobject. Its properties and methods can be used directly." + }, + { + "itemtype": "property", + "name": "width", + "file": "src/core/p5.Element.js", + "line": 96, + "module": "DOM", + "submodule": "DOM", + "class": "p5.Element", + "example": [], + "description": "" + }, + { + "itemtype": "property", + "name": "height", + "file": "src/core/p5.Element.js", + "line": 102, + "module": "DOM", + "submodule": "DOM", + "class": "p5.Element", + "example": [], + "description": "" + }, + { + "itemtype": "property", + "name": "file", + "file": "src/dom/dom.js", + "line": 5235, + "module": "DOM", + "submodule": "DOM", + "class": "p5.File", + "example": [ + "
    \n\n// Use the file input to load a\n// file and display its info.\n\nfunction setup() {\n background(200);\n\n // Create a file input and place it beneath\n // the canvas. Call displayInfo() when\n // the file loads.\n let input = createFileInput(displayInfo);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user loads a file, its info is written in black.');\n}\n\n// Use the p5.File once\n// it loads.\nfunction displayInfo(file) {\n background(200);\n\n // Display the p5.File's name.\n text(file.name, 10, 10, 80, 40);\n // Display the p5.File's type and subtype.\n text(`${file.type}/${file.subtype}`, 10, 70);\n // Display the p5.File's size in bytes.\n text(file.size, 10, 90);\n}\n\n
    " + ], + "description": "Underlying\nFile\nobject. All File properties and methods are accessible." + }, + { + "itemtype": "property", + "name": "type", + "file": "src/dom/dom.js", + "line": 5235, + "module": "DOM", + "submodule": "DOM", + "class": "p5.File", + "example": [ + "
    \n\n// Use the file input to load a\n// file and display its info.\n\nfunction setup() {\n background(200);\n\n // Create a file input and place it beneath\n // the canvas. Call displayType() when\n // the file loads.\n let input = createFileInput(displayType);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user loads a file, its type is written in black.');\n}\n\n// Display the p5.File's type\n// once it loads.\nfunction displayType(file) {\n background(200);\n\n // Display the p5.File's type.\n text(`This is file's type is: ${file.type}`, 10, 10, 80, 80);\n}\n\n
    " + ], + "description": "The file\nMIME type\nas a string. For example, 'image', 'text', and so on." + }, + { + "itemtype": "property", + "name": "subtype", + "file": "src/dom/dom.js", + "line": 5235, + "module": "DOM", + "submodule": "DOM", + "class": "p5.File", + "example": [ + "
    \n\n// Use the file input to load a\n// file and display its info.\n\nfunction setup() {\n background(200);\n\n // Create a file input and place it beneath\n // the canvas. Call displaySubtype() when\n // the file loads.\n let input = createFileInput(displaySubtype);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user loads a file, its subtype is written in black.');\n}\n\n// Display the p5.File's type\n// once it loads.\nfunction displaySubtype(file) {\n background(200);\n\n // Display the p5.File's subtype.\n text(`This is file's subtype is: ${file.subtype}`, 10, 10, 80, 80);\n}\n\n
    " + ], + "description": "The file subtype as a string. For example, a file with an 'image'\nMIME type\nmay have a subtype such as png or jpeg." + }, + { + "itemtype": "property", + "name": "name", + "file": "src/dom/dom.js", + "line": 5235, + "module": "DOM", + "submodule": "DOM", + "class": "p5.File", + "example": [ + "
    \n\n// Use the file input to load a\n// file and display its info.\n\nfunction setup() {\n background(200);\n\n // Create a file input and place it beneath\n // the canvas. Call displayName() when\n // the file loads.\n let input = createFileInput(displayName);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user loads a file, its name is written in black.');\n}\n\n// Display the p5.File's name\n// once it loads.\nfunction displayName(file) {\n background(200);\n\n // Display the p5.File's name.\n text(`This is file's name is: ${file.name}`, 10, 10, 80, 80);\n}\n\n
    " + ], + "description": "The file name as a string." + }, + { + "itemtype": "property", + "name": "size", + "file": "src/dom/dom.js", + "line": 5235, + "module": "DOM", + "submodule": "DOM", + "class": "p5.File", + "example": [ + "
    \n\n// Use the file input to load a\n// file and display its info.\n\nfunction setup() {\n background(200);\n\n // Create a file input and place it beneath\n // the canvas. Call displaySize() when\n // the file loads.\n let input = createFileInput(displaySize);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user loads a file, its size in bytes is written in black.');\n}\n\n// Display the p5.File's size\n// in bytes once it loads.\nfunction displaySize(file) {\n background(200);\n\n // Display the p5.File's size.\n text(`This is file has ${file.size} bytes.`, 10, 10, 80, 80);\n}\n\n
    " + ], + "description": "The number of bytes in the file." + }, + { + "itemtype": "property", + "name": "data", + "file": "src/dom/dom.js", + "line": 5235, + "module": "DOM", + "submodule": "DOM", + "class": "p5.File", + "example": [ + "
    \n\n// Use the file input to load a\n// file and display its info.\n\nfunction setup() {\n background(200);\n\n // Create a file input and place it beneath\n // the canvas. Call displayData() when\n // the file loads.\n let input = createFileInput(displayData);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user loads a file, its data is written in black.');\n}\n\n// Display the p5.File's data\n// once it loads.\nfunction displayData(file) {\n background(200);\n\n // Display the p5.File's data,\n // which looks like a random\n // string of characters.\n text(file.data, 10, 10, 80, 80);\n}\n\n
    " + ], + "description": "A string containing either the file's image data, text contents, or\na parsed object in the case of JSON and\np5.XML objects." + }, + { + "itemtype": "property", + "name": "width", + "file": "src/image/p5.Image.js", + "line": 1573, + "type": "Number", + "module": "Image", + "submodule": "Image", + "class": "p5.Image", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let x = img.width / 2;\n let y = img.height / 2;\n let d = 20;\n circle(x, y, d);\n\n describe('An image of a mountain landscape with a white circle drawn in the middle.');\n}\n\n
    " + ], + "description": "Image width." + }, + { + "itemtype": "property", + "name": "height", + "file": "src/image/p5.Image.js", + "line": 1573, + "module": "Image", + "submodule": "Image", + "class": "p5.Image", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let x = img.width / 2;\n let y = img.height / 2;\n let d = 20;\n circle(x, y, d);\n\n describe('An image of a mountain landscape with a white circle drawn in the middle.');\n}\n\n
    " + ], + "description": "Image height." + }, + { + "itemtype": "property", + "name": "pixels", + "file": "src/image/p5.Image.js", + "line": 1573, + "type": "Number[]", + "module": "Image", + "submodule": "Image", + "class": "p5.Image", + "example": [ + "
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nlet numPixels = 4 * img.width * img.height;\nfor (let i = 0; i < numPixels; i += 4) {\n // Red.\n img.pixels[i] = 0;\n // Green.\n img.pixels[i + 1] = 0;\n // Blue.\n img.pixels[i + 2] = 0;\n // Alpha.\n img.pixels[i + 3] = 255;\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    \n\n
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nlet numPixels = 4 * img.width * img.height;\nfor (let i = 0; i < numPixels; i += 4) {\n // Red.\n img.pixels[i] = 255;\n // Green.\n img.pixels[i + 1] = 0;\n // Blue.\n img.pixels[i + 2] = 0;\n // Alpha.\n img.pixels[i + 3] = 255;\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A red square drawn in the middle of a gray square.');\n\n
    " + ], + "description": "

    An array containing the color of each pixel in the\np5.Image object. Colors are stored as numbers\nrepresenting red, green, blue, and alpha (RGBA) values. img.pixels is a\none-dimensional array for performance reasons.

    \n

    Each pixel occupies four elements in the pixels array, one for each\nRGBA value. For example, the pixel at coordinates (0, 0) stores its\nRGBA values at img.pixels[0], img.pixels[1], img.pixels[2],\nand img.pixels[3], respectively. The next pixel at coordinates (1, 0)\nstores its RGBA values at img.pixels[4], img.pixels[5],\nimg.pixels[6], and img.pixels[7]. And so on. The img.pixels array\nfor a 100Ɨ100 p5.Image object has\n100 Ɨ 100 Ɨ 4 = 40,000 elements.

    \n

    Accessing the RGBA values for a pixel in the\np5.Image object requires a little math as\nshown below. The img.loadPixels()\nmethod must be called before accessing the img.pixels array. The\nimg.updatePixels() method must be\ncalled after any changes are made.

    \n" + }, + { + "itemtype": "property", + "name": "columns", + "file": "src/io/p5.Table.js", + "line": 1306, + "module": "IO", + "submodule": "Table", + "class": "p5.Table", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //print the column names\n for (let c = 0; c < table.getColumnCount(); c++) {\n print('column ' + c + ' is named ' + table.columns[c]);\n }\n}\n\n
    " + ], + "description": "An array containing the names of the columns in the table, if the \"header\" the table is\nloaded with the \"header\" parameter." + }, + { + "itemtype": "property", + "name": "rows", + "file": "src/io/p5.Table.js", + "line": 1306, + "module": "IO", + "submodule": "Table", + "class": "p5.Table", + "example": [], + "description": "An array containing the p5.TableRow objects that make up the\nrows of the table. The same result as calling getRows()" + }, + { + "itemtype": "property", + "name": "x", + "file": "src/math/p5.Vector.js", + "line": 94, + "module": "Math", + "submodule": "Vector", + "class": "p5.Vector", + "example": [], + "description": "The x component of the vector" + }, + { + "itemtype": "property", + "name": "y", + "file": "src/math/p5.Vector.js", + "line": 94, + "module": "Math", + "submodule": "Vector", + "class": "p5.Vector", + "example": [], + "description": "The y component of the vector" + }, + { + "itemtype": "property", + "name": "z", + "file": "src/math/p5.Vector.js", + "line": 94, + "module": "Math", + "submodule": "Vector", + "class": "p5.Vector", + "example": [], + "description": "The z component of the vector" + }, + { + "itemtype": "property", + "name": "font", + "file": "src/typography/p5.Font.js", + "line": 577, + "module": "Typography", + "submodule": "Loading & Displaying", + "class": "p5.Font", + "example": [], + "description": "Underlying\nopentype.js\nfont object." + }, + { + "itemtype": "property", + "name": "eyeX", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(0);\n cam = createCamera();\n div = createDiv();\n div.position(0, 0);\n describe('An example showing the use of camera object properties');\n}\n\nfunction draw() {\n orbitControl();\n box(10);\n div.html('eyeX = ' + cam.eyeX);\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "camera position value on x axis. default value is 0" + }, + { + "itemtype": "property", + "name": "eyeY", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(0);\n cam = createCamera();\n div = createDiv();\n div.position(0, 0);\n describe('An example showing the use of camera object properties');\n}\n\nfunction draw() {\n orbitControl();\n box(10);\n div.html('eyeY = ' + cam.eyeY);\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "camera position value on y axis. default value is 0" + }, + { + "itemtype": "property", + "name": "eyeZ", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(0);\n cam = createCamera();\n div = createDiv();\n div.position(0, 0);\n describe('An example showing the use of camera object properties');\n}\n\nfunction draw() {\n orbitControl();\n box(10);\n div.html('eyeZ = ' + cam.eyeZ);\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "camera position value on z axis. default value is 800" + }, + { + "itemtype": "property", + "name": "centerX", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(255);\n cam = createCamera();\n cam.lookAt(1, 0, 0);\n div = createDiv('centerX = ' + cam.centerX);\n div.position(0, 0);\n div.style('color', 'white');\n describe('An example showing the use of camera object properties');\n}\n\nfunction draw() {\n orbitControl();\n box(10);\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "x coordinate representing center of the sketch" + }, + { + "itemtype": "property", + "name": "centerY", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(255);\n cam = createCamera();\n cam.lookAt(0, 1, 0);\n div = createDiv('centerY = ' + cam.centerY);\n div.position(0, 0);\n div.style('color', 'white');\n describe('An example showing the use of camera object properties');\n}\n\nfunction draw() {\n orbitControl();\n box(10);\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "y coordinate representing center of the sketch" + }, + { + "itemtype": "property", + "name": "centerZ", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(255);\n cam = createCamera();\n cam.lookAt(0, 0, 1);\n div = createDiv('centerZ = ' + cam.centerZ);\n div.position(0, 0);\n div.style('color', 'white');\n describe('An example showing the use of camera object properties');\n}\n\nfunction draw() {\n orbitControl();\n box(10);\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "z coordinate representing center of the sketch" + }, + { + "itemtype": "property", + "name": "upX", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(255);\n cam = createCamera();\n div = createDiv('upX = ' + cam.upX);\n div.position(0, 0);\n div.style('color', 'blue');\n div.style('font-size', '18px');\n describe('An example showing the use of camera object properties');\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "x component of direction 'up' from camera" + }, + { + "itemtype": "property", + "name": "upY", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(255);\n cam = createCamera();\n div = createDiv('upY = ' + cam.upY);\n div.position(0, 0);\n div.style('color', 'blue');\n div.style('font-size', '18px');\n describe('An example showing the use of camera object properties');\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "y component of direction 'up' from camera" + }, + { + "itemtype": "property", + "name": "upZ", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "type": "Number", + "module": "3D", + "submodule": "Camera", + "class": "p5.Camera", + "example": [ + "
    \nlet cam, div;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(255);\n cam = createCamera();\n div = createDiv('upZ = ' + cam.upZ);\n div.position(0, 0);\n div.style('color', 'blue');\n div.style('font-size', '18px');\n describe('An example showing the use of camera object properties');\n}\n
    " + ], + "alt": "An example showing the use of camera object properties", + "description": "z component of direction 'up' from camera" + }, + { + "itemtype": "property", + "name": "color", + "file": "src/webgl/p5.Framebuffer.js", + "line": 1379, + "type": "p5.FramebufferTexture", + "module": "Rendering", + "class": "p5.Framebuffer", + "example": [ + "
    \n\nlet framebuffer;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n framebuffer = createFramebuffer();\n noStroke();\n}\n\nfunction draw() {\n // Draw to the framebuffer\n framebuffer.begin();\n background(255);\n normalMaterial();\n sphere(20);\n framebuffer.end();\n\n // Draw the framebuffer to the main canvas\n image(framebuffer.color, -width/2, -height/2);\n}\n\n
    " + ], + "alt": "A red, green, and blue sphere in the middle of the canvas", + "description": "

    A texture with the color information of the framebuffer. Pass this (or the\nframebuffer itself) to texture() to draw it to\nthe canvas, or pass it to a shader with\nsetUniform() to read its data.

    \n

    Since Framebuffers are controlled by WebGL, their y coordinates are stored\nflipped compared to images and videos. When texturing with a framebuffer\ntexture, you may want to flip vertically, e.g. with\nplane(framebuffer.width, -framebuffer.height).

    \n" + }, + { + "itemtype": "property", + "name": "depth", + "file": "src/webgl/p5.Framebuffer.js", + "line": 1379, + "type": "p5.FramebufferTexture|undefined", + "module": "Rendering", + "class": "p5.Framebuffer", + "example": [ + "
    \n\nlet framebuffer;\nlet depthShader;\n\nconst vert = `\nprecision highp float;\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nvarying vec2 vTexCoord;\nvoid main() {\n vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * viewModelPosition;\n vTexCoord = aTexCoord;\n}\n`;\n\nconst frag = `\nprecision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D depth;\nvoid main() {\n float depthVal = texture2D(depth, vTexCoord).r;\n gl_FragColor = mix(\n vec4(1., 1., 0., 1.), // yellow\n vec4(0., 0., 1., 1.), // blue\n pow(depthVal, 6.)\n );\n}\n`;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n framebuffer = createFramebuffer();\n depthShader = createShader(vert, frag);\n noStroke();\n}\n\nfunction draw() {\n // Draw to the framebuffer\n framebuffer.begin();\n background(255);\n rotateX(frameCount * 0.01);\n box(20, 20, 100);\n framebuffer.end();\n\n push();\n shader(depthShader);\n depthShader.setUniform('depth', framebuffer.depth);\n plane(framebuffer.width, framebuffer.height);\n pop();\n}\n\n
    " + ], + "alt": "A video of a rectangular prism rotating, with parts closest to the camera\nappearing yellow and colors getting progressively more blue the farther\nfrom the camera they go", + "description": "

    A texture with the depth information of the framebuffer. If the framebuffer\nwas created with { depth: false } in its settings, then this property will\nbe undefined. Pass this to texture() to draw it to\nthe canvas, or pass it to a shader with\nsetUniform() to read its data.

    \n

    Since Framebuffers are controlled by WebGL, their y coordinates are stored\nflipped compared to images and videos. When texturing with a framebuffer\ntexture, you may want to flip vertically, e.g. with\nplane(framebuffer.width, -framebuffer.height).

    \n" + }, + { + "itemtype": "property", + "name": "pixels", + "file": "src/webgl/p5.Framebuffer.js", + "line": 1379, + "type": "Number[]", + "module": "Rendering", + "class": "p5.Framebuffer", + "example": [], + "description": "

    A Uint8ClampedArray\ncontaining the values for all the pixels in the Framebuffer.

    \n

    Like the main canvas pixels property, call\nloadPixels() before reading\nit, and call updatePixels()\nafterwards to update its data.

    \n

    Note that updating pixels via this property will be slower than\ndrawing to the framebuffer directly.\nConsider using a shader instead of looping over pixels.

    \n" + }, + { + "name": "describe", + "file": "src/accessibility/describe.js", + "line": 120, + "itemtype": "method", + "description": "

    Creates a screen reader-accessible description for the canvas.

    \n

    The first parameter, text, is the description of the canvas.

    \n

    The second parameter, display, is optional. It determines how the\ndescription is displayed. If LABEL is passed, as in\ndescribe('A description.', LABEL), the description will be visible in\na div element next to the canvas. If FALLBACK is passed, as in\ndescribe('A description.', FALLBACK), the description will only be\nvisible to screen readers. This is the default mode.

    \n

    Read\nHow to label your p5.js code to\nlearn more about making sketches accessible.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background('pink');\n\n // Draw a heart.\n fill('red');\n noStroke();\n circle(67, 67, 20);\n circle(83, 67, 20);\n triangle(91, 73, 75, 95, 59, 73);\n\n // Add a general description of the canvas.\n describe('A pink square with a red heart in the bottom-right corner.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background('pink');\n\n // Draw a heart.\n fill('red');\n noStroke();\n circle(67, 67, 20);\n circle(83, 67, 20);\n triangle(91, 73, 75, 95, 59, 73);\n\n // Add a general description of the canvas\n // and display it for debugging.\n describe('A pink square with a red heart in the bottom-right corner.', LABEL);\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n // The expression\n // frameCount % 100\n // causes x to increase from 0\n // to 99, then restart from 0.\n let x = frameCount % 100;\n\n // Draw the circle.\n fill(0, 255, 0);\n circle(x, 50, 40);\n\n // Add a general description of the canvas.\n describe(`A green circle at (${x}, 50) moves from left to right on a gray square.`);\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n // The expression\n // frameCount % 100\n // causes x to increase from 0\n // to 99, then restart from 0.\n let x = frameCount % 100;\n\n // Draw the circle.\n fill(0, 255, 0);\n circle(x, 50, 40);\n\n // Add a general description of the canvas\n // and display it for debugging.\n describe(`A green circle at (${x}, 50) moves from left to right on a gray square.`, LABEL);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "text", + "description": "description of the canvas.", + "type": "String" + }, + { + "name": "display", + "description": "either LABEL or FALLBACK.", + "optional": 1, + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "describeElement", + "file": "src/accessibility/describe.js", + "line": 244, + "itemtype": "method", + "description": "

    Creates a screen reader-accessible description for elements in the canvas.\nElements are shapes or groups of shapes that create meaning together.

    \n

    The first parameter, name, is the name of the element.

    \n

    The second parameter, text, is the description of the element.

    \n

    The third parameter, display, is optional. It determines how the\ndescription is displayed. If LABEL is passed, as in\ndescribe('A description.', LABEL), the description will be visible in\na div element next to the canvas. Using LABEL creates unhelpful\nduplicates for screen readers. Only use LABEL during development. If\nFALLBACK is passed, as in describe('A description.', FALLBACK), the\ndescription will only be visible to screen readers. This is the default\nmode.

    \n

    Read\nHow to label your p5.js code to\nlearn more about making sketches accessible.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background('pink');\n\n // Describe the first element\n // and draw it.\n describeElement('Circle', 'A yellow circle in the top-left corner.');\n noStroke();\n fill('yellow');\n circle(25, 25, 40);\n\n // Describe the second element\n // and draw it.\n describeElement('Heart', 'A red heart in the bottom-right corner.');\n fill('red');\n circle(66.6, 66.6, 20);\n circle(83.2, 66.6, 20);\n triangle(91.2, 72.6, 75, 95, 58.6, 72.6);\n\n // Add a general description of the canvas.\n describe('A red heart and yellow circle over a pink background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background('pink');\n\n // Describe the first element\n // and draw it. Display the\n // description for debugging.\n describeElement('Circle', 'A yellow circle in the top-left corner.', LABEL);\n noStroke();\n fill('yellow');\n circle(25, 25, 40);\n\n // Describe the second element\n // and draw it. Display the\n // description for debugging.\n describeElement('Heart', 'A red heart in the bottom-right corner.', LABEL);\n fill('red');\n circle(66.6, 66.6, 20);\n circle(83.2, 66.6, 20);\n triangle(91.2, 72.6, 75, 95, 58.6, 72.6);\n\n // Add a general description of the canvas.\n describe('A red heart and yellow circle over a pink background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "name of the element.", + "type": "String" + }, + { + "name": "text", + "description": "description of the element.", + "type": "String" + }, + { + "name": "display", + "description": "either LABEL or FALLBACK.", + "optional": 1, + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "textOutput", + "file": "src/accessibility/outputs.js", + "line": 126, + "itemtype": "method", + "description": "

    Creates a screen reader-accessible description for shapes on the canvas.\ntextOutput() adds a general description, list of shapes, and\ntable of shapes to the web page.

    \n

    The general description includes the canvas size, canvas color, and number\nof shapes. For example,\nYour output is a, 100 by 100 pixels, gray canvas containing the following 2 shapes:.

    \n

    A list of shapes follows the general description. The list describes the\ncolor, location, and area of each shape. For example,\na red circle at middle covering 3% of the canvas. Each shape can be\nselected to get more details.

    \n

    textOutput() uses its table of shapes as a list. The table describes the\nshape, color, location, coordinates and area. For example,\nred circle location = middle area = 3%. This is different from\ngridOutput(), which uses its table as a grid.

    \n

    The display parameter is optional. It determines how the description is\ndisplayed. If LABEL is passed, as in textOutput(LABEL), the description\nwill be visible in a div element next to the canvas. Using LABEL creates\nunhelpful duplicates for screen readers. Only use LABEL during\ndevelopment. If FALLBACK is passed, as in textOutput(FALLBACK), the\ndescription will only be visible to screen readers. This is the default\nmode.

    \n

    Read\nHow to label your p5.js code to\nlearn more about making sketches accessible.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Add the text description.\n textOutput();\n\n // Draw a couple of shapes.\n background(200);\n fill(255, 0, 0);\n circle(20, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle and a blue square on a gray background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Add the text description and\n // display it for debugging.\n textOutput(LABEL);\n\n // Draw a couple of shapes.\n background(200);\n fill(255, 0, 0);\n circle(20, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle and a blue square on a gray background.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n // Add the text description.\n textOutput();\n\n // Draw a moving circle.\n background(200);\n let x = frameCount * 0.1;\n fill(255, 0, 0);\n circle(x, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle moves from left to right above a blue square.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n // Add the text description and\n // display it for debugging.\n textOutput(LABEL);\n\n // Draw a moving circle.\n background(200);\n let x = frameCount * 0.1;\n fill(255, 0, 0);\n circle(x, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle moves from left to right above a blue square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "display", + "description": "either FALLBACK or LABEL.", + "optional": 1, + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "gridOutput", + "file": "src/accessibility/outputs.js", + "line": 262, + "itemtype": "method", + "description": "

    Creates a screen reader-accessible description for shapes on the canvas.\ngridOutput() adds a general description, table of shapes, and list of\nshapes to the web page.

    \n

    The general description includes the canvas size, canvas color, and number of\nshapes. For example,\ngray canvas, 100 by 100 pixels, contains 2 shapes: 1 circle 1 square.

    \n

    gridOutput() uses its table of shapes as a grid. Each shape in the grid\nis placed in a cell whose row and column correspond to the shape's location\non the canvas. The grid cells describe the color and type of shape at that\nlocation. For example, red circle. These descriptions can be selected\nindividually to get more details. This is different from\ntextOutput(), which uses its table as a list.

    \n

    A list of shapes follows the table. The list describes the color, type,\nlocation, and area of each shape. For example,\nred circle, location = middle, area = 3 %.

    \n

    The display parameter is optional. It determines how the description is\ndisplayed. If LABEL is passed, as in gridOutput(LABEL), the description\nwill be visible in a div element next to the canvas. Using LABEL creates\nunhelpful duplicates for screen readers. Only use LABEL during\ndevelopment. If FALLBACK is passed, as in gridOutput(FALLBACK), the\ndescription will only be visible to screen readers. This is the default\nmode.

    \n

    Read\nHow to label your p5.js code to\nlearn more about making sketches accessible.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Add the grid description.\n gridOutput();\n\n // Draw a couple of shapes.\n background(200);\n fill(255, 0, 0);\n circle(20, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle and a blue square on a gray background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Add the grid description and\n // display it for debugging.\n gridOutput(LABEL);\n\n // Draw a couple of shapes.\n background(200);\n fill(255, 0, 0);\n circle(20, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle and a blue square on a gray background.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n // Add the grid description.\n gridOutput();\n\n // Draw a moving circle.\n background(200);\n let x = frameCount * 0.1;\n fill(255, 0, 0);\n circle(x, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle moves from left to right above a blue square.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n // Add the grid description and\n // display it for debugging.\n gridOutput(LABEL);\n\n // Draw a moving circle.\n background(200);\n let x = frameCount * 0.1;\n fill(255, 0, 0);\n circle(x, 20, 20);\n fill(0, 0, 255);\n square(50, 50, 50);\n\n // Add a general description of the canvas.\n describe('A red circle moves from left to right above a blue square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "display", + "description": "either FALLBACK or LABEL.", + "optional": 1, + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "p5", + "file": "src/core/structure.js", + "line": 544, + "itemtype": "method", + "description": "

    The p5() constructor enables you to activate \"instance mode\" instead of normal\n\"global mode\". This is an advanced topic. A short description and example is\nincluded below. Please see\n\nDan Shiffman's Coding Train video tutorial or this\ntutorial page\nfor more info.

    \n

    By default, all p5.js functions are in the global namespace (i.e. bound to the window\nobject), meaning you can call them simply ellipse(), fill(), etc. However, this\nmight be inconvenient if you are mixing with other JS libraries (synchronously or\nasynchronously) or writing long programs of your own. p5.js currently supports a\nway around this problem called \"instance mode\". In instance mode, all p5 functions\nare bound up in a single variable instead of polluting your global namespace.

    \n

    Optionally, you can specify a default container for the canvas and any other elements\nto append to with a second argument. You can give the ID of an element in your html,\nor an html node itself.

    \n

    Note that creating instances like this also allows you to have more than one p5 sketch on\na single web page, as they will each be wrapped up with their own set up variables. Of\ncourse, you could also use iframes to have multiple sketches in global mode.

    \n", + "example": [ + "
    \nconst s = p => {\n let x = 100;\n let y = 100;\n\n p.setup = function() {\n p.createCanvas(700, 410);\n };\n\n p.draw = function() {\n p.background(0);\n p.fill(255);\n p.rect(x, y, 50, 50);\n };\n};\n\nnew p5(s); // invoke p5\n
    " + ], + "alt": "white rectangle on black background", + "overloads": [ + { + "params": [ + { + "name": "sketch", + "description": "a function containing a p5.js sketch", + "type": "Object" + }, + { + "name": "node", + "description": "ID or pointer to HTML DOM node to contain sketch in", + "type": "String|Object" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "alpha", + "file": "src/color/creating_reading.js", + "line": 41, + "itemtype": "method", + "description": "Extracts the alpha (transparency) value from a\np5.Color object, array of color components, or\nCSS color string.", + "example": [ + "
    \n\nnoStroke();\nconst c = color(0, 126, 255, 102);\nfill(c);\nrect(15, 15, 35, 70);\n// Sets 'alphaValue' to 102.\nconst alphaValue = alpha(c);\nfill(alphaValue);\nrect(50, 15, 35, 70);\ndescribe('Two rectangles. The left one is light blue and the right one is charcoal gray.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the alpha value.", + "type": "Number" + } + } + ], + "return": { + "description": "the alpha value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "blue", + "file": "src/color/creating_reading.js", + "line": 69, + "itemtype": "method", + "description": "Extracts the blue value from a p5.Color object,\narray of color components, or CSS color string.", + "example": [ + "
    \n\nconst c = color(175, 100, 220);\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'blueValue' to 220.\nconst blueValue = blue(c);\nfill(0, 0, blueValue);\nrect(50, 20, 35, 60);\ndescribe('Two rectangles. The left one is light purple and the right one is royal blue.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the blue value.", + "type": "Number" + } + } + ], + "return": { + "description": "the blue value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "brightness", + "file": "src/color/creating_reading.js", + "line": 115, + "itemtype": "method", + "description": "Extracts the HSB brightness value from a\np5.Color object, array of color components, or\nCSS color string.", + "example": [ + "
    \n\nnoStroke();\ncolorMode(HSB, 255);\nconst c = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'brightValue' to 255.\nconst brightValue = brightness(c);\nfill(brightValue);\nrect(50, 20, 35, 60);\ndescribe('Two rectangles. The left one is salmon pink and the right one is white.');\n\n
    \n\n
    \n\nnoStroke();\ncolorMode(HSB, 255);\nconst c = color('hsb(60, 100%, 50%)');\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'brightValue' to 127.5 (50% of 255)\nconst brightValue = brightness(c);\nfill(brightValue);\nrect(50, 20, 35, 60);\ndescribe('Two rectangles. The left one is olive and the right one is gray.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the brightness value.", + "type": "Number" + } + } + ], + "return": { + "description": "the brightness value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "color", + "file": "src/color/creating_reading.js", + "line": 293, + "itemtype": "method", + "description": "

    Creates a p5.Color object. By default, the\nparameters are interpreted as RGB values. Calling color(255, 204, 0) will\nreturn a bright yellow color. The way these parameters are interpreted may\nbe changed with the colorMode() function.

    \n

    The version of color() with one parameter interprets the value one of two\nways. If the parameter is a number, it's interpreted as a grayscale value.\nIf the parameter is a string, it's interpreted as a CSS color string.

    \n

    The version of color() with two parameters interprets the first one as a\ngrayscale value. The second parameter sets the alpha (transparency) value.

    \n

    The version of color() with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current colorMode().

    \n

    The version of color() with four parameters interprets them as RGBA, HSBA,\nor HSLA colors, depending on the current colorMode(). The last parameter\nsets the alpha (transparency) value.

    \n", + "example": [ + "
    \n\nconst c = color(255, 204, 0);\nfill(c);\nnoStroke();\nrect(30, 20, 55, 55);\ndescribe('A yellow rectangle on a gray canvas.');\n\n
    \n\n
    \n\n// RGB values.\nlet c = color(255, 204, 0);\nfill(c);\nnoStroke();\ncircle(25, 25, 80);\n// A grayscale value.\nc = color(65);\nfill(c);\ncircle(75, 75, 80);\ndescribe(\n 'Two ellipses. The circle in the top-left corner is yellow and the one at the bottom-right is gray.'\n);\n\n
    \n\n
    \n\n// A CSS named color.\nconst c = color('magenta');\nfill(c);\nnoStroke();\nsquare(20, 20, 60);\ndescribe('A magenta square on a gray canvas.');\n\n
    \n\n
    \n\n// CSS hex color codes.\nnoStroke();\nlet c = color('#0f0');\nfill(c);\nrect(0, 10, 45, 80);\nc = color('#00ff00');\nfill(c);\nrect(55, 10, 45, 80);\ndescribe('Two bright green rectangles on a gray canvas.');\n\n
    \n\n
    \n\n// RGB and RGBA color strings.\nnoStroke();\nlet c = color('rgb(0,0,255)');\nfill(c);\nsquare(10, 10, 35);\nc = color('rgb(0%, 0%, 100%)');\nfill(c);\nsquare(55, 10, 35);\nc = color('rgba(0, 0, 255, 1)');\nfill(c);\nsquare(10, 55, 35);\nc = color('rgba(0%, 0%, 100%, 1)');\nfill(c);\nsquare(55, 55, 35);\ndescribe('Four blue squares in corners of a gray canvas.');\n\n
    \n\n
    \n\n// HSL and HSLA color strings.\nlet c = color('hsl(160, 100%, 50%)');\nnoStroke();\nfill(c);\nrect(0, 10, 45, 80);\nc = color('hsla(160, 100%, 50%, 0.5)');\nfill(c);\nrect(55, 10, 45, 80);\ndescribe('Two sea green rectangles. A darker rectangle on the left and a brighter one on the right.');\n\n
    \n\n
    \n\n// HSB and HSBA color strings.\nlet c = color('hsb(160, 100%, 50%)');\nnoStroke();\nfill(c);\nrect(0, 10, 45, 80);\nc = color('hsba(160, 100%, 50%, 0.5)');\nfill(c);\nrect(55, 10, 45, 80);\ndescribe('Two green rectangles. A darker rectangle on the left and a brighter one on the right.');\n\n
    \n\n
    \n\n// Changing color modes.\nnoStroke();\nlet c = color(50, 55, 100);\nfill(c);\nrect(0, 10, 45, 80);\ncolorMode(HSB, 100);\nc = color(50, 55, 100);\nfill(c);\nrect(55, 10, 45, 80);\ndescribe('Two blue rectangles. A darker rectangle on the left and a brighter one on the right.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "gray", + "description": "number specifying value between white and black.", + "type": "Number" + }, + { + "name": "alpha", + "description": "alpha value relative to current color range\n(default is 0-255).", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "resulting color.", + "type": "p5.Color" + } + }, + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to\nthe current color range.", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value\nrelative to the current color range.", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value\nrelative to the current color range.", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "", + "type": "p5.Color" + } + }, + { + "params": [ + { + "name": "value", + "description": "a color string.", + "type": "String" + } + ], + "return": { + "description": "", + "type": "p5.Color" + } + }, + { + "params": [ + { + "name": "values", + "description": "an array containing the red, green, blue,\nand alpha components of the color.", + "type": "Number[]" + } + ], + "return": { + "description": "", + "type": "p5.Color" + } + }, + { + "params": [ + { + "name": "color", + "type": "p5.Color" + } + ], + "return": { + "description": "", + "type": "p5.Color" + } + } + ], + "return": { + "description": "resulting color.", + "type": "p5.Color" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "green", + "file": "src/color/creating_reading.js", + "line": 325, + "itemtype": "method", + "description": "Extracts the green value from a p5.Color object,\narray of color components, or CSS color string.", + "example": [ + "
    \n\nconst c = color(20, 75, 200);\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'greenValue' to 75.\nconst greenValue = green(c);\nfill(0, greenValue, 0);\nrect(50, 20, 35, 60);\ndescribe('Two rectangles. The rectangle on the left is blue and the one on the right is green.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the green value.", + "type": "Number" + } + } + ], + "return": { + "description": "the green value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "hue", + "file": "src/color/creating_reading.js", + "line": 363, + "itemtype": "method", + "description": "

    Extracts the hue value from a\np5.Color object, array of color components, or\nCSS color string.

    \n

    Hue exists in both HSB and HSL. It describes a color's position on the\ncolor wheel. By default, this function returns the HSL-normalized hue. If\nthe colorMode() is set to HSB, it returns the\nHSB-normalized hue.

    \n", + "example": [ + "
    \n\nnoStroke();\ncolorMode(HSB, 255);\nconst c = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'hueValue' to 0.\nconst hueValue = hue(c);\nfill(hueValue);\nrect(50, 20, 35, 60);\ndescribe(\n 'Two rectangles. The rectangle on the left is salmon pink and the one on the right is black.'\n);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the hue", + "type": "Number" + } + } + ], + "return": { + "description": "the hue", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "lerpColor", + "file": "src/color/creating_reading.js", + "line": 411, + "itemtype": "method", + "description": "

    Blends two colors to find a third color between them. The amt parameter\nspecifies the amount to interpolate between the two values. 0 is equal to\nthe first color, 0.1 is very near the first color, 0.5 is halfway between\nthe two colors, and so on. Negative numbers are set to 0. Numbers greater\nthan 1 are set to 1. This differs from the behavior of\nlerp. It's necessary because numbers outside of the\ninterval [0, 1] will produce strange and unexpected colors.

    \n

    The way that colors are interpolated depends on the current\ncolorMode().

    \n", + "example": [ + "
    \n\ncolorMode(RGB);\nstroke(255);\nbackground(51);\nconst from = color(218, 165, 32);\nconst to = color(72, 61, 139);\ncolorMode(RGB);\nconst interA = lerpColor(from, to, 0.33);\nconst interB = lerpColor(from, to, 0.66);\nfill(from);\nrect(10, 20, 20, 60);\nfill(interA);\nrect(30, 20, 20, 60);\nfill(interB);\nrect(50, 20, 20, 60);\nfill(to);\nrect(70, 20, 20, 60);\ndescribe(\n 'Four rectangles with white edges. From left to right, the rectangles are tan, brown, brownish purple, and purple.'\n);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "c1", + "description": "interpolate from this color.", + "type": "p5.Color" + }, + { + "name": "c2", + "description": "interpolate to this color.", + "type": "p5.Color" + }, + { + "name": "amt", + "description": "number between 0 and 1.", + "type": "Number" + } + ], + "return": { + "description": "interpolated color.", + "type": "p5.Color" + } + } + ], + "return": { + "description": "interpolated color.", + "type": "p5.Color" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "lightness", + "file": "src/color/creating_reading.js", + "line": 494, + "itemtype": "method", + "description": "Extracts the HSL lightness value from a\np5.Color object, array of color components, or\nCSS color string.", + "example": [ + "
    \n\nnoStroke();\ncolorMode(HSL);\nconst c = color(156, 100, 50, 1);\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'lightValue' to 50.\nconst lightValue = lightness(c);\nfill(lightValue);\nrect(50, 20, 35, 60);\ndescribe('Two rectangles. The rectangle on the left is light green and the one on the right is gray.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the lightness", + "type": "Number" + } + } + ], + "return": { + "description": "the lightness", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "red", + "file": "src/color/creating_reading.js", + "line": 524, + "itemtype": "method", + "description": "Extracts the red value from a\np5.Color object, array of color components, or\nCSS color string.", + "example": [ + "
    \n\nconst c = color(255, 204, 0);\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'redValue' to 255.\nconst redValue = red(c);\nfill(redValue, 0, 0);\nrect(50, 20, 35, 60);\ndescribe(\n 'Two rectangles with black edges. The rectangle on the left is yellow and the one on the right is red.'\n);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the red value.", + "type": "Number" + } + } + ], + "return": { + "description": "the red value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "saturation", + "file": "src/color/creating_reading.js", + "line": 560, + "itemtype": "method", + "description": "

    Extracts the saturation value from a\np5.Color object, array of color components, or\nCSS color string.

    \n

    Saturation is scaled differently in HSB and HSL. By default, this function\nreturns the HSL saturation. If the colorMode()\nis set to HSB, it returns the HSB saturation.

    \n", + "example": [ + "
    \n\nnoStroke();\ncolorMode(HSB, 255);\nconst c = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\n// Sets 'satValue' to 126.\nconst satValue = saturation(c);\nfill(satValue);\nrect(50, 20, 35, 60);\ndescribe(\n 'Two rectangles. The rectangle on the left is deep pink and the one on the right is gray.'\n);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "p5.Color object, array of\ncolor components, or CSS color string.", + "type": "p5.Color|Number[]|String" + } + ], + "return": { + "description": "the saturation value", + "type": "Number" + } + } + ], + "return": { + "description": "the saturation value", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "beginClip", + "file": "src/color/setting.js", + "line": 104, + "itemtype": "method", + "description": "

    Start defining a shape that will mask subsequent things drawn to the canvas.\nOnly opaque regions of the mask shape will allow content to be drawn.\nAny shapes drawn between this and endClip() will\ncontribute to the mask shape.

    \n

    The mask will apply to anything drawn after this call. To draw without a mask, contain\nthe code to apply the mask and to draw the masked content between\npush() and pop().

    \n

    Alternatively, rather than drawing the mask between this and\nendClip(), draw the mask in a callback function\npassed to clip().

    \n

    Options can include:

    \n
    • invert: A boolean specifying whether or not to mask the areas not filled by the mask shape. Defaults to false.
    ", + "example": [ + "
    \n\nnoStroke();\n\n// Mask in some shapes\npush();\nbeginClip();\ntriangle(15, 37, 30, 13, 43, 37);\ncircle(45, 45, 7);\nendClip();\n\nfill('red');\nrect(5, 5, 45, 45);\npop();\n\ntranslate(50, 50);\n\n// Mask out the same shapes\npush();\nbeginClip({ invert: true });\ntriangle(15, 37, 30, 13, 43, 37);\ncircle(45, 45, 7);\nendClip();\n\nfill('red');\nrect(5, 5, 45, 45);\npop();\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(255);\n noStroke();\n\n beginClip();\n push();\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n scale(0.5);\n torus(30, 15);\n pop();\n endClip();\n\n beginShape(QUAD_STRIP);\n fill(0, 255, 255);\n vertex(-width/2, -height/2);\n vertex(width/2, -height/2);\n fill(100, 0, 100);\n vertex(-width/2, height/2);\n vertex(width/2, height/2);\n endShape();\n}\n\n
    " + ], + "alt": "In the top left, a red triangle and circle. In the bottom right, a red\nsquare with a triangle and circle cut out of it.\nA silhouette of a rotating torus colored with a gradient from\ncyan to purple", + "overloads": [ + { + "params": [ + { + "name": "options", + "description": "An object containing clip settings.", + "optional": 1, + "type": "Object" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "endClip", + "file": "src/color/setting.js", + "line": 116, + "itemtype": "method", + "description": "Finishes defining a shape that will mask subsequent things drawn to the canvas.\nOnly opaque regions of the mask shape will allow content to be drawn.\nAny shapes drawn between beginClip() and this\nwill contribute to the mask shape.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "clip", + "file": "src/color/setting.js", + "line": 209, + "itemtype": "method", + "description": "

    Use the shape drawn by a callback function to mask subsequent things drawn to the canvas.\nOnly opaque regions of the mask shape will allow content to be drawn.

    \n

    The mask will apply to anything drawn after this call. To draw without a mask, contain\nthe code to apply the mask and to draw the masked content between\npush() and pop().

    \n

    Alternatively, rather than drawing the mask shape in a function, draw the\nshape between beginClip() and endClip().

    \n

    Options can include:

    \n
    • invert: A boolean specifying whether or not to mask the areas not filled by the mask shape. Defaults to false.
    ", + "example": [ + "
    \n\nnoStroke();\n\n// Mask in some shapes\npush();\nclip(() => {\n triangle(15, 37, 30, 13, 43, 37);\n circle(45, 45, 7);\n});\n\nfill('red');\nrect(5, 5, 45, 45);\npop();\n\ntranslate(50, 50);\n\n// Mask out the same shapes\npush();\nclip(() => {\n triangle(15, 37, 30, 13, 43, 37);\n circle(45, 45, 7);\n}, { invert: true });\n\nfill('red');\nrect(5, 5, 45, 45);\npop();\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(255);\n noStroke();\n\n clip(() => {\n push();\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n scale(0.5);\n torus(30, 15);\n pop();\n });\n\n beginShape(QUAD_STRIP);\n fill(0, 255, 255);\n vertex(-width/2, -height/2);\n vertex(width/2, -height/2);\n fill(100, 0, 100);\n vertex(-width/2, height/2);\n vertex(width/2, height/2);\n endShape();\n}\n\n
    " + ], + "alt": "In the top left, a red triangle and circle. In the bottom right, a red\nsquare with a triangle and circle cut out of it.\nA silhouette of a rotating torus colored with a gradient from\ncyan to purple", + "overloads": [ + { + "params": [ + { + "name": "callback", + "description": "A function that draws the mask shape.", + "type": "Function" + }, + { + "name": "options", + "description": "An object containing clip settings.", + "optional": 1, + "type": "Object" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "background", + "file": "src/color/setting.js", + "line": 385, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the color used for the background of the canvas. By default, the\nbackground is transparent. This function is typically used within\ndraw() to clear the display window at the beginning\nof each frame. It can also be used inside setup() to\nset the background on the first frame of animation.

    \n

    The version of background() with one parameter interprets the value one of four\nways. If the parameter is a number, it's interpreted as a grayscale value.\nIf the parameter is a string, it's interpreted as a CSS color string. RGB, RGBA,\nHSL, HSLA, hex, and named color strings are supported. If the parameter is a\np5.Color object, it will be used as the background color.\nIf the parameter is a p5.Image object, it will be used as\nthe background image.

    \n

    The version of background() with two parameters interprets the first one as a\ngrayscale value. The second parameter sets the alpha (transparency) value.

    \n

    The version of background() with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current colorMode().\nBy default, colors are specified in RGB values. Calling background(255, 204, 0)\nsets the background a bright yellow color.

    \n", + "example": [ + "
    \n\n// A grayscale integer value.\nbackground(51);\ndescribe('A canvas with a dark charcoal gray background.');\n\n
    \n\n
    \n\n// A grayscale integer value and an alpha value.\nbackground(51, 0.4);\ndescribe('A canvas with a transparent gray background.');\n\n
    \n\n
    \n\n// R, G & B integer values.\nbackground(255, 204, 0);\ndescribe('A canvas with a yellow background.');\n\n
    \n\n
    \n\n// H, S & B integer values.\ncolorMode(HSB);\nbackground(255, 204, 100);\ndescribe('A canvas with a royal blue background.');\n\n
    \n\n
    \n\n// A CSS named color.\nbackground('red');\ndescribe('A canvas with a red background.');\n\n
    \n\n
    \n\n// Three-digit hex RGB notation.\nbackground('#fae');\ndescribe('A canvas with a pink background.');\n\n
    \n\n
    \n\n// Six-digit hex RGB notation.\nbackground('#222222');\ndescribe('A canvas with a black background.');\n\n
    \n\n
    \n\n// Integer RGB notation.\nbackground('rgb(0,255,0)');\ndescribe('A canvas with a bright green background.');\n\n
    \n\n
    \n\n// Integer RGBA notation.\nbackground('rgba(0,255,0, 0.25)');\ndescribe('A canvas with a transparent green background.');\n\n
    \n\n
    \n\n// Percentage RGB notation.\nbackground('rgb(100%,0%,10%)');\ndescribe('A canvas with a red background.');\n\n
    \n\n
    \n\n// Percentage RGBA notation.\nbackground('rgba(100%,0%,100%,0.5)');\ndescribe('A canvas with a transparent purple background.');\n\n
    \n\n
    \n\n// A p5.Color object.\nlet c = color(0, 0, 255);\nbackground(c);\ndescribe('A canvas with a blue background.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "any value created by the color() function", + "type": "p5.Color" + } + ] + }, + { + "params": [ + { + "name": "colorstring", + "description": "color string, possible formats include: integer\nrgb() or rgba(), percentage rgb() or rgba(),\n3-digit hex, 6-digit hex.", + "type": "String" + }, + { + "name": "a", + "description": "opacity of the background relative to current\ncolor range (default is 0-255).", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "specifies a value between white and black.", + "type": "Number" + }, + { + "name": "a", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "red value if color mode is RGB, or hue value if color mode is HSB.", + "type": "Number" + }, + { + "name": "v2", + "description": "green value if color mode is RGB, or saturation value if color mode is HSB.", + "type": "Number" + }, + { + "name": "v3", + "description": "blue value if color mode is RGB, or brightness value if color mode is HSB.", + "type": "Number" + }, + { + "name": "a", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "an array containing the red, green, blue\nand alpha components of the color.", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "image", + "description": "image created with loadImage()\nor createImage(),\nto set as background.\n(must be same size as the sketch window).", + "type": "p5.Image" + }, + { + "name": "a", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "clear", + "file": "src/io/files.js", + "line": 1299, + "itemtype": "method", + "chainable": 1, + "description": "

    Clears the pixels on the canvas. This function makes every pixel 100%\ntransparent. Calling clear() doesn't clear objects created by createX()\nfunctions such as createGraphics(),\ncreateVideo(), and\ncreateImg(). These objects will remain\nunchanged after calling clear() and can be redrawn.

    \n

    In WebGL mode, this function can clear the screen to a specific color. It\ninterprets four numeric parameters as normalized RGBA color values. It also\nclears the depth buffer. If you are not using the WebGL renderer, these\nparameters will have no effect.

    \n", + "example": [ + "
    \n\nfunction draw() {\n circle(mouseX, mouseY, 20);\n describe('A white circle is drawn at the mouse x- and y-coordinates.');\n}\n\nfunction mousePressed() {\n clear();\n background(128);\n describe('The canvas is cleared when the mouse is clicked.');\n}\n\n
    \n\n
    \n\nlet pg;\n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n\n pg = createGraphics(60, 60);\n pg.background(200);\n pg.noStroke();\n pg.circle(pg.width / 2, pg.height / 2, 15);\n image(pg, 20, 20);\n describe('A white circle drawn on a gray square. The square gets smaller when the mouse is pressed.');\n}\n\nfunction mousePressed() {\n clear();\n image(pg, 20, 20);\n}\n\n
    ", + "
    \n// create writer object\nlet writer = createWriter('newFile.txt');\nwriter.write(['clear me']);\n// clear writer object here\nwriter.clear();\n// close writer\nwriter.close();\n
    \n
    \n\nfunction setup() {\n button = createButton('CLEAR ME');\n button.position(21, 40);\n button.mousePressed(createFile);\n}\n\nfunction createFile() {\n let writer = createWriter('newFile.txt');\n writer.write(['clear me']);\n writer.clear();\n writer.close();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "r", + "description": "normalized red value.", + "optional": 1, + "type": "Number" + }, + { + "name": "g", + "description": "normalized green value.", + "optional": 1, + "type": "Number" + }, + { + "name": "b", + "description": "normalized blue value.", + "optional": 1, + "type": "Number" + }, + { + "name": "a", + "description": "normalized alpha value.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "colorMode", + "file": "src/color/setting.js", + "line": 558, + "itemtype": "method", + "chainable": 1, + "description": "

    Changes the way p5.js interprets color data. By default, the numeric\nparameters for fill(),\nstroke(),\nbackground(), and\ncolor() are defined by values between 0 and 255\nusing the RGB color model. This is equivalent to calling\ncolorMode(RGB, 255). Pure red is color(255, 0, 0) in this model.

    \n

    Calling colorMode(RGB, 100) sets colors to be interpreted as RGB color\nvalues between 0 and 100. Pure red is color(100, 0, 0) in this model.

    \n

    Calling colorMode(HSB) or colorMode(HSL) changes to HSB or HSL system\ninstead of RGB.

    \n

    p5.Color objects remember the mode that they were\ncreated in. Changing modes doesn't affect their appearance.

    \n", + "example": [ + "
    \n\nnoStroke();\ncolorMode(RGB, 100);\nfor (let i = 0; i < 100; i += 1) {\n for (let j = 0; j < 100; j += 1) {\n stroke(i, j, 0);\n point(i, j);\n }\n}\ndescribe(\n 'A diagonal green to red gradient from bottom-left to top-right with shading transitioning to black at top-left corner.'\n);\n\n
    \n\n
    \n\nnoStroke();\ncolorMode(HSB, 100);\nfor (let i = 0; i < 100; i++) {\n for (let j = 0; j < 100; j++) {\n stroke(i, j, 100);\n point(i, j);\n }\n}\ndescribe('A rainbow gradient from left-to-right. Brightness transitions to white at the top.');\n\n
    \n\n
    \n\ncolorMode(RGB, 255);\nlet myColor = color(180, 175, 230);\nbackground(myColor);\ncolorMode(RGB, 1);\nlet redValue = red(myColor);\nlet greenValue = green(myColor);\nlet blueValue = blue(myColor);\ntext(`Red: ${redValue}`, 10, 10, 80, 80);\ntext(`Green: ${greenValue}`, 10, 40, 80, 80);\ntext(`Blue: ${blueValue}`, 10, 70, 80, 80);\ndescribe('A purple canvas with the red, green, and blue decimal values of the color written on it.');\n\n
    \n\n
    \n\nnoFill();\ncolorMode(RGB, 255, 255, 255, 1);\nbackground(255);\nstrokeWeight(4);\nstroke(255, 0, 10, 0.3);\ncircle(40, 40, 50);\ncircle(50, 60, 50);\ndescribe('Two overlapping translucent pink circle outlines.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "either RGB, HSB or HSL, corresponding to\nRed/Green/Blue and Hue/Saturation/Brightness\n(or Lightness).", + "type": "Constant" + }, + { + "name": "max", + "description": "range for all values.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "mode", + "type": "Constant" + }, + { + "name": "max1", + "description": "range for the red or hue depending on the\ncurrent color mode.", + "type": "Number" + }, + { + "name": "max2", + "description": "range for the green or saturation depending\non the current color mode.", + "type": "Number" + }, + { + "name": "max3", + "description": "range for the blue or brightness/lightness\ndepending on the current color mode.", + "type": "Number" + }, + { + "name": "maxA", + "description": "range for the alpha.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "fill", + "file": "src/color/setting.js", + "line": 740, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the color used to fill shapes. Calling fill(255, 165, 0) or\nfill('orange') means all shapes drawn after the fill command will be\nfilled with the color orange.

    \n

    The version of fill() with one parameter interprets the value one of\nthree ways. If the parameter is a number, it's interpreted as a grayscale\nvalue. If the parameter is a string, it's interpreted as a CSS color\nstring. A p5.Color object can also be provided to\nset the fill color.

    \n

    The version of fill() with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current\ncolorMode(). The default color space is RGB,\nwith each value in the range from 0 to 255.

    \n", + "example": [ + "
    \n\n// Grayscale integer value.\nfill(51);\nsquare(20, 20, 60);\ndescribe('A dark charcoal gray square with a black outline.');\n\n
    \n\n
    \n\n// R, G & B integer values.\nfill(255, 204, 0);\nsquare(20, 20, 60);\ndescribe('A yellow square with a black outline.');\n\n
    \n\n
    \n\n// H, S & B integer values.\ncolorMode(HSB);\nfill(255, 204, 100);\nsquare(20, 20, 60);\ndescribe('A royal blue square with a black outline.');\n\n
    \n\n
    \n\n// A CSS named color.\nfill('red');\nsquare(20, 20, 60);\ndescribe('A red square with a black outline.');\n\n
    \n\n
    \n\n// Three-digit hex RGB notation.\nfill('#fae');\nsquare(20, 20, 60);\ndescribe('A pink square with a black outline.');\n\n
    \n\n
    \n\n// Six-digit hex RGB notation.\nfill('#A251FA');\nsquare(20, 20, 60);\ndescribe('A purple square with a black outline.');\n\n
    \n\n
    \n\n// Integer RGB notation.\nfill('rgb(0,255,0)');\nsquare(20, 20, 60);\ndescribe('A bright green square with a black outline.');\n\n
    \n\n
    \n\n// Integer RGBA notation.\nfill('rgba(0,255,0, 0.25)');\nsquare(20, 20, 60);\ndescribe('A soft green rectange with a black outline.');\n\n
    \n\n
    \n\n// Percentage RGB notation.\nfill('rgb(100%,0%,10%)');\nsquare(20, 20, 60);\ndescribe('A red square with a black outline.');\n\n
    \n\n
    \n\n// Percentage RGBA notation.\nfill('rgba(100%,0%,100%,0.5)');\nsquare(20, 20, 60);\ndescribe('A dark fuchsia square with a black outline.');\n\n
    \n\n
    \n\n// p5.Color object.\nlet c = color(0, 0, 255);\nfill(c);\nsquare(20, 20, 60);\ndescribe('A blue square with a black outline.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red value if color mode is RGB or hue value if color mode is HSB.", + "type": "Number" + }, + { + "name": "v2", + "description": "green value if color mode is RGB or saturation value if color mode is HSB.", + "type": "Number" + }, + { + "name": "v3", + "description": "blue value if color mode is RGB or brightness value if color mode is HSB.", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "a color string.", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "a grayscale value.", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "an array containing the red, green, blue &\nand alpha components of the color.", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "the fill color.", + "type": "p5.Color" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "noFill", + "file": "src/color/setting.js", + "line": 784, + "itemtype": "method", + "chainable": 1, + "description": "Disables setting the interior color of shapes. This is the same as making\nthe fill completely transparent. If both\nnoStroke() and\nnoFill() are called, nothing will be drawn to the\nscreen.", + "example": [ + "
    \n\nsquare(32, 10, 35);\nnoFill();\nsquare(32, 55, 35);\ndescribe('A white square on top of an empty square. Both squares have black outlines.');\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(0);\n noFill();\n stroke(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(45, 45, 45);\n describe('A purple cube wireframe spinning on a black canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "noStroke", + "file": "src/color/setting.js", + "line": 824, + "itemtype": "method", + "chainable": 1, + "description": "Disables drawing the stroke (outline). If both\nnoStroke() and\nnoFill() are called, nothing will be drawn to the\nscreen.", + "example": [ + "
    \n\nnoStroke();\nsquare(20, 20, 60);\ndescribe('A white square with no outline.');\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(0);\n noStroke();\n fill(240, 150, 150);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(45, 45, 45);\n describe('A pink cube with no edge outlines spinning on a black canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "stroke", + "file": "src/color/setting.js", + "line": 998, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the color used to draw lines and borders around shapes. Calling\nstroke(255, 165, 0) or stroke('orange') means all shapes drawn after\nthe stroke() command will be filled with the color orange. The way these\nparameters are interpreted may be changed with the\ncolorMode() function.

    \n

    The version of stroke() with one parameter interprets the value one of\nthree ways. If the parameter is a number, it's interpreted as a grayscale\nvalue. If the parameter is a string, it's interpreted as a CSS color\nstring. A p5.Color object can also be provided to\nset the stroke color.

    \n

    The version of stroke() with two parameters interprets the first one as a\ngrayscale value. The second parameter sets the alpha (transparency) value.

    \n

    The version of stroke() with three parameters interprets them as RGB, HSB,\nor HSL colors, depending on the current colorMode().

    \n

    The version of stroke() with four parameters interprets them as RGBA, HSBA,\nor HSLA colors, depending on the current colorMode(). The last parameter\nsets the alpha (transparency) value.

    \n", + "example": [ + "
    \n\n// Grayscale integer value.\nstrokeWeight(4);\nstroke(51);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a dark charcoal gray outline.');\n\n
    \n\n
    \n\n// R, G & B integer values.\nstroke(255, 204, 0);\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a yellow outline.');\n\n
    \n\n
    \n\n// H, S & B integer values.\ncolorMode(HSB);\nstrokeWeight(4);\nstroke(255, 204, 100);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a royal blue outline.');\n\n
    \n\n
    \n\n// A CSS named color.\nstroke('red');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a red outline.');\n\n
    \n\n
    \n\n// Three-digit hex RGB notation.\nstroke('#fae');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a pink outline.');\n\n
    \n\n
    \n\n// Six-digit hex RGB notation.\nstroke('#222222');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a black outline.');\n\n
    \n\n
    \n\n// Integer RGB notation.\nstroke('rgb(0,255,0)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A whiite rectangle with a bright green outline.');\n\n
    \n\n
    \n\n// Integer RGBA notation.\nstroke('rgba(0,255,0,0.25)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a soft green outline.');\n\n
    \n\n
    \n\n// Percentage RGB notation.\nstroke('rgb(100%,0%,10%)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a red outline.');\n\n
    \n\n
    \n\n// Percentage RGBA notation.\nstroke('rgba(100%,0%,100%,0.5)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a dark fuchsia outline.');\n\n
    \n\n
    \n\n// p5.Color object.\nstroke(color(0, 0, 255));\nstrokeWeight(4);\nrect(20, 20, 60, 60);\ndescribe('A white rectangle with a blue outline.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red value if color mode is RGB or hue value if color mode is HSB.", + "type": "Number" + }, + { + "name": "v2", + "description": "green value if color mode is RGB or saturation value if color mode is HSB.", + "type": "Number" + }, + { + "name": "v3", + "description": "blue value if color mode is RGB or brightness value if color mode is HSB.", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "a color string.", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "a grayscale value.", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "an array containing the red, green, blue,\nand alpha components of the color.", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "the stroke color.", + "type": "p5.Color" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "erase", + "file": "src/color/setting.js", + "line": 1080, + "itemtype": "method", + "chainable": 1, + "description": "

    All drawing that follows erase() will subtract\nfrom the canvas, revealing the web page underneath. The erased areas will\nbecome transparent, allowing the content behind the canvas to show through.\nThe fill(), stroke(), and\nblendMode() have no effect once erase() is\ncalled.

    \n

    The erase() function has two optional parameters. The first parameter\nsets the strength of erasing by the shape's interior. A value of 0 means\nthat no erasing will occur. A value of 255 means that the shape's interior\nwill fully erase the content underneath. The default value is 255\n(full strength).

    \n

    The second parameter sets the strength of erasing by the shape's edge. A\nvalue of 0 means that no erasing will occur. A value of 255 means that the\nshape's edge will fully erase the content underneath. The default value is\n255 (full strength).

    \n

    To cancel the erasing effect, use the noErase()\nfunction.

    \n

    erase() has no effect on drawing done with the\nimage() and\nbackground() functions.

    \n", + "example": [ + "
    \n\nbackground(100, 100, 250);\nfill(250, 100, 100);\nsquare(20, 20, 60);\nerase();\ncircle(25, 30, 30);\nnoErase();\ndescribe('A purple canvas with a pink square in the middle. A circle is erased from the top-left, leaving a white hole.');\n\n
    \n\n
    \n\nlet p = createP('I am a DOM element');\np.style('font-size', '12px');\np.style('width', '65px');\np.style('text-align', 'center');\np.position(18, 26);\n\nbackground(100, 170, 210);\nerase(200, 100);\ncircle(50, 50, 77);\nnoErase();\ndescribe('A blue canvas with a circular hole in the center that reveals the message \"I am a DOM element\".');\n\n
    \n\n
    \n\nbackground(150, 250, 150);\nfill(100, 100, 250);\nsquare(20, 20, 60);\nstrokeWeight(5);\nerase(150, 255);\ntriangle(50, 10, 70, 50, 90, 10);\nnoErase();\ndescribe('A mint green canvas with a purple square in the center. A triangle in the top-right corner partially erases its interior and a fully erases its outline.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "strengthFill", + "description": "a number (0-255) for the strength of erasing under a shape's interior.\nDefaults to 255, which is full strength.", + "optional": 1, + "type": "Number" + }, + { + "name": "strengthStroke", + "description": "a number (0-255) for the strength of erasing under a shape's edge.\nDefaults to 255, which is full strength.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "noErase", + "file": "src/color/setting.js", + "line": 1109, + "itemtype": "method", + "chainable": 1, + "description": "Ends erasing that was started with erase().\nThe fill(), stroke(), and\nblendMode() settings will return to what they\nwere prior to calling erase().", + "example": [ + "
    \n\nbackground(235, 145, 15);\nnoStroke();\nfill(30, 45, 220);\nrect(30, 10, 10, 80);\nerase();\ncircle(50, 50, 60);\nnoErase();\nrect(70, 10, 10, 80);\ndescribe('An orange canvas with two tall blue rectangles. A circular hole in the center erases the rectangle on the left but not the one on the right.');\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Color", + "submodule": "Setting" + }, + { + "name": "print", + "file": "src/io/files.js", + "line": 1265, + "itemtype": "method", + "description": "

    Displays text in the web browser's console.

    \n

    print() is helpful for printing values while debugging. Each call to\nprint() creates a new line of text.

    \n

    Note: Call print('\\n') to print a blank line. Calling print() without\nan argument opens the browser's dialog for printing documents.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Prints \"hello, world\" to the console.\n print('hello, world');\n}\n\n
    \n\n
    \n\nfunction setup() {\n let name = 'ada';\n // Prints \"hello, ada\" to the console.\n print(`hello, ${name}`);\n}\n\n
    ", + "
    \n\n// creates a file called 'newFile.txt'\nlet writer = createWriter('newFile.txt');\n// creates a file containing\n// My name is:\n// Teddy\nwriter.print('My name is:');\nwriter.print('Teddy');\n// close the PrintWriter and save the file\nwriter.close();\n\n
    \n
    \n\nlet writer;\n\nfunction setup() {\n createCanvas(400, 400);\n // create a PrintWriter\n writer = createWriter('newFile.txt');\n}\n\nfunction draw() {\n writer.print([mouseX, mouseY]);\n}\n\nfunction mouseClicked() {\n writer.close();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "contents", + "description": "content to print to the console.", + "type": "Any" + } + ] + }, + { + "params": [ + { + "name": "data", + "description": "all data to be printed by the PrintWriter", + "type": "Array" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "cursor", + "file": "src/core/environment.js", + "line": 272, + "itemtype": "method", + "description": "

    Changes the cursor's appearance.

    \n

    The first parameter, type, sets the type of cursor to display. The\nbuilt-in options are ARROW, CROSS, HAND, MOVE, TEXT, and WAIT.\ncursor() also recognizes standard CSS cursor properties passed as\nstrings: 'help', 'wait', 'crosshair', 'not-allowed', 'zoom-in',\nand 'grab'. If the path to an image is passed, as in\ncursor('assets/target.png'), then the image will be used as the cursor.\nImages must be in .cur, .gif, .jpg, .jpeg, or .png format.

    \n

    The parameters x and y are optional. If an image is used for the\ncursor, x and y set the location pointed to within the image. They are\nboth 0 by default, so the cursor points to the image's top-left corner. x\nand y must be less than the image's width and height, respectively.

    \n", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n\n // Set the cursor to crosshairs: +\n cursor(CROSS);\n\n describe('A gray square. The cursor appears as crosshairs.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n // Divide the canvas into quadrants.\n line(50, 0, 50, 100);\n line(0, 50, 100, 50);\n\n // Change cursor based on mouse position.\n if (mouseX < 50 && mouseY < 50) {\n cursor(CROSS);\n } else if (mouseX > 50 && mouseY < 50) {\n cursor('progress');\n } else if (mouseX > 50 && mouseY > 50) {\n cursor('https://avatars0.githubusercontent.com/u/1617169?s=16');\n } else {\n cursor('grab');\n }\n\n describe('A gray square divided into quadrants. The cursor image changes when the mouse moves to each quadrant.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n // Change the cursor's active spot\n // when the mouse is pressed.\n if (mouseIsPressed === true) {\n cursor('https://avatars0.githubusercontent.com/u/1617169?s=16', 8, 8);\n } else {\n cursor('https://avatars0.githubusercontent.com/u/1617169?s=16');\n }\n\n describe('An image of three purple curves follows the mouse. The image shifts when the mouse is pressed.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "type", + "description": "Built-in: either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT.\nNative CSS properties: 'grab', 'progress', and so on.\nPath to cursor image.", + "type": "String|Constant" + }, + { + "name": "x", + "description": "horizontal active spot of the cursor.", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "vertical active spot of the cursor.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "frameRate", + "file": "src/core/environment.js", + "line": 372, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the number of frames to draw per second.

    \n

    Calling frameRate() with one numeric argument, as in frameRate(30),\nattempts to draw 30 frames per second (FPS). The target frame rate may not\nbe achieved depending on the sketch's processing needs. Most computers\ndefault to a frame rate of 60 FPS. Frame rates of 24 FPS and above are\nfast enough for smooth animations.

    \n

    Calling frameRate() without an argument returns the current frame rate.\nThe value returned is an approximation.

    \n", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n\n // Set the x variable based\n // on the current frameCount.\n let x = frameCount % 100;\n\n // If the mouse is pressed,\n // decrease the frame rate.\n if (mouseIsPressed === true) {\n frameRate(10);\n } else {\n frameRate(60);\n }\n\n // Use x to set the circle's\n // position.\n circle(x, 50, 20);\n\n describe('A white circle on a gray background. The circle moves from left to right in a loop. It slows down when the mouse is pressed.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n // If the mouse is pressed, do lots\n // of math to slow down drawing.\n if (mouseIsPressed === true) {\n for (let i = 0; i < 1000000; i += 1) {\n random();\n }\n }\n\n // Get the current frame rate\n // and display it.\n let fps = frameRate();\n text(fps, 50, 50);\n\n describe('A number written in black written on a gray background. The number decreases when the mouse is pressed.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fps", + "description": "number of frames to draw per second.", + "type": "Number" + } + ] + }, + { + "params": [], + "return": { + "description": "current frame rate.", + "type": "Number" + } + } + ], + "return": { + "description": "current frame rate.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "getTargetFrameRate", + "file": "src/core/environment.js", + "line": 436, + "itemtype": "method", + "description": "Returns the target frame rate. The value is either the system frame rate or\nthe last value passed to frameRate().", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n\n // Set the frame rate to 20.\n frameRate(20);\n\n // Get the target frame rate and\n // display it.\n let fps = getTargetFrameRate();\n text(fps, 43, 54);\n\n describe('The number 20 written in black on a gray background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "_targetFrameRate", + "type": "Number" + } + } + ], + "return": { + "description": "_targetFrameRate", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "noCursor", + "file": "src/core/environment.js", + "line": 462, + "itemtype": "method", + "description": "Hides the cursor from view.", + "example": [ + "
    \n\nfunction setup() {\n // Hide the cursor.\n noCursor();\n}\n\nfunction draw() {\n background(200);\n\n circle(mouseX, mouseY, 10);\n\n describe('A white circle on a gray background. The circle follows the mouse as it moves. The cursor is hidden.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "windowResized", + "file": "src/core/environment.js", + "line": 719, + "itemtype": "method", + "description": "

    The code in windowResized() is called once each time the browser window\nis resized. It's a good place to resize the canvas or make other\nadjustments to accommodate the new window size.

    \n

    The event parameter is optional. If added to the function definition, it\ncan be used for debugging or other purposes.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(windowWidth, windowHeight);\n}\n\nfunction draw() {\n background(200);\n\n describe('A gray canvas that takes up the entire browser window. It changes size to match the browser window.');\n}\n\n// Resize the canvas when the\n// browser's size changes.\nfunction windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}\n\n
    " + ], + "alt": "This example does not render anything.\n\n
    \n\nfunction setup() {\n createCanvas(windowWidth, windowHeight);\n}\n\nfunction draw() {\n background(200);\n\n describe('A gray canvas that takes up the entire browser window. It changes size to match the browser window.');\n}\n\nfunction windowResized(event) {\n // Resize the canvas when the\n // browser's size changes.\n resizeCanvas(windowWidth, windowHeight);\n\n // Print the resize event to the console for debugging.\n print(event);\n}\n\n
    \nThis example does not render anything.", + "overloads": [ + { + "params": [ + { + "name": "event", + "description": "optional resize Event.", + "optional": 1, + "type": "UIEvent" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "fullscreen", + "file": "src/core/environment.js", + "line": 923, + "itemtype": "method", + "description": "

    Toggles full-screen mode or returns the current mode.

    \n

    Calling fullscreen(true) makes the sketch full-screen. Calling\nfullscreen(false) makes the sketch its original size.

    \n

    Calling fullscreen() without an argument returns true if the sketch\nis in full-screen mode and false if not.

    \n

    Note: Due to browser restrictions, fullscreen() can only be called with\nuser input such as a mouse press.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n describe('A gray canvas that switches between default and full-screen display when clicked.');\n}\n\n// If the mouse is pressed,\n// toggle full-screen mode.\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n let fs = fullscreen();\n fullscreen(!fs);\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "val", + "description": "whether the sketch should be in fullscreen mode.", + "optional": 1, + "type": "Boolean" + } + ], + "return": { + "description": "current fullscreen state.", + "type": "Boolean" + } + } + ], + "return": { + "description": "current fullscreen state.", + "type": "Boolean" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "pixelDensity", + "file": "src/core/environment.js", + "line": 995, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the pixel scaling for high pixel density displays.

    \n

    By default, the pixel density is set to match display density. Calling\npixelDensity(1) turn this off.

    \n

    Calling pixelDensity() without an argument returns the current pixel\ndensity.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Set the pixel density to 1.\n pixelDensity(1);\n\n // Create a canvas and draw\n // a circle.\n createCanvas(100, 100);\n background(200);\n circle(50, 50, 70);\n\n describe('A fuzzy white circle on a gray canvas.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Set the pixel density to 3.\n pixelDensity(3);\n\n // Create a canvas, paint the\n // background, and draw a\n // circle.\n createCanvas(100, 100);\n background(200);\n circle(50, 50, 70);\n\n describe('A sharp white circle on a gray canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "val", + "description": "desired pixel density.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [], + "return": { + "description": "current pixel density of the sketch.", + "type": "Number" + } + } + ], + "return": { + "description": "current pixel density of the sketch.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "displayDensity", + "file": "src/core/environment.js", + "line": 1047, + "itemtype": "method", + "description": "Returns the display's current pixel density.", + "example": [ + "
    \n\nfunction setup() {\n // Set the pixel density to 1.\n pixelDensity(1);\n\n // Create a canvas and draw\n // a circle.\n createCanvas(100, 100);\n background(200);\n circle(50, 50, 70);\n\n describe('A fuzzy white circle drawn on a gray background. The circle becomes sharper when the mouse is pressed.');\n}\n\nfunction mousePressed() {\n // Get the current display density.\n let d = displayDensity();\n\n // Use the display density to set\n // the sketch's pixel density.\n pixelDensity(d);\n\n // Paint the background and\n // draw a circle.\n background(200);\n circle(50, 50, 70);\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "current pixel density of the display.", + "type": "Number" + } + } + ], + "return": { + "description": "current pixel density of the display.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "getURL", + "file": "src/core/environment.js", + "line": 1105, + "itemtype": "method", + "description": "Returns the sketch's current\nURL\nas a string.", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Get the sketch's URL\n // and display it.\n let url = getURL();\n textWrap(CHAR);\n text(url, 0, 40, 100);\n\n describe('The URL \"https://p5js.org/reference/#/p5/getURL\" written in black on a gray background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "url", + "type": "String" + } + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "getURLPath", + "file": "src/core/environment.js", + "line": 1137, + "itemtype": "method", + "description": "

    Returns the current\nURL\npath as an array of strings.

    \n

    For example, consider a sketch hosted at the URL\nhttps://example.com/sketchbook. Calling getURLPath() returns\n['sketchbook']. For a sketch hosted at the URL\nhttps://example.com/sketchbook/monday, getURLPath() returns\n['sketchbook', 'monday'].

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Get the sketch's URL path\n // and display the first\n // part.\n let path = getURLPath();\n text(path[0], 25, 54);\n\n describe('The word \"reference\" written in black on a gray background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "path components.", + "type": "String[]" + } + } + ], + "return": { + "description": "path components.", + "type": "String[]" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "getURLParams", + "file": "src/core/environment.js", + "line": 1176, + "itemtype": "method", + "description": "

    Returns the current\nURL parameters\nin an Object.

    \n

    For example, calling getURLParams() in a sketch hosted at the URL\nhttp://p5js.org?year=2014&month=May&day=15 returns\n{ year: 2014, month: 'May', day: 15 }.

    \n", + "example": [ + "
    \n\n// Imagine this sketch is hosted at the following URL:\n// https://p5js.org?year=2014&month=May&day=15\n\nfunction setup() {\n background(200);\n\n // Get the sketch's URL\n // parameters and display\n // them.\n let params = getURLParams();\n text(params.day, 10, 20);\n text(params.month, 10, 40);\n text(params.year, 10, 60);\n\n describe('The text \"15\", \"May\", and \"2014\" written in black on separate lines.');\n}\n\n
    " + ], + "alt": "This example does not render anything.", + "overloads": [ + { + "params": [], + "return": { + "description": "URL params", + "type": "Object" + } + } + ], + "return": { + "description": "URL params", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "Environment", + "submodule": "Environment" + }, + { + "name": "preload", + "file": "src/core/main.js", + "line": 752, + "itemtype": "method", + "description": "

    Called directly before setup(), the preload() function is used to handle\nasynchronous loading of external files in a blocking way. If a preload\nfunction is defined, setup() will wait until any load calls within have\nfinished. Nothing besides load calls (loadImage, loadJSON, loadFont,\nloadStrings, etc.) should be inside the preload function. If asynchronous\nloading is preferred, the load methods can instead be called in setup()\nor anywhere else with the use of a callback parameter.

    \n

    By default the text \"loading...\" will be displayed. To make your own\nloading page, include an HTML element with id \"p5_loading\" in your\npage. More information here.

    \n", + "example": [ + "
    \nlet img;\nlet c;\nfunction preload() {\n // preload() runs once\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n // setup() waits until preload() is done\n img.loadPixels();\n // get color of middle pixel\n c = img.get(img.width / 2, img.height / 2);\n}\n\nfunction draw() {\n background(c);\n image(img, 25, 25, 50, 50);\n}\n
    " + ], + "alt": "nothing displayed", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "setup", + "file": "src/core/main.js", + "line": 752, + "itemtype": "method", + "description": "

    The setup() function is called once when the program starts. It's used to\ndefine initial environment properties such as screen size and background\ncolor and to load media such as images and fonts as the program starts.\nThere can only be one setup() function for each program and it shouldn't\nbe called again after its initial execution.

    \n

    Note: Variables declared within setup() are not accessible within other\nfunctions, including draw().

    \n", + "example": [ + "
    \nlet a = 0;\n\nfunction setup() {\n background(0);\n noStroke();\n fill(102);\n}\n\nfunction draw() {\n rect(a++ % width, 10, 2, 80);\n}\n
    " + ], + "alt": "nothing displayed", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "draw", + "file": "src/core/main.js", + "line": 752, + "itemtype": "method", + "description": "

    Called directly after setup(), the draw() function continuously executes\nthe lines of code contained inside its block until the program is stopped\nor noLoop() is called. Note if noLoop() is called in setup(), draw() will\nstill be executed once before stopping. draw() is called automatically and\nshould never be called explicitly.

    \n

    It should always be controlled with noLoop(), redraw() and loop(). After\nnoLoop() stops the code in draw() from executing, redraw() causes the\ncode inside draw() to execute once, and loop() will cause the code\ninside draw() to resume executing continuously.

    \n

    The number of times draw() executes in each second may be controlled with\nthe frameRate() function.

    \n

    There can only be one draw() function for each sketch, and draw() must\nexist if you want the code to run continuously, or to process events such\nas mousePressed(). Sometimes, you might have an empty call to draw() in\nyour program, as shown in the above example.

    \n

    It is important to note that the drawing coordinate system will be reset\nat the beginning of each draw() call. If any transformations are performed\nwithin draw() (ex: scale, rotate, translate), their effects will be\nundone at the beginning of draw(), so transformations will not accumulate\nover time. On the other hand, styling applied (ex: fill, stroke, etc) will\nremain in effect.

    \n", + "example": [ + "
    \nlet yPos = 0;\nfunction setup() {\n // setup() runs once\n frameRate(30);\n}\nfunction draw() {\n // draw() loops forever, until stopped\n background(204);\n yPos = yPos - 1;\n if (yPos < 0) {\n yPos = height;\n }\n line(0, yPos, width, yPos);\n}\n
    " + ], + "alt": "nothing displayed", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "parent", + "file": "src/core/p5.Element.js", + "line": 216, + "itemtype": "method", + "chainable": 1, + "description": "

    Attaches this element to a parent element.

    \n

    For example, a <div></div> element may be used as a box to\nhold two pieces of text, a header and a paragraph. The\n<div></div> is the parent element of both the header and\nparagraph.

    \n

    The parameter parent can have one of three types. parent can be a\nstring with the parent element's ID, as in\nmyElement.parent('container'). It can also be another\np5.Element object, as in\nmyElement.parent(myDiv). Finally, parent can be an HTMLElement\nobject, as in myElement.parent(anotherElement).

    \n

    Calling myElement.parent() without an argument returns this element's\nparent.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create a div element.\n let div = createDiv();\n // Place the div in the top-left corner.\n div.position(10, 20);\n // Set its width and height.\n div.size(80, 60);\n // Set its background color to white\n div.style('background-color', 'white');\n // Align any text to the center.\n div.style('text-align', 'center');\n // Set its ID to \"container\".\n div.id('container');\n\n // Create a paragraph element.\n let p = createP('p5*js');\n // Make the div its parent\n // using its ID \"container\".\n p.parent('container');\n\n describe('The text \"p5*js\" written in black at the center of a white rectangle. The rectangle is inside a gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create rectangular div element.\n let div = createDiv();\n // Place the div in the top-left corner.\n div.position(10, 20);\n // Set its width and height.\n div.size(80, 60);\n // Set its background color and align\n // any text to the center.\n div.style('background-color', 'white');\n div.style('text-align', 'center');\n\n // Create a paragraph element.\n let p = createP('p5*js');\n // Make the div its parent.\n p.parent(div);\n\n describe('The text \"p5*js\" written in black at the center of a white rectangle. The rectangle is inside a gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create rectangular div element.\n let div = createDiv();\n // Place the div in the top-left corner.\n div.position(10, 20);\n // Set its width and height.\n div.size(80, 60);\n // Set its background color and align\n // any text to the center.\n div.style('background-color', 'white');\n div.style('text-align', 'center');\n\n // Create a paragraph element.\n let p = createP('p5*js');\n // Make the div its parent\n // using the underlying\n // HTMLElement.\n p.parent(div.elt);\n\n describe('The text \"p5*js\" written in black at the center of a white rectangle. The rectangle is inside a gray square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "parent", + "description": "ID, p5.Element,\nor HTMLElement of desired parent element.", + "type": "String|p5.Element|Object" + } + ] + }, + { + "params": [], + "return": { + "description": "", + "type": "p5.Element" + } + } + ], + "return": { + "description": "", + "type": "p5.Element" + }, + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "id", + "file": "src/core/p5.Element.js", + "line": 269, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets this element's ID using a given string.

    \n

    Calling myElement.id() without an argument returns its ID as a string.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Set the canvas' ID\n // to \"mycanvas\".\n cnv.id('mycanvas');\n\n // Get the canvas' ID.\n let id = cnv.id();\n text(id, 24, 54);\n\n describe('The text \"mycanvas\" written in black on a gray background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "id", + "description": "ID of the element.", + "type": "String" + } + ] + }, + { + "params": [], + "return": { + "description": "ID of the element.", + "type": "String" + } + } + ], + "return": { + "description": "ID of the element.", + "type": "String" + }, + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "class", + "file": "src/core/p5.Element.js", + "line": 320, + "itemtype": "method", + "chainable": 1, + "description": "

    Adds a\nclass attribute\nto the element.

    \n

    Calling myElement.class() without an argument returns a string with its current classes.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Add the class \"small\" to the\n // canvas element.\n cnv.class('small');\n\n // Get the canvas element's class\n // and display it.\n let c = cnv.class();\n text(c, 35, 54);\n\n describe('The word \"small\" written in black on a gray canvas.');\n\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "class", + "description": "class to add.", + "type": "String" + } + ] + }, + { + "params": [], + "return": { + "description": "element's classes, if any.", + "type": "String" + } + } + ], + "return": { + "description": "element's classes, if any.", + "type": "String" + }, + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "mousePressed", + "file": "src/events/mouse.js", + "line": 653, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the mouse is pressed over the element.\nCalling myElement.mousePressed(false) disables the function.

    \n

    Note: Some mobile browsers may also trigger this event when the element\nreceives a quick tap.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the canvas\n // is pressed.\n cnv.mousePressed(randomColor);\n\n describe('A gray square changes color when the mouse is pressed.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the canvas is pressed.\n cnv.mousePressed(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the mouse is pressed.');\n}\n\n
    ", + "
    \n\n// Click anywhere in the webpage to change\n// the color value of the rectangle\n\nlet colorValue = 0;\nfunction draw() {\n fill(colorValue);\n rect(25, 25, 50, 50);\n describe('black 50-by-50 rect turns white with mouse click/press.');\n}\nfunction mousePressed() {\n if (colorValue === 0) {\n colorValue = 255;\n } else {\n colorValue = 0;\n }\n}\n\n
    \n\n
    \n\nfunction mousePressed() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n\n
    \n\n
    \n\n// returns a MouseEvent object\n// as a callback argument\nfunction mousePressed(event) {\n console.log(event);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse is\npressed over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional MouseEvent callback argument.", + "optional": 1, + "type": "MouseEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "doubleClicked", + "file": "src/events/mouse.js", + "line": 872, + "itemtype": "method", + "chainable": 1, + "description": "Calls a function when the mouse is pressed twice over the element.\nCalling myElement.doubleClicked(false) disables the function.", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // canvas is double-clicked.\n cnv.doubleClicked(randomColor);\n\n describe('A gray square changes color when the user double-clicks the canvas.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the canvas is double-clicked.\n cnv.doubleClicked(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the user double-clicks the canvas.');\n}\n\n
    ", + "
    \n\n// Click within the image to change\n// the value of the rectangle\n// after the mouse has been double clicked\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe('black 50-by-50 rect turns white with mouse doubleClick/press.');\n}\n\nfunction doubleClicked() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction doubleClicked() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n\n
    \n\n
    \n\n// returns a MouseEvent object\n// as a callback argument\nfunction doubleClicked(event) {\n console.log(event);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse is\ndouble clicked over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional MouseEvent callback argument.", + "optional": 1, + "type": "MouseEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "mouseWheel", + "file": "src/events/mouse.js", + "line": 938, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the mouse wheel scrolls over th element.

    \n

    The callback function, fxn, is passed an event object. event has\ntwo numeric properties, deltaY and deltaX. event.deltaY is\nnegative if the mouse wheel rotates away from the user. It's positive if\nthe mouse wheel rotates toward the user. event.deltaX is positive if\nthe mouse wheel moves to the right. It's negative if the mouse wheel moves\nto the left.

    \n

    Calling myElement.mouseWheel(false) disables the function.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // mouse wheel moves.\n cnv.mouseWheel(randomColor);\n\n describe('A gray square changes color when the user scrolls the mouse wheel over the canvas.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the mouse wheel moves.\n cnv.mouseWheel(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the user scrolls the mouse wheel over the canvas.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call changeBackground() when the\n // mouse wheel moves.\n cnv.mouseWheel(changeBackground);\n\n describe('A gray square. When the mouse wheel scrolls over the square, it changes color and displays shapes.');\n}\n\nfunction changeBackground(event) {\n // Change the background color\n // based on deltaY.\n if (event.deltaY > 0) {\n background('deeppink');\n } else if (event.deltaY < 0) {\n background('cornflowerblue');\n } else {\n background(200);\n }\n\n // Draw a shape based on deltaX.\n if (event.deltaX > 0) {\n circle(50, 50, 20);\n } else if (event.deltaX < 0) {\n square(40, 40, 20);\n }\n}\n\n
    ", + "
    \n\nlet pos = 25;\n\nfunction draw() {\n background(237, 34, 93);\n fill(0);\n rect(25, pos, 50, 50);\n describe(`black 50-by-50 rect moves up and down with vertical scroll.\n fuchsia background`);\n}\n\nfunction mouseWheel(event) {\n print(event.delta);\n //move the square according to the vertical scroll amount\n pos += event.delta;\n //uncomment to block page scrolling\n //return false;\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse wheel is\nscrolled over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional WheelEvent callback argument.", + "optional": 1, + "type": "WheelEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "mouseReleased", + "file": "src/events/mouse.js", + "line": 730, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the mouse is released over the element. Calling\nmyElement.mouseReleased(false) disables the function.

    \n

    Note: Some mobile browsers may also trigger this event when the element\nreceives a quick tap.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when a\n // mouse press ends.\n cnv.mouseReleased(randomColor);\n\n describe('A gray square changes color when the user releases a mouse press.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when a mouse press ends.\n cnv.mouseReleased(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the user releases a mouse press.');\n}\n\n
    ", + "
    \n\n// Click within the image to change\n// the value of the rectangle\n// after the mouse has been clicked\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe('black 50-by-50 rect turns white with mouse click/press.');\n}\nfunction mouseReleased() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction mouseReleased() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n\n
    \n\n
    \n\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseReleased(event) {\n console.log(event);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse is\npressed over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional MouseEvent callback argument.", + "optional": 1, + "type": "MouseEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "mouseClicked", + "file": "src/events/mouse.js", + "line": 806, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the mouse is pressed and released over the element.\nCalling myElement.mouseReleased(false) disables the function.

    \n

    Note: Some mobile browsers may also trigger this event when the element\nreceives a quick tap.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when a\n // mouse press ends.\n cnv.mouseClicked(randomColor);\n\n describe('A gray square changes color when the user releases a mouse press.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when a mouse press ends.\n cnv.mouseClicked(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the user releases a mouse press.');\n}\n\n
    ", + "
    \n\n// Click within the image to change\n// the value of the rectangle\n// after the mouse has been clicked\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe('black 50-by-50 rect turns white with mouse click/press.');\n}\n\nfunction mouseClicked() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction mouseClicked() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n\n
    \n\n
    \n\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseClicked(event) {\n console.log(event);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse is\npressed and released over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional MouseEvent callback argument.", + "optional": 1, + "type": "MouseEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "mouseMoved", + "file": "src/events/mouse.js", + "line": 573, + "itemtype": "method", + "chainable": 1, + "description": "Calls a function when the mouse moves over the element. Calling\nmyElement.mouseMoved(false) disables the function.", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // mouse moves.\n cnv.mouseMoved(randomColor);\n\n describe('A gray square changes color when the mouse moves over the canvas.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the mouse moves.\n cnv.mouseMoved(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the mouse moves over the canvas.');\n}\n\n
    ", + "
    \n\n// Move the mouse across the page\n// to change its value\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`black 50-by-50 rect becomes lighter with mouse movements until\n white then resets no image displayed`);\n}\nfunction mouseMoved() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction mouseMoved() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n\n
    \n\n
    \n\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseMoved(event) {\n console.log(event);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse\nmoves over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional MouseEvent callback argument.", + "optional": 1, + "type": "MouseEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "mouseOver", + "file": "src/core/p5.Element.js", + "line": 823, + "itemtype": "method", + "chainable": 1, + "description": "Calls a function when the mouse moves onto the element. Calling\nmyElement.mouseOver(false) disables the function.", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // mouse moves onto the canvas.\n cnv.mouseOver(randomColor);\n\n describe('A gray square changes color when the mouse moves onto the canvas.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the mouse moves onto\n // the canvas.\n cnv.mouseOver(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the mouse moves onto the canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse\nmoves onto the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "mouseOut", + "file": "src/core/p5.Element.js", + "line": 886, + "itemtype": "method", + "chainable": 1, + "description": "Calls a function when the mouse moves off the element. Calling\nmyElement.mouseOut(false) disables the function.", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // mouse moves off the canvas.\n cnv.mouseOut(randomColor);\n\n describe('A gray square changes color when the mouse moves off the canvas.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the mouse moves off\n // the canvas.\n cnv.mouseOut(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the mouse moves off the canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the mouse\nmoves off the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "touchStarted", + "file": "src/events/touch.js", + "line": 124, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the element is touched. Calling\nmyElement.touchStarted(false) disables the function.

    \n

    Note: Touch functions only work on mobile devices.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // user touches the canvas.\n cnv.touchStarted(randomColor);\n\n describe('A gray square changes color when the user touches the canvas.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the user touches the\n // canvas.\n cnv.touchStarted(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the user touches the canvas.');\n}\n\n
    ", + "
    \n\n// Touch within the image to change\n// the value of the rectangle\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe('50-by-50 black rect turns white with touch event.');\n}\nfunction touchStarted() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction touchStarted() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\ndescribe('no image displayed');\n\n
    \n\n
    \n\n// returns a TouchEvent object\n// as a callback argument\nfunction touchStarted(event) {\n console.log(event);\n}\ndescribe('no image displayed');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the touch\nstarts.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional TouchEvent callback argument.", + "optional": 1, + "type": "TouchEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Touch" + }, + { + "name": "touchMoved", + "file": "src/events/touch.js", + "line": 202, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the user touches the element and moves their\nfinger. Calling myElement.touchMoved(false) disables the\nfunction.

    \n

    Note: Touch functions only work on mobile devices.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // user touches the canvas\n // and moves.\n cnv.touchMoved(randomColor);\n\n describe('A gray square changes color when the user touches the canvas and moves.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the user touches the\n // canvas and moves.\n cnv.touchMoved(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the user touches the canvas and moves.');\n}\n\n
    ", + "
    \n\n// Move your finger across the page\n// to change its value\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe('50-by-50 black rect turns lighter with touch until white. resets');\n}\nfunction touchMoved() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction touchMoved() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\ndescribe('no image displayed');\n\n
    \n\n
    \n\n// returns a TouchEvent object\n// as a callback argument\nfunction touchMoved(event) {\n console.log(event);\n}\ndescribe('no image displayed');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the touch\nmoves over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional TouchEvent callback argument.", + "optional": 1, + "type": "TouchEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Touch" + }, + { + "name": "touchEnded", + "file": "src/events/touch.js", + "line": 274, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the user stops touching the element. Calling\nmyElement.touchMoved(false) disables the function.

    \n

    Note: Touch functions only work on mobile devices.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call randomColor() when the\n // user touches the canvas,\n // then lifts their finger.\n cnv.touchEnded(randomColor);\n\n describe('A gray square changes color when the user touches the canvas, then lifts their finger.');\n}\n\n// Paint the background either\n// red, yellow, blue, or green.\nfunction randomColor() {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Paint the background either\n // red, yellow, blue, or green\n // when the user touches the\n // canvas, then lifts their\n // finger.\n cnv.touchEnded(() => {\n let c = random(['red', 'yellow', 'blue', 'green']);\n background(c);\n });\n\n describe('A gray square changes color when the user touches the canvas, then lifts their finger.');\n}\n\n
    ", + "
    \n\n// Release touch within the image to\n// change the value of the rectangle\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe('50-by-50 black rect turns white with touch.');\n}\nfunction touchEnded() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction touchEnded() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\ndescribe('no image displayed');\n\n
    \n\n
    \n\n// returns a TouchEvent object\n// as a callback argument\nfunction touchEnded(event) {\n console.log(event);\n}\ndescribe('no image displayed');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the touch\nends.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + }, + { + "params": [ + { + "name": "event", + "description": "optional TouchEvent callback argument.", + "optional": 1, + "type": "TouchEvent" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "Events", + "submodule": "Touch" + }, + { + "name": "dragOver", + "file": "src/core/p5.Element.js", + "line": 1148, + "itemtype": "method", + "chainable": 1, + "description": "Calls a function when a file is dragged over the element. Calling\nmyElement.dragOver(false) disables the function.", + "example": [ + "
    \n\n// Drag a file over the canvas to test.\n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call helloFile() when a\n // file is dragged over\n // the canvas.\n cnv.dragOver(helloFile);\n\n describe('A gray square. The text \"hello, file\" appears when a file is dragged over the square.');\n}\n\nfunction helloFile() {\n text('hello, file', 50, 50);\n}\n\n
    \n\n
    \n\n// Drag a file over the canvas to test.\n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Say \"hello, file\" when a\n // file is dragged over\n // the canvas.\n cnv.dragOver(() => {\n text('hello, file', 50, 50);\n });\n\n describe('A gray square. The text \"hello, file\" appears when a file is dragged over the square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the file is\ndragged over the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "dragLeave", + "file": "src/core/p5.Element.js", + "line": 1213, + "itemtype": "method", + "chainable": 1, + "description": "Calls a function when a file is dragged off the element. Calling\nCalling myElement.dragLeave(false) disables the function.", + "example": [ + "
    \n\n// Drag a file over, then off\n// the canvas to test.\n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Call byeFile() when a\n // file is dragged over,\n // then off the canvas.\n cnv.dragLeave(byeFile);\n\n describe('A gray square. The text \"bye, file\" appears when a file is dragged over, then off the square.');\n}\n\nfunction byeFile() {\n text('bye, file', 50, 50);\n}\n\n
    \n\n
    \n\n// Drag a file over, then off\n// the canvas to test.\n\nfunction setup() {\n // Create a canvas element and\n // assign it to cnv.\n let cnv = createCanvas(100, 100);\n\n background(200);\n\n // Say \"bye, file\" when a\n // file is dragged over,\n // then off the canvas.\n cnv.dragLeave(() => {\n text('bye, file', 50, 50);\n });\n\n describe('A gray square. The text \"bye, file\" appears when a file is dragged over, then off the square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the file is\ndragged off the element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "calculateOffset", + "file": "src/core/p5.Renderer.js", + "line": 524, + "itemtype": "method", + "description": "Helper fxn to measure ascent and descent.\nAdapted from http://stackoverflow.com/a/25355178", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "log", + "file": "src/math/calculation.js", + "line": 314, + "itemtype": "method", + "description": "Calculates the natural logarithm (the base-e logarithm) of a number. This\nfunction expects the n parameter to be a value greater than 0.0.", + "example": [ + "
    \n\nfunction draw() {\n // Invert the y-axis.\n scale(1, -1);\n translate(0, -height);\n\n let x = frameCount;\n let y = 15 * log(x);\n point(x, y);\n\n describe('A series of black dots that get higher slowly from left to right.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number greater than 0.", + "type": "Number" + } + ], + "return": { + "description": "natural logarithm of n.", + "type": "Number" + } + } + ], + "return": { + "description": "natural logarithm of n.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "createCanvas", + "file": "src/core/rendering.js", + "line": 77, + "itemtype": "method", + "description": "

    Creates a canvas element in the document and sets its dimensions\nin pixels. This method should be called only once at the start of setup().\nCalling createCanvas more than once in a\nsketch will result in very unpredictable behavior. If you want more than\none drawing canvas you could use createGraphics()\n(hidden by default but it can be shown).

    \n

    Important note: in 2D mode (i.e. when p5.Renderer is not set) the origin (0,0)\nis positioned at the top left of the screen. In 3D mode (i.e. when p5.Renderer\nis set to WEBGL), the origin is positioned at the center of the canvas.\nSee this issue for more information.

    \n

    A WebGL canvas will use a WebGL2 context if it is supported by the browser.\nCheck the webglVersion property to check what\nversion is being used, or call setAttributes({ version: 1 })\nto create a WebGL1 context.

    \n

    The system variables width and height are set by the parameters passed to this\nfunction. If createCanvas() is not used, the\nwindow will be given a default size of 100Ɨ100 pixels.

    \n

    Optionally, an existing canvas can be passed using a selector, ie. document.getElementById('').\nIf specified, avoid using setAttributes() afterwards, as this will remove and recreate the existing canvas.

    \n

    For more ways to position the canvas, see the\n\npositioning the canvas wiki page.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 50);\n background(153);\n line(0, 0, width, height);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "w", + "description": "width of the canvas", + "type": "Number" + }, + { + "name": "h", + "description": "height of the canvas", + "type": "Number" + }, + { + "name": "renderer", + "description": "either P2D or WEBGL", + "optional": 1, + "type": "Constant" + }, + { + "name": "canvas", + "description": "existing html canvas element", + "optional": 1, + "type": "HTMLCanvasElement" + } + ], + "return": { + "description": "pointer to p5.Renderer holding canvas", + "type": "p5.Renderer" + } + }, + { + "params": [ + { + "name": "w", + "type": "Number" + }, + { + "name": "h", + "type": "Number" + }, + { + "name": "canvas", + "optional": 1, + "type": "HTMLCanvasElement" + } + ], + "return": { + "description": "pointer to p5.Renderer holding canvas", + "type": "p5.Renderer" + } + } + ], + "return": { + "description": "pointer to p5.Renderer holding canvas", + "type": "p5.Renderer" + }, + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "resizeCanvas", + "file": "src/core/rendering.js", + "line": 198, + "itemtype": "method", + "description": "Resizes the canvas to given width and height. The canvas will be cleared\nand draw will be called immediately, allowing the sketch to re-render itself\nin the resized canvas.", + "example": [ + "
    \nfunction setup() {\n createCanvas(windowWidth, windowHeight);\n}\n\nfunction draw() {\n background(0, 100, 200);\n}\n\nfunction windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}\n
    " + ], + "alt": "No image displayed.", + "overloads": [ + { + "params": [ + { + "name": "w", + "description": "width of the canvas", + "type": "Number" + }, + { + "name": "h", + "description": "height of the canvas", + "type": "Number" + }, + { + "name": "noRedraw", + "description": "don't redraw the canvas immediately", + "optional": 1, + "type": "Boolean" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "noCanvas", + "file": "src/core/rendering.js", + "line": 247, + "itemtype": "method", + "description": "Removes the default canvas for a p5 sketch that doesn't require a canvas", + "example": [ + "
    \n\nfunction setup() {\n noCanvas();\n}\n\n
    " + ], + "alt": "no image displayed", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "createGraphics", + "file": "src/core/rendering.js", + "line": 303, + "itemtype": "method", + "description": "

    Creates and returns a new p5.Graphics object. Use this class if you need\nto draw into an off-screen graphics buffer. The two parameters define the\nwidth and height in pixels.

    \n

    A WebGL p5.Graphics will use a WebGL2 context if it is supported by the browser.\nCheck the pg.webglVersion property of the renderer\nto check what version is being used, or call pg.setAttributes({ version: 1 })\nto create a WebGL1 context.

    \n

    Optionally, an existing canvas can be passed using a selector, ie. document.getElementById('').\nBy default this canvas will be hidden (offscreen buffer), to make visible, set element's style to display:block;

    \n", + "example": [ + "
    \n\nlet pg;\nfunction setup() {\n createCanvas(100, 100);\n pg = createGraphics(100, 100);\n}\n\nfunction draw() {\n background(200);\n pg.background(100);\n pg.noStroke();\n pg.ellipse(pg.width / 2, pg.height / 2, 50, 50);\n image(pg, 50, 50);\n image(pg, 0, 0, 50, 50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "w", + "description": "width of the offscreen graphics buffer", + "type": "Number" + }, + { + "name": "h", + "description": "height of the offscreen graphics buffer", + "type": "Number" + }, + { + "name": "renderer", + "description": "either P2D or WEBGL\nundefined defaults to p2d", + "optional": 1, + "type": "Constant" + }, + { + "name": "canvas", + "description": "existing html canvas element", + "optional": 1, + "type": "HTMLCanvasElement" + } + ], + "return": { + "description": "offscreen graphics buffer", + "type": "p5.Graphics" + } + }, + { + "params": [ + { + "name": "w", + "type": "Number" + }, + { + "name": "h", + "type": "Number" + }, + { + "name": "canvas", + "optional": 1, + "type": "HTMLCanvasElement" + } + ], + "return": { + "description": "offscreen graphics buffer", + "type": "p5.Graphics" + } + } + ], + "return": { + "description": "offscreen graphics buffer", + "type": "p5.Graphics" + }, + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "createFramebuffer", + "file": "src/core/rendering.js", + "line": 387, + "itemtype": "method", + "description": "

    Creates and returns a new p5.Framebuffer, a\nhigh-performance WebGL object that you can draw to and then use as a texture.

    \n

    Options can include:

    \n
    • format: The data format of the texture, either UNSIGNED_BYTE, FLOAT, or HALF_FLOAT. The default is UNSIGNED_BYTE.
    • channels: What color channels to store, either RGB or RGBA. The default is to match the channels in the main canvas (with alpha unless disabled with setAttributes.)
    • depth: A boolean, whether or not to include a depth buffer. Defaults to true.
    • depthFormat: The data format for depth information, either UNSIGNED_INT or FLOAT. The default is FLOAT if available, or UNSIGNED_INT otherwise.
    • stencil: A boolean, whether or not to include a stencil buffer, which can be used for masking. This may only be used if also using a depth buffer. Defaults to the value of depth, which is true if not provided.
    • antialias: Boolean or Number, whether or not to render with antialiased edges, and if so, optionally the number of samples to use. Defaults to whether or not the main canvas is antialiased, using a default of 2 samples if so. Antialiasing is only supported when WebGL 2 is available.
    • width: The width of the texture. Defaults to matching the main canvas.
    • height: The height of the texture. Defaults to matching the main canvas.
    • density: The pixel density of the texture. Defaults to the pixel density of the main canvas.
    • textureFiltering: Either LINEAR (nearby pixels will be interpolated when reading values from the color texture) or NEAREST (no interpolation.) Generally, use LINEAR when using the texture as an image, and use NEAREST if reading the texture as data. Defaults to LINEAR.

    If width, height, or density are specified, then the framebuffer will\nkeep that size until manually changed. Otherwise, it will be autosized, and\nit will update to match the main canvas's size and density when the main\ncanvas changes.

    \n", + "example": [ + "
    \n\nlet prev, next;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n prev = createFramebuffer({ format: FLOAT });\n next = createFramebuffer({ format: FLOAT });\n noStroke();\n}\n\nfunction draw() {\n // Swap prev and next so that we can use the previous\n // frame as a texture when drawing the current frame\n [prev, next] = [next, prev];\n\n // Draw to the framebuffer\n next.begin();\n background(255);\n\n push();\n tint(255, 253);\n image(prev, -width/2, -height/2);\n // Make sure the image plane doesn't block you from seeing any part\n // of the scene\n clearDepth();\n pop();\n\n push();\n normalMaterial();\n translate(25*sin(frameCount * 0.014), 25*sin(frameCount * 0.02), 0);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(12);\n pop();\n next.end();\n\n image(next, -width/2, -height/2);\n}\n\n
    " + ], + "alt": "A red, green, and blue box (using normalMaterial) moves and rotates around\nthe canvas, leaving a trail behind it that slowly grows and fades away.", + "overloads": [ + { + "params": [ + { + "name": "options", + "description": "An optional object with configuration", + "optional": 1, + "type": "Object" + } + ], + "return": { + "description": "", + "type": "p5.Framebuffer" + } + } + ], + "return": { + "description": "", + "type": "p5.Framebuffer" + }, + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "clearDepth", + "file": "src/core/rendering.js", + "line": 456, + "itemtype": "method", + "description": "

    This makes the canvas forget how far from the camera everything that has\nbeen drawn was. Use this if you want to make sure the next thing you draw\nwill not draw behind anything that is already on the canvas.

    \n

    This is useful for things like feedback effects, where you want the previous\nframe to act like a background for the next frame, and not like a plane in\n3D space in the scene.

    \n

    This method is only available in WebGL mode. Since 2D mode does not have\n3D depth, anything you draw will always go on top of the previous content on\nthe canvas anyway.

    \n", + "example": [ + "
    \n\nlet prev, next;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n prev = createFramebuffer({ format: FLOAT });\n next = createFramebuffer({ format: FLOAT });\n noStroke();\n}\n\nfunction draw() {\n // Swap prev and next so that we can use the previous\n // frame as a texture when drawing the current frame\n [prev, next] = [next, prev];\n\n // Draw to the framebuffer\n next.begin();\n background(255);\n\n push();\n tint(255, 253);\n image(prev, -width/2, -height/2);\n // Make sure the image plane doesn't block you from seeing any part\n // of the scene\n clearDepth();\n pop();\n\n push();\n normalMaterial();\n translate(25*sin(frameCount * 0.014), 25*sin(frameCount * 0.02), 0);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(12);\n pop();\n next.end();\n\n image(next, -width/2, -height/2);\n}\n\n
    " + ], + "alt": "A red, green, and blue box (using normalMaterial) moves and rotates around\nthe canvas, leaving a trail behind it that slowly grows and fades away.", + "overloads": [ + { + "params": [ + { + "name": "depth", + "description": "The value, between 0 and 1, to reset the depth to, where\n0 corresponds to a value as close as possible to the camera before getting\nclipped, and 1 corresponds to a value as far away from the camera as possible.\nThe default value is 1.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "blendMode", + "file": "src/core/rendering.js", + "line": 533, + "itemtype": "method", + "description": "

    Blends the pixels in the display window according to the defined mode.\nThere is a choice of the following modes to blend the source pixels (A)\nwith the ones of pixels already in the display window (B):

    \n
      \n
    • BLEND - linear interpolation of colours: C =\nA*factor + B. This is the default blending mode.
    • \n
    • ADD - sum of A and B
    • \n
    • DARKEST - only the darkest colour succeeds: C =\nmin(A*factor, B).
    • \n
    • LIGHTEST - only the lightest colour succeeds: C =\nmax(A*factor, B).
    • \n
    • DIFFERENCE - subtract colors from underlying image.\n(2D)
    • \n
    • EXCLUSION - similar to DIFFERENCE, but less\nextreme.
    • \n
    • MULTIPLY - multiply the colors, result will always be\ndarker.
    • \n
    • SCREEN - opposite multiply, uses inverse values of the\ncolors.
    • \n
    • REPLACE - the pixels entirely replace the others and\ndon't utilize alpha (transparency) values.
    • \n
    • REMOVE - removes pixels from B with the alpha strength of A.
    • \n
    • OVERLAY - mix of MULTIPLY and SCREEN\n. Multiplies dark values, and screens light values. (2D)
    • \n
    • HARD_LIGHT - SCREEN when greater than 50%\ngray, MULTIPLY when lower. (2D)
    • \n
    • SOFT_LIGHT - mix of DARKEST and\nLIGHTEST. Works like OVERLAY, but not as harsh. (2D)\n
    • \n
    • DODGE - lightens light tones and increases contrast,\nignores darks. (2D)
    • \n
    • BURN - darker areas are applied, increasing contrast,\nignores lights. (2D)
    • \n
    • SUBTRACT - remainder of A and B (3D)
    • \n

    (2D) indicates that this blend mode only works in the 2D renderer.
    \n(3D) indicates that this blend mode only works in the WEBGL renderer.

    \n", + "example": [ + "
    \n\nblendMode(LIGHTEST);\nstrokeWeight(30);\nstroke(80, 150, 255);\nline(25, 25, 75, 75);\nstroke(255, 50, 50);\nline(75, 25, 25, 75);\n\n
    \n\n
    \n\nblendMode(MULTIPLY);\nstrokeWeight(30);\nstroke(80, 150, 255);\nline(25, 25, 75, 75);\nstroke(255, 50, 50);\nline(75, 25, 25, 75);\n\n
    " + ], + "alt": "translucent image thick red & blue diagonal rounded lines intersecting center\nThick red & blue diagonal rounded lines intersecting center. dark at overlap", + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "blend mode to set for canvas.\neither BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY,\nEXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\nSOFT_LIGHT, DODGE, BURN, ADD, REMOVE or SUBTRACT", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "arc", + "file": "src/core/shape/2d_primitives.js", + "line": 172, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws an arc to the canvas. Arcs are drawn along the outer edge of an ellipse\n(oval) defined by the x, y, w, and h parameters. Use the start and stop\nparameters to specify the angles (in radians) at which to draw the arc. Arcs are\nalways drawn clockwise from start to stop. The origin of the arc's ellipse may\nbe changed with the ellipseMode() function.

    \n

    The optional mode parameter determines the arc's fill style. The fill modes are\na semi-circle (OPEN), a closed semi-circle (CHORD), or a closed pie segment (PIE).

    \n", + "example": [ + "
    \n\narc(50, 55, 50, 50, 0, HALF_PI);\nnoFill();\narc(50, 55, 60, 60, HALF_PI, PI);\narc(50, 55, 70, 70, PI, PI + QUARTER_PI);\narc(50, 55, 80, 80, PI + QUARTER_PI, TWO_PI);\ndescribe(\n 'A shattered outline of an ellipse with a quarter of a white circle at the bottom-right.'\n);\n\n
    \n\n
    \n\narc(50, 50, 80, 80, 0, PI + QUARTER_PI);\ndescribe('A white ellipse with the top-right third missing. The bottom is outlined in black.');\n\n
    \n\n
    \n\narc(50, 50, 80, 80, 0, PI + QUARTER_PI, OPEN);\ndescribe(\n 'A white ellipse missing a section from the top-right. The bottom is outlined in black.'\n);\n\n
    \n\n
    \n\narc(50, 50, 80, 80, 0, PI + QUARTER_PI, CHORD);\ndescribe('A white ellipse with a black outline missing a section from the top-right.');\n\n
    \n\n
    \n\narc(50, 50, 80, 80, 0, PI + QUARTER_PI, PIE);\ndescribe('A white ellipse with a black outline. The top-right third is missing.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the arc's ellipse.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the arc's ellipse.", + "type": "Number" + }, + { + "name": "w", + "description": "width of the arc's ellipse by default.", + "type": "Number" + }, + { + "name": "h", + "description": "height of the arc's ellipse by default.", + "type": "Number" + }, + { + "name": "start", + "description": "angle to start the arc, specified in radians.", + "type": "Number" + }, + { + "name": "stop", + "description": "angle to stop the arc, specified in radians.", + "type": "Number" + }, + { + "name": "mode", + "description": "optional parameter to determine the way of drawing\nthe arc. either CHORD, PIE, or OPEN.", + "optional": 1, + "type": "Constant" + }, + { + "name": "detail", + "description": "optional parameter for WebGL mode only. This is to\nspecify the number of vertices that makes up the\nperimeter of the arc. Default value is 25. Won't\ndraw a stroke for a detail of more than 50.", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "ellipse", + "file": "src/core/shape/2d_primitives.js", + "line": 269, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws an ellipse (oval) to the canvas. An ellipse with equal width and height\nis a circle. By default, the first two parameters set the location of the\ncenter of the ellipse. The third and fourth parameters set the shape's width\nand height, respectively. The origin may be changed with the\nellipseMode() function.

    \n

    If no height is specified, the value of width is used for both the width and\nheight. If a negative height or width is specified, the absolute value is\ntaken.

    \n", + "example": [ + "
    \n\nellipse(56, 46, 55, 55);\ndescribe('A white ellipse with black outline in middle of a gray canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the center of the ellipse.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the center of the ellipse.", + "type": "Number" + }, + { + "name": "w", + "description": "width of the ellipse.", + "type": "Number" + }, + { + "name": "h", + "description": "height of the ellipse.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "w", + "type": "Number" + }, + { + "name": "h", + "type": "Number" + }, + { + "name": "detail", + "description": "optional parameter for WebGL mode only. This is to\nspecify the number of vertices that makes up the\nperimeter of the ellipse. Default value is 25. Won't\ndraw a stroke for a detail of more than 50.", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "circle", + "file": "src/core/shape/2d_primitives.js", + "line": 295, + "itemtype": "method", + "chainable": 1, + "description": "Draws a circle to the canvas. A circle is a round shape. Every point on the\nedge of a circle is the same distance from its center. By default, the first\ntwo parameters set the location of the center of the circle. The third\nparameter sets the shape's width and height (diameter). The origin may be\nchanged with the ellipseMode() function.", + "example": [ + "
    \n\ncircle(30, 30, 20);\ndescribe('A white circle with black outline in the middle of a gray canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the center of the circle.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the center of the circle.", + "type": "Number" + }, + { + "name": "d", + "description": "diameter of the circle.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "line", + "file": "src/core/shape/2d_primitives.js", + "line": 401, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws a line, a straight path between two points. Its default width is one pixel.\nThe version of line() with four parameters draws the line in 2D. To color a line,\nuse the stroke() function. To change its width, use the\nstrokeWeight() function. A line\ncan't be filled, so the fill() function won't affect\nthe color of a line.

    \n

    The version of line() with six parameters allows the line to be drawn in 3D\nspace. Doing so requires adding the WEBGL argument to\ncreateCanvas().

    \n", + "example": [ + "
    \n\nline(30, 20, 85, 75);\ndescribe(\n 'A black line on a gray canvas running from top-center to bottom-right.'\n);\n\n
    \n\n
    \n\nline(30, 20, 85, 20);\nstroke(126);\nline(85, 20, 85, 75);\nstroke(255);\nline(85, 75, 30, 75);\ndescribe(\n 'Three lines drawn in grayscale on a gray canvas. They form the top, right, and bottom sides of a square.'\n);\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('A black line drawn on a gray canvas.');\n}\n\nfunction draw() {\n background(220);\n line(0, 0, 0, 10, 10, 0);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "the x-coordinate of the first point.", + "type": "Number" + }, + { + "name": "y1", + "description": "the y-coordinate of the first point.", + "type": "Number" + }, + { + "name": "x2", + "description": "the x-coordinate of the second point.", + "type": "Number" + }, + { + "name": "y2", + "description": "the y-coordinate of the second point.", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x1", + "type": "Number" + }, + { + "name": "y1", + "type": "Number" + }, + { + "name": "z1", + "description": "the z-coordinate of the first point.", + "type": "Number" + }, + { + "name": "x2", + "type": "Number" + }, + { + "name": "y2", + "type": "Number" + }, + { + "name": "z2", + "description": "the z-coordinate of the second point.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "point", + "file": "src/core/shape/2d_primitives.js", + "line": 484, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws a point, a single coordinate in space. Its default size is one pixel. The first two\nparameters are the point's x- and y-coordinates, respectively. To color a point, use\nthe stroke() function. To change its size, use the\nstrokeWeight() function.

    \n

    The version of point() with three parameters allows the point to be drawn in 3D\nspace. Doing so requires adding the WEBGL argument to\ncreateCanvas().

    \n

    The version of point() with one parameter allows the point's location to be set with\na p5.Vector object.

    \n", + "example": [ + "
    \n\npoint(30, 20);\npoint(85, 20);\npoint(85, 75);\npoint(30, 75);\ndescribe(\n 'Four small, black points drawn on a gray canvas. The points form the corners of a square.'\n);\n\n
    \n\n
    \n\npoint(30, 20);\npoint(85, 20);\nstroke('purple');\nstrokeWeight(10);\npoint(85, 75);\npoint(30, 75);\ndescribe(\n 'Four points drawn on a gray canvas. Two are black and two are purple. The points form the corners of a square.'\n);\n\n
    \n\n
    \n\nlet a = createVector(10, 10);\npoint(a);\nlet b = createVector(10, 20);\npoint(b);\nlet c = createVector(20, 10);\npoint(c);\nlet d = createVector(20, 20);\npoint(d);\ndescribe(\n 'Four small, black points drawn on a gray canvas. The points form the corners of a square.'\n);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "the x-coordinate.", + "type": "Number" + }, + { + "name": "y", + "description": "the y-coordinate.", + "type": "Number" + }, + { + "name": "z", + "description": "the z-coordinate (for WebGL mode).", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "coordinateVector", + "description": "the coordinate vector.", + "type": "p5.Vector" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "quad", + "file": "src/core/shape/2d_primitives.js", + "line": 578, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws a quad to the canvas. A quad is a quadrilateral, a four-sided\npolygon. Some examples of quads include rectangles, squares, rhombuses,\nand trapezoids. The first pair of parameters (x1,y1) sets the quad's\nfirst point. The following pairs of parameters set the coordinates for\nits next three points. Parameters should proceed clockwise or\ncounter-clockwise around the shape.

    \n

    The version of quad() with twelve parameters allows the quad to be drawn\nin 3D space. Doing so requires adding the WEBGL argument to\ncreateCanvas().

    \n", + "example": [ + "
    \n\nquad(20, 20, 80, 20, 80, 80, 20, 80);\ndescribe('A white square with a black outline drawn on a gray canvas.');\n\n
    \n\n
    \n\nquad(20, 30, 80, 30, 80, 70, 20, 70);\ndescribe('A white rectangle with a black outline drawn on a gray canvas.');\n\n
    \n\n
    \n\nquad(50, 62, 86, 50, 50, 38, 14, 50);\ndescribe('A white rhombus with a black outline drawn on a gray canvas.');\n\n
    \n\n
    \n\nquad(20, 50, 80, 30, 80, 70, 20, 70);\ndescribe('A white trapezoid with a black outline drawn on a gray canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "the x-coordinate of the first point.", + "type": "Number" + }, + { + "name": "y1", + "description": "the y-coordinate of the first point.", + "type": "Number" + }, + { + "name": "x2", + "description": "the x-coordinate of the second point.", + "type": "Number" + }, + { + "name": "y2", + "description": "the y-coordinate of the second point.", + "type": "Number" + }, + { + "name": "x3", + "description": "the x-coordinate of the third point.", + "type": "Number" + }, + { + "name": "y3", + "description": "the y-coordinate of the third point.", + "type": "Number" + }, + { + "name": "x4", + "description": "the x-coordinate of the fourth point.", + "type": "Number" + }, + { + "name": "y4", + "description": "the y-coordinate of the fourth point.", + "type": "Number" + }, + { + "name": "detailX", + "description": "number of segments in the x-direction.", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "number of segments in the y-direction.", + "optional": 1, + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "x1", + "type": "Number" + }, + { + "name": "y1", + "type": "Number" + }, + { + "name": "z1", + "description": "the z-coordinate of the first point.", + "type": "Number" + }, + { + "name": "x2", + "type": "Number" + }, + { + "name": "y2", + "type": "Number" + }, + { + "name": "z2", + "description": "the z-coordinate of the second point.", + "type": "Number" + }, + { + "name": "x3", + "type": "Number" + }, + { + "name": "y3", + "type": "Number" + }, + { + "name": "z3", + "description": "the z-coordinate of the third point.", + "type": "Number" + }, + { + "name": "x4", + "type": "Number" + }, + { + "name": "y4", + "type": "Number" + }, + { + "name": "z4", + "description": "the z-coordinate of the fourth point.", + "type": "Number" + }, + { + "name": "detailX", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "rect", + "file": "src/core/shape/2d_primitives.js", + "line": 666, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws a rectangle to the canvas. A rectangle is a four-sided polygon with\nevery angle at ninety degrees. By default, the first two parameters set the\nlocation of the rectangle's upper-left corner. The third and fourth set the\nshape's the width and height, respectively. The way these parameters are\ninterpreted may be changed with the rectMode()\nfunction.

    \n

    The version of rect() with five parameters creates a rounded rectangle. The\nfifth parameter is used as the radius value for all four corners.

    \n

    The version of rect() with eight parameters also creates a rounded rectangle.\nWhen using eight parameters, the latter four set the radius of the arc at\neach corner separately. The radii start with the top-left corner and move\nclockwise around the rectangle. If any of these parameters are omitted, they\nare set to the value of the last specified corner radius.

    \n", + "example": [ + "
    \n\nrect(30, 20, 55, 55);\ndescribe('A white rectangle with a black outline on a gray canvas.');\n\n
    \n\n
    \n\nrect(30, 20, 55, 55, 20);\ndescribe(\n 'A white rectangle with a black outline and round edges on a gray canvas.'\n);\n\n
    \n\n
    \n\nrect(30, 20, 55, 55, 20, 15, 10, 5);\ndescribe('A white rectangle with a black outline and round edges of different radii.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the rectangle.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the rectangle.", + "type": "Number" + }, + { + "name": "w", + "description": "width of the rectangle.", + "type": "Number" + }, + { + "name": "h", + "description": "height of the rectangle.", + "optional": 1, + "type": "Number" + }, + { + "name": "tl", + "description": "optional radius of top-left corner.", + "optional": 1, + "type": "Number" + }, + { + "name": "tr", + "description": "optional radius of top-right corner.", + "optional": 1, + "type": "Number" + }, + { + "name": "br", + "description": "optional radius of bottom-right corner.", + "optional": 1, + "type": "Number" + }, + { + "name": "bl", + "description": "optional radius of bottom-left corner.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "w", + "type": "Number" + }, + { + "name": "h", + "type": "Number" + }, + { + "name": "detailX", + "description": "number of segments in the x-direction (for WebGL mode).", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "number of segments in the y-direction (for WebGL mode).", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "square", + "file": "src/core/shape/2d_primitives.js", + "line": 721, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws a square to the canvas. A square is a four-sided polygon with every\nangle at ninety degrees and equal side lengths. By default, the first two\nparameters set the location of the square's upper-left corner. The third\nparameter sets its side size. The way these parameters are interpreted may\nbe changed with the rectMode() function.

    \n

    The version of square() with four parameters creates a rounded square. The\nfourth parameter is used as the radius value for all four corners.

    \n

    The version of square() with seven parameters also creates a rounded square.\nWhen using seven parameters, the latter four set the radius of the arc at\neach corner separately. The radii start with the top-left corner and move\nclockwise around the square. If any of these parameters are omitted, they\nare set to the value of the last specified corner radius.

    \n", + "example": [ + "
    \n\nsquare(30, 20, 55);\ndescribe('A white square with a black outline in on a gray canvas.');\n\n
    \n\n
    \n\nsquare(30, 20, 55, 20);\ndescribe(\n 'A white square with a black outline and round edges on a gray canvas.'\n);\n\n
    \n\n
    \n\nsquare(30, 20, 55, 20, 15, 10, 5);\ndescribe('A white square with a black outline and round edges of different radii.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the square.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the square.", + "type": "Number" + }, + { + "name": "s", + "description": "side size of the square.", + "type": "Number" + }, + { + "name": "tl", + "description": "optional radius of top-left corner.", + "optional": 1, + "type": "Number" + }, + { + "name": "tr", + "description": "optional radius of top-right corner.", + "optional": 1, + "type": "Number" + }, + { + "name": "br", + "description": "optional radius of bottom-right corner.", + "optional": 1, + "type": "Number" + }, + { + "name": "bl", + "description": "optional radius of bottom-left corner.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "triangle", + "file": "src/core/shape/2d_primitives.js", + "line": 782, + "itemtype": "method", + "chainable": 1, + "description": "Draws a triangle to the canvas. A triangle is a three-sided polygon. The\nfirst two parameters specify the triangle's first point (x1,y1). The middle\ntwo parameters specify its second point (x2,y2). And the last two parameters\nspecify its third point (x3, y3).", + "example": [ + "
    \n\ntriangle(30, 75, 58, 20, 86, 75);\ndescribe('A white triangle with a black outline on a gray canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "x-coordinate of the first point.", + "type": "Number" + }, + { + "name": "y1", + "description": "y-coordinate of the first point.", + "type": "Number" + }, + { + "name": "x2", + "description": "x-coordinate of the second point.", + "type": "Number" + }, + { + "name": "y2", + "description": "y-coordinate of the second point.", + "type": "Number" + }, + { + "name": "x3", + "description": "x-coordinate of the third point.", + "type": "Number" + }, + { + "name": "y3", + "description": "y-coordinate of the third point.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "2D Primitives" + }, + { + "name": "ellipseMode", + "file": "src/core/shape/attributes.js", + "line": 60, + "itemtype": "method", + "chainable": 1, + "description": "

    Modifies the location from which ellipses, circles, and arcs are drawn. By default, the\nfirst two parameters are the x- and y-coordinates of the shape's center. The next\nparameters are its width and height. This is equivalent to calling ellipseMode(CENTER).

    \n

    ellipseMode(RADIUS) also uses the first two parameters to set the x- and y-coordinates\nof the shape's center. The next parameters are half of the shapes's width and height.\nCalling ellipse(0, 0, 10, 15) draws a shape with a width of 20 and height of 30.

    \n

    ellipseMode(CORNER) uses the first two parameters as the upper-left corner of the\nshape. The next parameters are its width and height.

    \n

    ellipseMode(CORNERS) uses the first two parameters as the location of one corner\nof the ellipse's bounding box. The third and fourth parameters are the location of the\nopposite corner.

    \n

    The argument passed to ellipseMode() must be written in ALL CAPS because the constants\nCENTER, RADIUS, CORNER, and CORNERS are defined this way. JavaScript is a\ncase-sensitive language.

    \n", + "example": [ + "
    \n\nellipseMode(RADIUS);\nfill(255);\nellipse(50, 50, 30, 30);\nellipseMode(CENTER);\nfill(100);\nellipse(50, 50, 30, 30);\ndescribe('A white circle with a gray circle at its center. Both circles have black outlines.');\n\n
    \n\n
    \n\nellipseMode(CORNER);\nfill(255);\nellipse(25, 25, 50, 50);\nellipseMode(CORNERS);\nfill(100);\nellipse(25, 25, 50, 50);\ndescribe('A white circle with a gray circle at its top-left corner. Both circles have black outlines.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "either CENTER, RADIUS, CORNER, or CORNERS", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Attributes" + }, + { + "name": "noSmooth", + "file": "src/core/shape/attributes.js", + "line": 97, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws all geometry with jagged (aliased) edges.

    \n

    smooth() is active by default in 2D mode. It's necessary to call\nnoSmooth() to disable smoothing of geometry, images, and fonts.

    \n

    In WebGL mode, noSmooth() is active by default. It's necessary\nto call smooth() to draw smooth (antialiased) edges.

    \n", + "example": [ + "
    \n\nbackground(0);\nnoStroke();\nsmooth();\nellipse(30, 48, 36, 36);\nnoSmooth();\nellipse(70, 48, 36, 36);\ndescribe('Two pixelated white circles on a black background.');\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Attributes" + }, + { + "name": "rectMode", + "file": "src/core/shape/attributes.js", + "line": 161, + "itemtype": "method", + "chainable": 1, + "description": "

    Modifies the location from which rectangles and squares are drawn. By default,\nthe first two parameters are the x- and y-coordinates of the shape's upper-left\ncorner. The next parameters are its width and height. This is equivalent to\ncalling rectMode(CORNER).

    \n

    rectMode(CORNERS) also uses the first two parameters as the location of one of\nthe corners. The third and fourth parameters are the location of the opposite\ncorner.

    \n

    rectMode(CENTER) uses the first two parameters as the x- and y-coordinates of\nthe shape's center. The next parameters are its width and height.

    \n

    rectMode(RADIUS) also uses the first two parameters as the x- and y-coordinates\nof the shape's center. The next parameters are half of the shape's width and\nheight.

    \n

    The argument passed to rectMode() must be written in ALL CAPS because the\nconstants CENTER, RADIUS, CORNER, and CORNERS are defined this way.\nJavaScript is a case-sensitive language.

    \n", + "example": [ + "
    \n\nrectMode(CORNER);\nfill(255);\nrect(25, 25, 50, 50);\n\nrectMode(CORNERS);\nfill(100);\nrect(25, 25, 50, 50);\n\ndescribe('A small gray square drawn at the top-left corner of a white square.');\n\n
    \n\n
    \n\nrectMode(RADIUS);\nfill(255);\nrect(50, 50, 30, 30);\n\nrectMode(CENTER);\nfill(100);\nrect(50, 50, 30, 30);\n\ndescribe('A small gray square drawn at the center of a white square.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "either CORNER, CORNERS, CENTER, or RADIUS", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Attributes" + }, + { + "name": "smooth", + "file": "src/core/shape/attributes.js", + "line": 199, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws all geometry with smooth (anti-aliased) edges. smooth() will also\nimprove image quality of resized images.

    \n

    smooth() is active by default in 2D mode. It's necessary to call\nnoSmooth() to disable smoothing of geometry, images, and fonts.

    \n

    In WebGL mode, noSmooth() is active by default. It's necessary\nto call smooth() to draw smooth (antialiased) edges.

    \n", + "example": [ + "
    \n\nbackground(0);\nnoStroke();\nsmooth();\nellipse(30, 48, 36, 36);\nnoSmooth();\nellipse(70, 48, 36, 36);\ndescribe('Two pixelated white circles on a black background.');\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Attributes" + }, + { + "name": "strokeCap", + "file": "src/core/shape/attributes.js", + "line": 235, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the style for rendering line endings. These ends are either rounded\n(ROUND), squared (SQUARE), or extended (PROJECT). The default cap is\nROUND.

    \n

    The argument passed to strokeCap() must be written in ALL CAPS because\nthe constants ROUND, SQUARE, and PROJECT are defined this way.\nJavaScript is a case-sensitive language.

    \n", + "example": [ + "
    \n\nstrokeWeight(12.0);\nstrokeCap(ROUND);\nline(20, 30, 80, 30);\nstrokeCap(SQUARE);\nline(20, 50, 80, 50);\nstrokeCap(PROJECT);\nline(20, 70, 80, 70);\ndescribe('Three horizontal lines. The top line has rounded ends, the middle line has squared ends, and the bottom line has longer, squared ends.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "cap", + "description": "either ROUND, SQUARE, or PROJECT", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Attributes" + }, + { + "name": "strokeJoin", + "file": "src/core/shape/attributes.js", + "line": 302, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the style of the joints which connect line segments. These joints are\neither mitered (MITER), beveled (BEVEL), or rounded (ROUND). The default\njoint is MITER in 2D mode and ROUND in WebGL mode.

    \n

    The argument passed to strokeJoin() must be written in ALL CAPS because\nthe constants MITER, BEVEL, and ROUND are defined this way.\nJavaScript is a case-sensitive language.

    \n", + "example": [ + "
    \n\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(MITER);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\ndescribe('A right-facing arrowhead shape with a pointed tip in center of canvas.');\n\n
    \n\n
    \n\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(BEVEL);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\ndescribe('A right-facing arrowhead shape with a flat tip in center of canvas.');\n\n
    \n\n
    \n\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(ROUND);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\ndescribe('A right-facing arrowhead shape with a rounded tip in center of canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "join", + "description": "either MITER, BEVEL, or ROUND", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Attributes" + }, + { + "name": "strokeWeight", + "file": "src/core/shape/attributes.js", + "line": 351, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the width of the stroke used for lines, points, and the border around\nshapes. All widths are set in units of pixels.

    \n

    Note that strokeWeight() is affected by any transformation or scaling that\nhas been applied previously.

    \n", + "example": [ + "
    \n\n// Default.\nline(20, 20, 80, 20);\n// Thicker.\nstrokeWeight(4);\nline(20, 40, 80, 40);\n// Beastly.\nstrokeWeight(10);\nline(20, 70, 80, 70);\ndescribe('Three horizontal black lines. The top line is thin, the middle is medium, and the bottom is thick.');\n\n
    \n\n
    \n\n// Default.\nline(20, 20, 80, 20);\n// Adding scale transformation.\nscale(5);\n// Coordinates adjusted for scaling.\nline(4, 8, 16, 8);\ndescribe('Two horizontal black lines. The top line is thin and the bottom is five times thicker than the top.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "weight", + "description": "the weight of the stroke (in pixels).", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Attributes" + }, + { + "name": "bezier", + "file": "src/core/shape/curves.js", + "line": 78, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws a cubic Bezier curve on the screen. These curves are defined by a\nseries of anchor and control points. The first two parameters specify\nthe first anchor point and the last two parameters specify the other\nanchor point, which become the first and last points on the curve. The\nmiddle parameters specify the two control points which define the shape\nof the curve. Approximately speaking, control points \"pull\" the curve\ntowards them.

    \n

    Bezier curves were developed by French automotive engineer Pierre Bezier,\nand are commonly used in computer graphics to define gently sloping curves.\nSee also curve().

    \n", + "example": [ + "
    \n\nnoFill();\nstroke(255, 102, 0);\nline(85, 20, 10, 10);\nline(90, 90, 15, 80);\nstroke(0, 0, 0);\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\n\n
    \n\n
    \n\nbackground(0, 0, 0);\nnoFill();\nstroke(255);\nbezier(250, 250, 0, 100, 100, 0, 100, 0, 0, 0, 100, 0);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "x-coordinate for the first anchor point", + "type": "Number" + }, + { + "name": "y1", + "description": "y-coordinate for the first anchor point", + "type": "Number" + }, + { + "name": "x2", + "description": "x-coordinate for the first control point", + "type": "Number" + }, + { + "name": "y2", + "description": "y-coordinate for the first control point", + "type": "Number" + }, + { + "name": "x3", + "description": "x-coordinate for the second control point", + "type": "Number" + }, + { + "name": "y3", + "description": "y-coordinate for the second control point", + "type": "Number" + }, + { + "name": "x4", + "description": "x-coordinate for the second anchor point", + "type": "Number" + }, + { + "name": "y4", + "description": "y-coordinate for the second anchor point", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x1", + "type": "Number" + }, + { + "name": "y1", + "type": "Number" + }, + { + "name": "z1", + "description": "z-coordinate for the first anchor point", + "type": "Number" + }, + { + "name": "x2", + "type": "Number" + }, + { + "name": "y2", + "type": "Number" + }, + { + "name": "z2", + "description": "z-coordinate for the first control point", + "type": "Number" + }, + { + "name": "x3", + "type": "Number" + }, + { + "name": "y3", + "type": "Number" + }, + { + "name": "z3", + "description": "z-coordinate for the second control point", + "type": "Number" + }, + { + "name": "x4", + "type": "Number" + }, + { + "name": "y4", + "type": "Number" + }, + { + "name": "z4", + "description": "z-coordinate for the second anchor point", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "bezierDetail", + "file": "src/core/shape/curves.js", + "line": 125, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the resolution at which Bezier's curve is displayed. The default value is 20.

    \n

    Note, This function is only useful when using the WEBGL renderer\nas the default canvas renderer does not use this information.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noFill();\n bezierDetail(5);\n}\n\nfunction draw() {\n background(200);\n bezier(\n -40, -40, 0,\n 90, -40, 0,\n -90, 40, 0,\n 40, 40, 0\n );\n}\n\n
    " + ], + "alt": "stretched black s-shape with a low level of bezier detail", + "overloads": [ + { + "params": [ + { + "name": "detail", + "description": "resolution of the curves", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "bezierPoint", + "file": "src/core/shape/curves.js", + "line": 174, + "itemtype": "method", + "description": "Given the x or y co-ordinate values of control and anchor points of a bezier\ncurve, it evaluates the x or y coordinate of the bezier at position t. The\nparameters a and d are the x or y coordinates of first and last points on the\ncurve while b and c are of the control points.The final parameter t is the\nposition of the resultant point which is given between 0 and 1.\nThis can be done once with the x coordinates and a second time\nwith the y coordinates to get the location of a bezier curve at t.", + "example": [ + "
    \n\nnoFill();\nlet x1 = 85,\nx2 = 10,\nx3 = 90,\nx4 = 15;\nlet y1 = 20,\ny2 = 10,\ny3 = 90,\ny4 = 80;\nbezier(x1, y1, x2, y2, x3, y3, x4, y4);\nfill(255);\nlet steps = 10;\nfor (let i = 0; i <= steps; i++) {\n let t = i / steps;\n let x = bezierPoint(x1, x2, x3, x4, t);\n let y = bezierPoint(y1, y2, y3, y4, t);\n circle(x, y, 5);\n}\n\n
    " + ], + "alt": "10 points plotted on a given bezier at equal distances.", + "overloads": [ + { + "params": [ + { + "name": "a", + "description": "coordinate of first point on the curve", + "type": "Number" + }, + { + "name": "b", + "description": "coordinate of first control point", + "type": "Number" + }, + { + "name": "c", + "description": "coordinate of second control point", + "type": "Number" + }, + { + "name": "d", + "description": "coordinate of second point on the curve", + "type": "Number" + }, + { + "name": "t", + "description": "value between 0 and 1", + "type": "Number" + } + ], + "return": { + "description": "the value of the Bezier at position t", + "type": "Number" + } + } + ], + "return": { + "description": "the value of the Bezier at position t", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "bezierTangent", + "file": "src/core/shape/curves.js", + "line": 251, + "itemtype": "method", + "description": "Evaluates the tangent to the Bezier at position t for points a, b, c, d.\nThe parameters a and d are the first and last points\non the curve, and b and c are the control points.\nThe final parameter t varies between 0 and 1.", + "example": [ + "
    \n\nnoFill();\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\nlet steps = 6;\nfill(255);\nfor (let i = 0; i <= steps; i++) {\n let t = i / steps;\n // Get the location of the point\n let x = bezierPoint(85, 10, 90, 15, t);\n let y = bezierPoint(20, 10, 90, 80, t);\n // Get the tangent points\n let tx = bezierTangent(85, 10, 90, 15, t);\n let ty = bezierTangent(20, 10, 90, 80, t);\n // Calculate an angle from the tangent points\n let a = atan2(ty, tx);\n a += PI;\n stroke(255, 102, 0);\n line(x, y, cos(a) * 30 + x, sin(a) * 30 + y);\n // The following line of code makes a line\n // inverse of the above line\n //line(x, y, cos(a)*-30 + x, sin(a)*-30 + y);\n stroke(0);\n ellipse(x, y, 5, 5);\n}\n\n
    \n\n
    \n\nnoFill();\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\nstroke(255, 102, 0);\nlet steps = 16;\nfor (let i = 0; i <= steps; i++) {\n let t = i / steps;\n let x = bezierPoint(85, 10, 90, 15, t);\n let y = bezierPoint(20, 10, 90, 80, t);\n let tx = bezierTangent(85, 10, 90, 15, t);\n let ty = bezierTangent(20, 10, 90, 80, t);\n let a = atan2(ty, tx);\n a -= HALF_PI;\n line(x, y, cos(a) * 8 + x, sin(a) * 8 + y);\n}\n\n
    " + ], + "alt": "s-shaped line with 6 short orange lines showing the tangents at those points.\ns-shaped line with 6 short orange lines showing lines coming out the underside of the bezier.", + "overloads": [ + { + "params": [ + { + "name": "a", + "description": "coordinate of first point on the curve", + "type": "Number" + }, + { + "name": "b", + "description": "coordinate of first control point", + "type": "Number" + }, + { + "name": "c", + "description": "coordinate of second control point", + "type": "Number" + }, + { + "name": "d", + "description": "coordinate of second point on the curve", + "type": "Number" + }, + { + "name": "t", + "description": "value between 0 and 1", + "type": "Number" + } + ], + "return": { + "description": "the tangent at position t", + "type": "Number" + } + } + ], + "return": { + "description": "the tangent at position t", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "curve", + "file": "src/core/shape/curves.js", + "line": 349, + "itemtype": "method", + "chainable": 1, + "description": "Draws a curved line on the screen between two points, given as the\nmiddle four parameters. The first two parameters are a control point, as\nif the curve came from this point even though it's not drawn. The last\ntwo parameters similarly describe the other control point.

    \nLonger curves can be created by putting a series of curve() functions\ntogether or using curveVertex(). An additional function called\ncurveTightness() provides control for the visual quality of the curve.\nThe curve() function is an implementation of Catmull-Rom splines.", + "example": [ + "
    \n\nnoFill();\nstroke(255, 102, 0);\ncurve(5, 26, 5, 26, 73, 24, 73, 61);\nstroke(0);\ncurve(5, 26, 73, 24, 73, 61, 15, 65);\nstroke(255, 102, 0);\ncurve(73, 24, 73, 61, 15, 65, 15, 65);\n\n
    \n\n
    \n\n// Define the curve points as JavaScript objects\nlet p1 = { x: 5, y: 26 };\nlet p2 = { x: 73, y: 24 };\nlet p3 = { x: 73, y: 61 };\nlet p4 = { x: 15, y: 65 };\nnoFill();\nstroke(255, 102, 0);\ncurve(p1.x, p1.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);\nstroke(0);\ncurve(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y);\nstroke(255, 102, 0);\ncurve(p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, p4.x, p4.y);\n\n
    \n\n
    \n\nnoFill();\nstroke(255, 102, 0);\ncurve(5, 26, 0, 5, 26, 0, 73, 24, 0, 73, 61, 0);\nstroke(0);\ncurve(5, 26, 0, 73, 24, 0, 73, 61, 0, 15, 65, 0);\nstroke(255, 102, 0);\ncurve(73, 24, 0, 73, 61, 0, 15, 65, 0, 15, 65, 0);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "x-coordinate for the beginning control point", + "type": "Number" + }, + { + "name": "y1", + "description": "y-coordinate for the beginning control point", + "type": "Number" + }, + { + "name": "x2", + "description": "x-coordinate for the first point", + "type": "Number" + }, + { + "name": "y2", + "description": "y-coordinate for the first point", + "type": "Number" + }, + { + "name": "x3", + "description": "x-coordinate for the second point", + "type": "Number" + }, + { + "name": "y3", + "description": "y-coordinate for the second point", + "type": "Number" + }, + { + "name": "x4", + "description": "x-coordinate for the ending control point", + "type": "Number" + }, + { + "name": "y4", + "description": "y-coordinate for the ending control point", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x1", + "type": "Number" + }, + { + "name": "y1", + "type": "Number" + }, + { + "name": "z1", + "description": "z-coordinate for the beginning control point", + "type": "Number" + }, + { + "name": "x2", + "type": "Number" + }, + { + "name": "y2", + "type": "Number" + }, + { + "name": "z2", + "description": "z-coordinate for the first point", + "type": "Number" + }, + { + "name": "x3", + "type": "Number" + }, + { + "name": "y3", + "type": "Number" + }, + { + "name": "z3", + "description": "z-coordinate for the second point", + "type": "Number" + }, + { + "name": "x4", + "type": "Number" + }, + { + "name": "y4", + "type": "Number" + }, + { + "name": "z4", + "description": "z-coordinate for the ending control point", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "curveDetail", + "file": "src/core/shape/curves.js", + "line": 389, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the resolution at which curves display. The default value is 20 while\nthe minimum value is 3.

    \n

    This function is only useful when using the WEBGL renderer\nas the default canvas renderer does not use this\ninformation.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n\n curveDetail(5);\n}\nfunction draw() {\n background(200);\n\n curve(250, 600, 0, -30, 40, 0, 30, 30, 0, -250, 600, 0);\n}\n\n
    " + ], + "alt": "white arch shape with a low level of curve detail.", + "overloads": [ + { + "params": [ + { + "name": "resolution", + "description": "resolution of the curves", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "curveTightness", + "file": "src/core/shape/curves.js", + "line": 439, + "itemtype": "method", + "chainable": 1, + "description": "Modifies the quality of forms created with curve()\nand curveVertex().The parameter tightness\ndetermines how the curve fits to the vertex points. The value 0.0 is the\ndefault value for tightness (this value defines the curves to be Catmull-Rom\nsplines) and the value 1.0 connects all the points with straight lines.\nValues within the range -5.0 and 5.0 will deform the curves but will leave\nthem recognizable and as values increase in magnitude, they will continue to deform.", + "example": [ + "
    \n\n// Move the mouse left and right to see the curve change\nfunction setup() {\n createCanvas(100, 100);\n noFill();\n}\n\nfunction draw() {\n background(204);\n let t = map(mouseX, 0, width, -5, 5);\n curveTightness(t);\n beginShape();\n curveVertex(10, 26);\n curveVertex(10, 26);\n curveVertex(83, 24);\n curveVertex(83, 61);\n curveVertex(25, 65);\n curveVertex(25, 65);\n endShape();\n}\n\n
    " + ], + "alt": "Line shaped like right-facing arrow,points move with mouse-x and warp shape.", + "overloads": [ + { + "params": [ + { + "name": "amount", + "description": "amount of deformation from the original vertices", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "curvePoint", + "file": "src/core/shape/curves.js", + "line": 482, + "itemtype": "method", + "description": "Evaluates the curve at position t for points a, b, c, d.\nThe parameter t varies between 0 and 1, a and d are control points\nof the curve, and b and c are the start and end points of the curve.\nThis can be done once with the x coordinates and a second time\nwith the y coordinates to get the location of a curve at t.", + "example": [ + "
    \n\nnoFill();\ncurve(5, 26, 5, 26, 73, 24, 73, 61);\ncurve(5, 26, 73, 24, 73, 61, 15, 65);\nfill(255);\nellipseMode(CENTER);\nlet steps = 6;\nfor (let i = 0; i <= steps; i++) {\n let t = i / steps;\n let x = curvePoint(5, 5, 73, 73, t);\n let y = curvePoint(26, 26, 24, 61, t);\n ellipse(x, y, 5, 5);\n x = curvePoint(5, 73, 73, 15, t);\n y = curvePoint(26, 24, 61, 65, t);\n ellipse(x, y, 5, 5);\n}\n\n
    \n\nline hooking down to right-bottom with 13 5Ɨ5 white ellipse points" + ], + "overloads": [ + { + "params": [ + { + "name": "a", + "description": "coordinate of first control point of the curve", + "type": "Number" + }, + { + "name": "b", + "description": "coordinate of first point", + "type": "Number" + }, + { + "name": "c", + "description": "coordinate of second point", + "type": "Number" + }, + { + "name": "d", + "description": "coordinate of second control point", + "type": "Number" + }, + { + "name": "t", + "description": "value between 0 and 1", + "type": "Number" + } + ], + "return": { + "description": "Curve value at position t", + "type": "Number" + } + } + ], + "return": { + "description": "Curve value at position t", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "curveTangent", + "file": "src/core/shape/curves.js", + "line": 529, + "itemtype": "method", + "description": "Evaluates the tangent to the curve at position t for points a, b, c, d.\nThe parameter t varies between 0 and 1, a and d are points on the curve,\nand b and c are the control points.", + "example": [ + "
    \n\nnoFill();\ncurve(5, 26, 73, 24, 73, 61, 15, 65);\nlet steps = 6;\nfor (let i = 0; i <= steps; i++) {\n let t = i / steps;\n let x = curvePoint(5, 73, 73, 15, t);\n let y = curvePoint(26, 24, 61, 65, t);\n //ellipse(x, y, 5, 5);\n let tx = curveTangent(5, 73, 73, 15, t);\n let ty = curveTangent(26, 24, 61, 65, t);\n let a = atan2(ty, tx);\n a -= PI / 2.0;\n line(x, y, cos(a) * 8 + x, sin(a) * 8 + y);\n}\n\n
    " + ], + "alt": "right curving line mid-right of canvas with 7 short lines radiating from it.", + "overloads": [ + { + "params": [ + { + "name": "a", + "description": "coordinate of first control point", + "type": "Number" + }, + { + "name": "b", + "description": "coordinate of first point on the curve", + "type": "Number" + }, + { + "name": "c", + "description": "coordinate of second point on the curve", + "type": "Number" + }, + { + "name": "d", + "description": "coordinate of second conrol point", + "type": "Number" + }, + { + "name": "t", + "description": "value between 0 and 1", + "type": "Number" + } + ], + "return": { + "description": "the tangent at position t", + "type": "Number" + } + } + ], + "return": { + "description": "the tangent at position t", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Curves" + }, + { + "name": "beginContour", + "file": "src/core/shape/vertex.js", + "line": 61, + "itemtype": "method", + "chainable": 1, + "description": "

    Use the beginContour() and\nendContour() functions to create negative shapes\nwithin shapes such as the center of the letter 'O'. beginContour()\nbegins recording vertices for the shape and endContour() stops recording.\nThe vertices that define a negative shape must \"wind\" in the opposite direction\nfrom the exterior shape. First draw vertices for the exterior clockwise order, then for internal shapes, draw vertices\nshape in counter-clockwise.

    \n

    These functions can only be used within a beginShape()/endShape() pair and\ntransformations such as translate(), rotate(), and scale() do not work\nwithin a beginContour()/endContour() pair. It is also not possible to use\nother shapes, such as ellipse() or rect() within.

    \n", + "example": [ + "
    \n\ntranslate(50, 50);\nstroke(255, 0, 0);\nbeginShape();\n// Exterior part of shape, clockwise winding\nvertex(-40, -40);\nvertex(40, -40);\nvertex(40, 40);\nvertex(-40, 40);\n// Interior part of shape, counter-clockwise winding\nbeginContour();\nvertex(-20, -20);\nvertex(-20, 20);\nvertex(20, 20);\nvertex(20, -20);\nendContour();\nendShape(CLOSE);\n\n
    " + ], + "alt": "white rect and smaller grey rect with red outlines in center of canvas.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "beginShape", + "file": "src/core/shape/vertex.js", + "line": 272, + "itemtype": "method", + "chainable": 1, + "description": "

    Using the beginShape() and endShape() functions allow creating more\ncomplex forms. beginShape() begins recording vertices for a shape and\nendShape() stops recording. The value of the kind parameter tells it which\ntypes of shapes to create from the provided vertices. With no mode\nspecified, the shape can be any irregular polygon.

    \n

    The parameters available for beginShape() are:

    \n

    POINTS\nDraw a series of points

    \n

    LINES\nDraw a series of unconnected line segments (individual lines)

    \n

    TRIANGLES\nDraw a series of separate triangles

    \n

    TRIANGLE_FAN\nDraw a series of connected triangles sharing the first vertex in a fan-like fashion

    \n

    TRIANGLE_STRIP\nDraw a series of connected triangles in strip fashion

    \n

    QUADS\nDraw a series of separate quads

    \n

    QUAD_STRIP\nDraw quad strip using adjacent edges to form the next quad

    \n

    TESS (WEBGL only)\nHandle irregular polygon for filling curve by explicit tessellation

    \n

    After calling the beginShape() function, a series of vertex() commands must follow. To stop\ndrawing the shape, call endShape(). Each shape will be outlined with the\ncurrent stroke color and filled with the fill color.

    \n

    Transformations such as translate(), rotate(), and scale() do not work\nwithin beginShape(). It is also not possible to use other shapes, such as\nellipse() or rect() within beginShape().

    \n", + "example": [ + "
    \n\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape(CLOSE);\n\n
    \n\n
    \n\nbeginShape(POINTS);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n\n
    \n\n
    \n\nbeginShape(LINES);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n\n
    \n\n
    \n\nnoFill();\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n\n
    \n\n
    \n\nnoFill();\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape(CLOSE);\n\n
    \n\n
    \n\nbeginShape(TRIANGLES);\nvertex(30, 75);\nvertex(40, 20);\nvertex(50, 75);\nvertex(60, 20);\nvertex(70, 75);\nvertex(80, 20);\nendShape();\n\n
    \n\n
    \n\nbeginShape(TRIANGLE_STRIP);\nvertex(30, 75);\nvertex(40, 20);\nvertex(50, 75);\nvertex(60, 20);\nvertex(70, 75);\nvertex(80, 20);\nvertex(90, 75);\nendShape();\n\n
    \n\n
    \n\nbeginShape(TRIANGLE_FAN);\nvertex(57.5, 50);\nvertex(57.5, 15);\nvertex(92, 50);\nvertex(57.5, 85);\nvertex(22, 50);\nvertex(57.5, 15);\nendShape();\n\n
    \n\n
    \n\nbeginShape(QUADS);\nvertex(30, 20);\nvertex(30, 75);\nvertex(50, 75);\nvertex(50, 20);\nvertex(65, 20);\nvertex(65, 75);\nvertex(85, 75);\nvertex(85, 20);\nendShape();\n\n
    \n\n
    \n\nbeginShape(QUAD_STRIP);\nvertex(30, 20);\nvertex(30, 75);\nvertex(50, 20);\nvertex(50, 75);\nvertex(65, 20);\nvertex(65, 75);\nvertex(85, 20);\nvertex(85, 75);\nendShape();\n\n
    \n\n
    \n\nbeginShape(TESS);\nvertex(20, 20);\nvertex(80, 20);\nvertex(80, 40);\nvertex(40, 40);\nvertex(40, 60);\nvertex(80, 60);\nvertex(80, 80);\nvertex(20, 80);\nendShape(CLOSE);\n\n
    " + ], + "alt": "white square-shape with black outline in middle-right of canvas.\n4 black points in a square shape in middle-right of canvas.\n2 horizontal black lines. In the top-right and bottom-right of canvas.\n3 line shape with horizontal on top, vertical in middle and horizontal bottom.\nsquare line shape in middle-right of canvas.\n2 white triangle shapes mid-right canvas. left one pointing up and right down.\n5 horizontal interlocking and alternating white triangles in mid-right canvas.\n4 interlocking white triangles in 45 degree rotated square-shape.\n2 white rectangle shapes in mid-right canvas. Both 20Ɨ55.\n3 side-by-side white rectangles center rect is smaller in mid-right canvas.\nThick white l-shape with black outline mid-top-left of canvas.", + "overloads": [ + { + "params": [ + { + "name": "kind", + "description": "either POINTS, LINES, TRIANGLES, TRIANGLE_FAN\nTRIANGLE_STRIP, QUADS, QUAD_STRIP or TESS", + "optional": 1, + "type": "POINTS|LINES|TRIANGLES|TRIANGLE_FAN|TRIANGLE_STRIP|QUADS|QUAD_STRIP|TESS" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "bezierVertex", + "file": "src/core/shape/vertex.js", + "line": 392, + "itemtype": "method", + "chainable": 1, + "description": "

    Specifies vertex coordinates for Bezier curves. Each call to\nbezierVertex() defines the position of two control points and\none anchor point of a Bezier curve, adding a new segment to a\nline or shape. For WebGL mode bezierVertex() can be used in 2D\nas well as 3D mode. 2D mode expects 6 parameters, while 3D mode\nexpects 9 parameters (including z coordinates).

    \n

    The first time bezierVertex() is used within a beginShape()\ncall, it must be prefaced with a call to vertex() to set the first anchor\npoint. This function must be used between beginShape() and endShape()\nand only when there is no MODE or POINTS parameter specified to\nbeginShape().

    \n", + "example": [ + "
    \n\nnoFill();\nbeginShape();\nvertex(30, 20);\nbezierVertex(80, 0, 80, 75, 30, 75);\nendShape();\n\n
    \n\n
    \n\nbeginShape();\nvertex(30, 20);\nbezierVertex(80, 0, 80, 75, 30, 75);\nbezierVertex(50, 80, 60, 25, 30, 20);\nendShape();\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n setAttributes('antialias', true);\n}\nfunction draw() {\n orbitControl();\n background(50);\n strokeWeight(4);\n stroke(255);\n point(-25, 30);\n point(25, 30);\n point(25, -30);\n point(-25, -30);\n\n strokeWeight(1);\n noFill();\n\n beginShape();\n vertex(-25, 30);\n bezierVertex(25, 30, 25, -30, -25, -30);\n endShape();\n\n beginShape();\n vertex(-25, 30, 20);\n bezierVertex(25, 30, 20, 25, -30, 20, -25, -30, 20);\n endShape();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x2", + "description": "x-coordinate for the first control point", + "type": "Number" + }, + { + "name": "y2", + "description": "y-coordinate for the first control point", + "type": "Number" + }, + { + "name": "x3", + "description": "x-coordinate for the second control point", + "type": "Number" + }, + { + "name": "y3", + "description": "y-coordinate for the second control point", + "type": "Number" + }, + { + "name": "x4", + "description": "x-coordinate for the anchor point", + "type": "Number" + }, + { + "name": "y4", + "description": "y-coordinate for the anchor point", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x2", + "type": "Number" + }, + { + "name": "y2", + "type": "Number" + }, + { + "name": "z2", + "description": "z-coordinate for the first control point (for WebGL mode)", + "type": "Number" + }, + { + "name": "x3", + "type": "Number" + }, + { + "name": "y3", + "type": "Number" + }, + { + "name": "z3", + "description": "z-coordinate for the second control point (for WebGL mode)", + "type": "Number" + }, + { + "name": "x4", + "type": "Number" + }, + { + "name": "y4", + "type": "Number" + }, + { + "name": "z4", + "description": "z-coordinate for the anchor point (for WebGL mode)", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "curveVertex", + "file": "src/core/shape/vertex.js", + "line": 517, + "itemtype": "method", + "chainable": 1, + "description": "

    Specifies vertex coordinates for curves. This function may only\nbe used between beginShape() and endShape() and only when there\nis no MODE parameter specified to beginShape().\nFor WebGL mode curveVertex() can be used in 2D as well as 3D mode.\n2D mode expects 2 parameters, while 3D mode expects 3 parameters.

    \n

    The first and last points in a series of curveVertex() lines will be used to\nguide the beginning and end of the curve. A minimum of four\npoints is required to draw a tiny curve between the second and\nthird points. Adding a fifth point with curveVertex() will draw\nthe curve between the second, third, and fourth points. The\ncurveVertex() function is an implementation of Catmull-Rom\nsplines.

    \n", + "example": [ + "
    \n\nstrokeWeight(5);\npoint(84, 91);\npoint(68, 19);\npoint(21, 17);\npoint(32, 91);\nstrokeWeight(1);\n\nnoFill();\nbeginShape();\ncurveVertex(84, 91);\ncurveVertex(84, 91);\ncurveVertex(68, 19);\ncurveVertex(21, 17);\ncurveVertex(32, 91);\ncurveVertex(32, 91);\nendShape();\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n setAttributes('antialias', true);\n}\nfunction draw() {\n orbitControl();\n background(50);\n strokeWeight(4);\n stroke(255);\n\n point(-25, 25);\n point(-25, 25);\n point(-25, -25);\n point(25, -25);\n point(25, 25);\n point(25, 25);\n\n strokeWeight(1);\n noFill();\n\n beginShape();\n curveVertex(-25, 25);\n curveVertex(-25, 25);\n curveVertex(-25, -25);\n curveVertex(25, -25);\n curveVertex(25, 25);\n curveVertex(25, 25);\n endShape();\n\n beginShape();\n curveVertex(-25, 25, 20);\n curveVertex(-25, 25, 20);\n curveVertex(-25, -25, 20);\n curveVertex(25, -25, 20);\n curveVertex(25, 25, 20);\n curveVertex(25, 25, 20);\n endShape();\n}\n\n
    " + ], + "alt": "Upside-down u-shape line, mid canvas with the same shape in positive z-axis.", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the vertex", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the vertex", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "description": "z-coordinate of the vertex (for WebGL mode)", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "endContour", + "file": "src/core/shape/vertex.js", + "line": 569, + "itemtype": "method", + "chainable": 1, + "description": "

    Use the beginContour() and endContour() functions to create negative\nshapes within shapes such as the center of the letter 'O'. beginContour()\nbegins recording vertices for the shape and endContour() stops recording.\nThe vertices that define a negative shape must \"wind\" in the opposite\ndirection from the exterior shape. First draw vertices for the exterior\nclockwise order, then for internal shapes, draw vertices\nshape in counter-clockwise.

    \n

    These functions can only be used within a beginShape()/endShape() pair and\ntransformations such as translate(), rotate(), and scale() do not work\nwithin a beginContour()/endContour() pair. It is also not possible to use\nother shapes, such as ellipse() or rect() within.

    \n", + "example": [ + "
    \n\ntranslate(50, 50);\nstroke(255, 0, 0);\nbeginShape();\n// Exterior part of shape, clockwise winding\nvertex(-40, -40);\nvertex(40, -40);\nvertex(40, 40);\nvertex(-40, 40);\n// Interior part of shape, counter-clockwise winding\nbeginContour();\nvertex(-20, -20);\nvertex(-20, 20);\nvertex(20, 20);\nvertex(20, -20);\nendContour();\nendShape(CLOSE);\n\n
    " + ], + "alt": "white rect and smaller grey rect with red outlines in center of canvas.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "endShape", + "file": "src/core/shape/vertex.js", + "line": 710, + "itemtype": "method", + "chainable": 1, + "description": "The endShape() function is the companion to beginShape() and may only be\ncalled after beginShape(). When endShape() is called, all of the image\ndata defined since the previous call to beginShape() is written into the image\nbuffer. The constant CLOSE is the value for the mode parameter to close\nthe shape (to connect the beginning and the end).\nWhen using instancing with endShape() the instancing will not apply to the strokes.\nWhen the count parameter is used with a value greater than 1, it enables instancing for shapes built when in WEBGL mode. Instancing\nis a feature that allows the GPU to efficiently draw multiples of the same shape. It's often used for particle effects or other\ntimes when you need a lot of repetition. In order to take advantage of instancing, you will also need to write your own custom\nshader using the gl_InstanceID keyword. You can read more about instancing\nhere or by working from the example on this\npage.", + "example": [ + "
    \n\nnoFill();\n\nbeginShape();\nvertex(20, 20);\nvertex(45, 20);\nvertex(45, 80);\nendShape(CLOSE);\n\nbeginShape();\nvertex(50, 20);\nvertex(75, 20);\nvertex(75, 80);\nendShape();\n\n
    ", + "
    \n\nlet fx;\nlet vs = `#version 300 es\n\nprecision mediump float;\n\nin vec3 aPosition;\nflat out int instanceID;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nvoid main() {\n\n // copy the instance ID to the fragment shader\n instanceID = gl_InstanceID;\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // gl_InstanceID represents a numeric value for each instance\n // using gl_InstanceID allows us to move each instance separately\n // here we move each instance horizontally by id * 23\n float xOffset = float(gl_InstanceID) * 23.0;\n\n // apply the offset to the final position\n gl_Position = uProjectionMatrix * uModelViewMatrix * (positionVec4 -\n vec4(xOffset, 0.0, 0.0, 0.0));\n}\n`;\nlet fs = `#version 300 es\n\nprecision mediump float;\n\nout vec4 outColor;\nflat in int instanceID;\nuniform float numInstances;\n\nvoid main() {\n vec4 red = vec4(1.0, 0.0, 0.0, 1.0);\n vec4 blue = vec4(0.0, 0.0, 1.0, 1.0);\n\n // Normalize the instance id\n float normId = float(instanceID) / numInstances;\n\n // Mix between two colors using the normalized instance id\n outColor = mix(red, blue, normId);\n}\n`;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n fx = createShader(vs, fs);\n}\n\nfunction draw() {\n background(220);\n\n // strokes aren't instanced, and are rather used for debug purposes\n shader(fx);\n fx.setUniform('numInstances', 4);\n\n // this doesn't have to do with instancing, this is just for centering the squares\n translate(25, -10);\n\n // here we draw the squares we want to instance\n beginShape();\n vertex(0, 0);\n vertex(0, 20);\n vertex(20, 20);\n vertex(20, 0);\n vertex(0, 0);\n endShape(CLOSE, 4);\n\n resetShader();\n}\n\n
    " + ], + "alt": "Triangle line shape with smallest interior angle on bottom and upside-down L.", + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "use CLOSE to close the shape", + "optional": 1, + "type": "CLOSE" + }, + { + "name": "count", + "description": "number of times you want to draw/instance the shape (for WebGL mode).", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "quadraticVertex", + "file": "src/core/shape/vertex.js", + "line": 890, + "itemtype": "method", + "chainable": 1, + "description": "

    Specifies vertex coordinates for quadratic Bezier curves. Each call to\nquadraticVertex() defines the position of one control points and one\nanchor point of a Bezier curve, adding a new segment to a line or shape.\nThe first time quadraticVertex() is used within a beginShape() call, it\nmust be prefaced with a call to vertex() to set the first anchor point.\nFor WebGL mode quadraticVertex() can be used in 2D as well as 3D mode.\n2D mode expects 4 parameters, while 3D mode expects 6 parameters\n(including z coordinates).

    \n

    This function must be used between beginShape() and endShape()\nand only when there is no MODE or POINTS parameter specified to\nbeginShape().

    \n", + "example": [ + "
    \n\nstrokeWeight(5);\npoint(20, 20);\npoint(80, 20);\npoint(50, 50);\n\nnoFill();\nstrokeWeight(1);\nbeginShape();\nvertex(20, 20);\nquadraticVertex(80, 20, 50, 50);\nendShape();\n\n
    \n\n
    \n\nstrokeWeight(5);\npoint(20, 20);\npoint(80, 20);\npoint(50, 50);\n\npoint(20, 80);\npoint(80, 80);\npoint(80, 60);\n\nnoFill();\nstrokeWeight(1);\nbeginShape();\nvertex(20, 20);\nquadraticVertex(80, 20, 50, 50);\nquadraticVertex(20, 80, 80, 80);\nvertex(80, 60);\nendShape();\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n setAttributes('antialias', true);\n}\nfunction draw() {\n orbitControl();\n background(50);\n strokeWeight(4);\n stroke(255);\n\n point(-35, -35);\n point(35, -35);\n point(0, 0);\n point(-35, 35);\n point(35, 35);\n point(35, 10);\n\n strokeWeight(1);\n noFill();\n\n beginShape();\n vertex(-35, -35);\n quadraticVertex(35, -35, 0, 0);\n quadraticVertex(-35, 35, 35, 35);\n vertex(35, 10);\n endShape();\n\n beginShape();\n vertex(-35, -35, 20);\n quadraticVertex(35, -35, 20, 0, 0, 20);\n quadraticVertex(-35, 35, 20, 35, 35, 20);\n vertex(35, 10, 20);\n endShape();\n}\n\n
    " + ], + "alt": "backwards s-shaped black line with the same s-shaped line in positive z-axis.", + "overloads": [ + { + "params": [ + { + "name": "cx", + "description": "x-coordinate for the control point", + "type": "Number" + }, + { + "name": "cy", + "description": "y-coordinate for the control point", + "type": "Number" + }, + { + "name": "x3", + "description": "x-coordinate for the anchor point", + "type": "Number" + }, + { + "name": "y3", + "description": "y-coordinate for the anchor point", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "cx", + "type": "Number" + }, + { + "name": "cy", + "type": "Number" + }, + { + "name": "cz", + "description": "z-coordinate for the control point (for WebGL mode)", + "type": "Number" + }, + { + "name": "x3", + "type": "Number" + }, + { + "name": "y3", + "type": "Number" + }, + { + "name": "z3", + "description": "z-coordinate for the anchor point (for WebGL mode)", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "vertex", + "file": "src/core/shape/vertex.js", + "line": 1078, + "itemtype": "method", + "chainable": 1, + "description": "All shapes are constructed by connecting a series of vertices. vertex()\nis used to specify the vertex coordinates for points, lines, triangles,\nquads, and polygons. It is used exclusively within the beginShape() and\nendShape() functions.", + "example": [ + "
    \n\nstrokeWeight(3);\nbeginShape(POINTS);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n\n
    \n\n
    \n\ncreateCanvas(100, 100, WEBGL);\nbackground(240, 240, 240);\nfill(237, 34, 93);\nnoStroke();\nbeginShape();\nvertex(0, 35);\nvertex(35, 0);\nvertex(0, -35);\nvertex(-35, 0);\nendShape();\n\n
    \n\n
    \n\ncreateCanvas(100, 100, WEBGL);\nbackground(240, 240, 240);\nfill(237, 34, 93);\nnoStroke();\nbeginShape();\nvertex(-10, 10);\nvertex(0, 35);\nvertex(10, 10);\nvertex(35, 0);\nvertex(10, -8);\nvertex(0, -35);\nvertex(-10, -8);\nvertex(-35, 0);\nendShape();\n\n
    \n\n
    \n\nstrokeWeight(3);\nstroke(237, 34, 93);\nbeginShape(LINES);\nvertex(10, 35);\nvertex(90, 35);\nvertex(10, 65);\nvertex(90, 65);\nvertex(35, 10);\nvertex(35, 90);\nvertex(65, 10);\nvertex(65, 90);\nendShape();\n\n
    \n\n
    \n\n// Click to change the number of sides.\n// In WebGL mode, custom shapes will only\n// display hollow fill sections when\n// all calls to vertex() use the same z-value.\n\nlet sides = 3;\nlet angle, px, py;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n setAttributes('antialias', true);\n fill(237, 34, 93);\n strokeWeight(3);\n}\n\nfunction draw() {\n background(200);\n rotateX(frameCount * 0.01);\n rotateZ(frameCount * 0.01);\n ngon(sides, 0, 0, 80);\n}\n\nfunction mouseClicked() {\n if (sides > 6) {\n sides = 3;\n } else {\n sides++;\n }\n}\n\nfunction ngon(n, x, y, d) {\n beginShape(TESS);\n for (let i = 0; i < n + 1; i++) {\n angle = TWO_PI / n * i;\n px = x + sin(angle) * d / 2;\n py = y - cos(angle) * d / 2;\n vertex(px, py, 0);\n }\n for (let i = 0; i < n + 1; i++) {\n angle = TWO_PI / n * i;\n px = x + sin(angle) * d / 4;\n py = y - cos(angle) * d / 4;\n vertex(px, py, 0);\n }\n endShape();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the vertex", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the vertex", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "description": "z-coordinate of the vertex.\nDefaults to 0 if not specified.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "optional": 1, + "type": "Number" + }, + { + "name": "u", + "description": "the vertex's texture u-coordinate", + "optional": 1, + "type": "Number" + }, + { + "name": "v", + "description": "the vertex's texture v-coordinate", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "normal", + "file": "src/core/shape/vertex.js", + "line": 1151, + "itemtype": "method", + "chainable": 1, + "description": "Sets the 3d vertex normal to use for subsequent vertices drawn with\nvertex(). A normal is a vector that is generally\nnearly perpendicular to a shape's surface which controls how much light will\nbe reflected from that part of the surface.", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noStroke();\n}\n\nfunction draw() {\n background(255);\n rotateY(frameCount / 100);\n normalMaterial();\n beginShape(TRIANGLE_STRIP);\n normal(-0.4, 0.4, 0.8);\n vertex(-30, 30, 0);\n\n normal(0, 0, 1);\n vertex(-30, -30, 30);\n vertex(30, 30, 30);\n\n normal(0.4, -0.4, 0.8);\n vertex(30, -30, 0);\n endShape();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "vector", + "description": "A p5.Vector representing the vertex normal.", + "type": "Vector" + } + ] + }, + { + "params": [ + { + "name": "x", + "description": "The x component of the vertex normal.", + "type": "Number" + }, + { + "name": "y", + "description": "The y component of the vertex normal.", + "type": "Number" + }, + { + "name": "z", + "description": "The z component of the vertex normal.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "Vertex" + }, + { + "name": "noLoop", + "file": "src/core/structure.js", + "line": 78, + "itemtype": "method", + "description": "

    Stops p5.js from continuously executing the code within draw().\nIf loop() is called, the code in draw()\nbegins to run continuously again. If using noLoop()\nin setup(), it should be the last line inside the block.

    \n

    When noLoop() is used, it's not possible to manipulate\nor access the screen inside event handling functions such as\nmousePressed() or\nkeyPressed(). Instead, use those functions to\ncall redraw() or loop(),\nwhich will run draw(), which can update the screen\nproperly. This means that when noLoop() has been\ncalled, no drawing can happen, and functions like saveFrames()\nor loadPixels() may not be used.

    \n

    Note that if the sketch is resized, redraw() will\nbe called to update the sketch, even after noLoop()\nhas been specified. Otherwise, the sketch would enter an odd state until\nloop() was called.

    \n

    Use isLooping() to check the current state of loop().

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n noLoop();\n}\n\nfunction draw() {\n line(10, 10, 90, 90);\n}\n\n
    \n\n
    \n\nlet x = 0;\nfunction setup() {\n createCanvas(100, 100);\n}\n\nfunction draw() {\n background(204);\n x = x + 0.1;\n if (x > width) {\n x = 0;\n }\n line(x, 0, x, height);\n}\n\nfunction mousePressed() {\n noLoop();\n}\n\nfunction mouseReleased() {\n loop();\n}\n\n
    " + ], + "alt": "113 pixel long line extending from top-left to bottom right of canvas.\nhorizontal line moves slowly from left. Loops but stops on mouse press.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "loop", + "file": "src/core/structure.js", + "line": 124, + "itemtype": "method", + "description": "

    By default, p5.js loops through draw() continuously, executing the code within\nit. However, the draw() loop may be stopped by calling\nnoLoop(). In that case, the draw()\nloop can be resumed with loop().

    \n

    Avoid calling loop() from inside setup().

    \n

    Use isLooping() to check the current state of loop().

    \n", + "example": [ + "
    \n\nlet x = 0;\nfunction setup() {\n createCanvas(100, 100);\n noLoop();\n}\n\nfunction draw() {\n background(204);\n x = x + 0.1;\n if (x > width) {\n x = 0;\n }\n line(x, 0, x, height);\n}\n\nfunction mousePressed() {\n loop();\n}\n\nfunction mouseReleased() {\n noLoop();\n}\n\n
    " + ], + "alt": "horizontal line moves slowly from left. Loops but stops on mouse press.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "isLooping", + "file": "src/core/structure.js", + "line": 188, + "itemtype": "method", + "description": "By default, p5.js loops through draw() continuously,\nexecuting the code within it. If the sketch is stopped with\nnoLoop() or resumed with loop(),\nisLooping() returns the current state for use within custom event handlers.", + "example": [ + "
    \n\nlet checkbox, button, colBG, colFill;\n\nfunction setup() {\n createCanvas(100, 100);\n\n button = createButton('Colorize if loop()');\n button.position(0, 120);\n button.mousePressed(changeBG);\n\n checkbox = createCheckbox('loop()', true);\n checkbox.changed(checkLoop);\n\n colBG = color(0);\n colFill = color(255);\n}\n\nfunction changeBG() {\n if (isLooping()) {\n colBG = color(random(255), random(255), random(255));\n colFill = color(random(255), random(255), random(255));\n }\n}\n\nfunction checkLoop() {\n if (this.checked()) {\n loop();\n } else {\n noLoop();\n }\n}\n\nfunction draw() {\n background(colBG);\n fill(colFill);\n ellipse(frameCount % width, height / 2, 50);\n}\n\n
    " + ], + "alt": "Ellipse moves slowly from left. Checkbox toggles loop()/noLoop().\nButton colorizes sketch if isLooping().", + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "boolean" + } + } + ], + "return": { + "description": "", + "type": "boolean" + }, + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "push", + "file": "src/core/structure.js", + "line": 281, + "itemtype": "method", + "description": "

    The push() function saves the current drawing style\nsettings and transformations, while pop() restores these\nsettings. Note that these functions are always used together. They allow you to\nchange the style and transformation settings and later return to what you had.\nWhen a new state is started with push(), it builds on\nthe current style and transform information. The push()\nand pop() functions can be embedded to provide more\ncontrol. (See the second example for a demonstration.)

    \n

    push() stores information related to the current transformation state\nand style settings controlled by the following functions:\nfill(),\nnoFill(),\nnoStroke(),\nstroke(),\ntint(),\nnoTint(),\nstrokeWeight(),\nstrokeCap(),\nstrokeJoin(),\nimageMode(),\nrectMode(),\nellipseMode(),\ncolorMode(),\ntextAlign(),\ntextFont(),\ntextSize(),\ntextLeading(),\napplyMatrix(),\nresetMatrix(),\nrotate(),\nscale(),\nshearX(),\nshearY(),\ntranslate(),\nnoiseSeed().

    \n

    In WEBGL mode additional style settings are stored. These are controlled by the\nfollowing functions: setCamera(),\nambientLight(),\ndirectionalLight(),\npointLight(), texture(),\nspecularMaterial(),\nshininess(),\nnormalMaterial()\nand shader().

    \n", + "example": [ + "
    \n\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\nstrokeWeight(10);\nfill(204, 153, 0);\ntranslate(50, 0);\nellipse(0, 50, 33, 33); // Middle circle\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n\n
    \n\n
    \n\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\nstrokeWeight(10);\nfill(204, 153, 0);\nellipse(33, 50, 33, 33); // Left-middle circle\n\npush(); // Start another new drawing state\nstroke(0, 102, 153);\nellipse(66, 50, 33, 33); // Right-middle circle\npop(); // Restore previous state\n\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n\n
    " + ], + "alt": "Gold ellipse + thick black outline @center 2 white ellipses on left and right.\n2 Gold ellipses left black right blue stroke. 2 white ellipses on left+right.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "pop", + "file": "src/core/structure.js", + "line": 381, + "itemtype": "method", + "description": "

    The push() function saves the current drawing style\nsettings and transformations, while pop() restores\nthese settings. Note that these functions are always used together. They allow\nyou to change the style and transformation settings and later return to what\nyou had. When a new state is started with push(), it\nbuilds on the current style and transform information. The push()\nand pop() functions can be embedded to provide more\ncontrol. (See the second example for a demonstration.)

    \n

    push() stores information related to the current transformation state\nand style settings controlled by the following functions:\nfill(),\nnoFill(),\nnoStroke(),\nstroke(),\ntint(),\nnoTint(),\nstrokeWeight(),\nstrokeCap(),\nstrokeJoin(),\nimageMode(),\nrectMode(),\nellipseMode(),\ncolorMode(),\ntextAlign(),\ntextFont(),\ntextSize(),\ntextLeading(),\napplyMatrix(),\nresetMatrix(),\nrotate(),\nscale(),\nshearX(),\nshearY(),\ntranslate(),\nnoiseSeed().

    \n

    In WEBGL mode additional style settings are stored. These are controlled by\nthe following functions:\nsetCamera(),\nambientLight(),\ndirectionalLight(),\npointLight(),\ntexture(),\nspecularMaterial(),\nshininess(),\nnormalMaterial() and\nshader().

    \n", + "example": [ + "
    \n\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\ntranslate(50, 0);\nstrokeWeight(10);\nfill(204, 153, 0);\nellipse(0, 50, 33, 33); // Middle circle\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n\n
    \n\n
    \n\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\nstrokeWeight(10);\nfill(204, 153, 0);\nellipse(33, 50, 33, 33); // Left-middle circle\n\npush(); // Start another new drawing state\nstroke(0, 102, 153);\nellipse(66, 50, 33, 33); // Right-middle circle\npop(); // Restore previous state\n\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n\n
    " + ], + "alt": "Gold ellipse + thick black outline @center 2 white ellipses on left and right.\n2 Gold ellipses left black right blue stroke. 2 white ellipses on left+right.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "redraw", + "file": "src/core/structure.js", + "line": 458, + "itemtype": "method", + "description": "

    Executes the code within draw() one time. This\nfunction allows the program to update the display window only when necessary,\nfor example when an event registered by mousePressed()\nor keyPressed() occurs.

    \n

    In structuring a program, it only makes sense to call redraw()\nwithin events such as mousePressed(). This\nis because redraw() does not run\ndraw() immediately (it only sets a flag that indicates\nan update is needed).

    \n

    The redraw() function does not work properly when\ncalled inside draw().To enable/disable animations,\nuse loop() and noLoop().

    \n

    In addition you can set the number of redraws per method call. Just\nadd an integer as single parameter for the number of redraws.

    \n", + "example": [ + "
    \nlet x = 0;\n\nfunction setup() {\n createCanvas(100, 100);\n noLoop();\n}\n\nfunction draw() {\n background(204);\n line(x, 0, x, height);\n}\n\nfunction mousePressed() {\n x += 1;\n redraw();\n}\n\n
    \n\n
    \n\nlet x = 0;\n\nfunction setup() {\n createCanvas(100, 100);\n noLoop();\n}\n\nfunction draw() {\n background(204);\n x += 1;\n line(x, 0, x, height);\n}\n\nfunction mousePressed() {\n redraw(5);\n}\n\n
    " + ], + "alt": "black line on far left of canvas\nblack line on far left of canvas", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "Redraw for n-times. The default value is 1.", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "applyMatrix", + "file": "src/core/transform.js", + "line": 187, + "itemtype": "method", + "chainable": 1, + "description": "

    Multiplies the current matrix by the one specified through the parameters.\nThis is a powerful operation that can perform the equivalent of translate,\nscale, shear and rotate all at once. You can learn more about transformation\nmatrices on \nWikipedia.

    \n

    The naming of the arguments here follows the naming of the \nWHATWG specification and corresponds to a\ntransformation matrix of the\nform:

    \n

    \n", + "example": [ + "
    \n\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n let step = frameCount % 20;\n background(200);\n // Equivalent to translate(x, y);\n applyMatrix(1, 0, 0, 1, 40 + step, 50);\n rect(0, 0, 50, 50);\n}\n\n
    \n\n
    \n\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n let step = frameCount % 20;\n background(200);\n translate(50, 50);\n // Equivalent to scale(x, y);\n applyMatrix(1 / step, 0, 0, 1 / step, 0, 0);\n rect(0, 0, 50, 50);\n}\n\n
    \n\n
    \n\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n let step = frameCount % 20;\n let angle = map(step, 0, 20, 0, TWO_PI);\n let cos_a = cos(angle);\n let sin_a = sin(angle);\n background(200);\n translate(50, 50);\n // Equivalent to rotate(angle);\n applyMatrix(cos_a, sin_a, -sin_a, cos_a, 0, 0);\n rect(0, 0, 50, 50);\n}\n\n
    \n\n
    \n\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n let step = frameCount % 20;\n let angle = map(step, 0, 20, -PI / 4, PI / 4);\n background(200);\n translate(50, 50);\n // equivalent to shearX(angle);\n let shear_factor = 1 / tan(PI / 2 - angle);\n applyMatrix(1, 0, shear_factor, 1, 0, 0);\n rect(0, 0, 50, 50);\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noFill();\n}\n\nfunction draw() {\n background(200);\n rotateY(PI / 6);\n stroke(153);\n box(35);\n let rad = millis() / 1000;\n // Set rotation angles\n let ct = cos(rad);\n let st = sin(rad);\n // Matrix for rotation around the Y axis\n applyMatrix(\n ct, 0.0, st, 0.0,\n 0.0, 1.0, 0.0, 0.0,\n -st, 0.0, ct, 0.0,\n 0.0, 0.0, 0.0, 1.0\n );\n stroke(255);\n box(50);\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n let testMatrix = [1, 0, 0, 1, 0, 0];\n applyMatrix(testMatrix);\n rect(0, 0, 50, 50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "arr", + "description": "an array of numbers - should be 6 or 16 length (2Ɨ3 or 4Ɨ4 matrix values)", + "type": "Array" + } + ] + }, + { + "params": [ + { + "name": "a", + "description": "numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "b", + "description": "numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "c", + "description": "numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "d", + "description": "numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "e", + "description": "numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "f", + "description": "numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "a", + "type": "Number" + }, + { + "name": "b", + "type": "Number" + }, + { + "name": "c", + "type": "Number" + }, + { + "name": "d", + "type": "Number" + }, + { + "name": "e", + "type": "Number" + }, + { + "name": "f", + "type": "Number" + }, + { + "name": "g", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "h", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "i", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "j", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "k", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "l", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "m", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "n", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "o", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + }, + { + "name": "p", + "description": "numbers which define the 4Ɨ4 matrix to be multiplied", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "resetMatrix", + "file": "src/core/transform.js", + "line": 217, + "itemtype": "method", + "chainable": 1, + "description": "Replaces the current matrix with the identity matrix.", + "example": [ + "
    \n\ntranslate(50, 50);\napplyMatrix(0.5, 0.5, -0.5, 0.5, 0, 0);\nrect(0, 0, 20, 20);\n// Note that the translate is also reset.\nresetMatrix();\nrect(0, 0, 20, 20);\n\n
    " + ], + "alt": "A rotated rectangle in the center with another at the top left corner", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "rotate", + "file": "src/core/transform.js", + "line": 255, + "itemtype": "method", + "chainable": 1, + "description": "

    Rotates a shape by the amount specified by the angle parameter. This\nfunction accounts for angleMode, so angles\ncan be entered in either RADIANS or DEGREES.

    \n

    Objects are always rotated around their relative position to the\norigin and positive numbers rotate objects in a clockwise direction.\nTransformations apply to everything that happens after and subsequent\ncalls to the function accumulate the effect. For example, calling\nrotate(HALF_PI) and then rotate(HALF_PI) is the same as rotate(PI).\nAll transformations are reset when draw() begins again.

    \n

    Technically, rotate() multiplies the current transformation matrix\nby a rotation matrix. This function can be further controlled by\npush() and pop().

    \n", + "example": [ + "
    \n\ntranslate(width / 2, height / 2);\nrotate(PI / 3.0);\nrect(-26, -26, 52, 52);\n\n
    " + ], + "alt": "white 52Ɨ52 rect with black outline at center rotated counter 45 degrees", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode", + "type": "Number" + }, + { + "name": "axis", + "description": "(in 3d) the axis to rotate around", + "optional": 1, + "type": "p5.Vector|Number[]" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "rotateX", + "file": "src/core/transform.js", + "line": 292, + "itemtype": "method", + "chainable": 1, + "description": "

    Rotates a shape around X axis by the amount specified in angle parameter.\nThe angles can be entered in either RADIANS or DEGREES.

    \n

    Objects are always rotated around their relative position to the\norigin and positive numbers rotate objects in a clockwise direction.\nAll transformations are reset when draw() begins again.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n}\nfunction draw() {\n background(255);\n rotateX(millis() / 1000);\n box();\n}\n\n
    " + ], + "alt": "3d box rotating around the x axis.", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "rotateY", + "file": "src/core/transform.js", + "line": 330, + "itemtype": "method", + "chainable": 1, + "description": "

    Rotates a shape around Y axis by the amount specified in angle parameter.\nThe angles can be entered in either RADIANS or DEGREES.

    \n

    Objects are always rotated around their relative position to the\norigin and positive numbers rotate objects in a clockwise direction.\nAll transformations are reset when draw() begins again.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n}\nfunction draw() {\n background(255);\n rotateY(millis() / 1000);\n box();\n}\n\n
    " + ], + "alt": "3d box rotating around the y axis.", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "rotateZ", + "file": "src/core/transform.js", + "line": 370, + "itemtype": "method", + "chainable": 1, + "description": "

    Rotates a shape around Z axis by the amount specified in angle parameter.\nThe angles can be entered in either RADIANS or DEGREES.

    \n

    This method works in WEBGL mode only.

    \n

    Objects are always rotated around their relative position to the\norigin and positive numbers rotate objects in a clockwise direction.\nAll transformations are reset when draw() begins again.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n}\nfunction draw() {\n background(255);\n rotateZ(millis() / 1000);\n box();\n}\n\n
    " + ], + "alt": "3d box rotating around the z axis.", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "the angle of rotation, specified in radians\nor degrees, depending on current angleMode", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "scale", + "file": "src/core/transform.js", + "line": 426, + "itemtype": "method", + "chainable": 1, + "description": "

    Increases or decreases the size of a shape by expanding or contracting\nvertices. Objects always scale from their relative origin to the\ncoordinate system. Scale values are specified as decimal percentages.\nFor example, the function call scale(2.0) increases the dimension of a\nshape by 200%.

    \n

    Transformations apply to everything that happens after and subsequent\ncalls to the function multiply the effect. For example, calling scale(2.0)\nand then scale(1.5) is the same as scale(3.0). If scale() is called\nwithin draw(), the transformation is reset when the loop begins again.

    \n

    Using this function with the z parameter is only available in WEBGL mode.\nThis function can be further controlled with push() and pop().

    \n", + "example": [ + "
    \n\nrect(30, 20, 50, 50);\nscale(0.5);\nrect(30, 20, 50, 50);\n\n
    \n\n
    \n\nrect(30, 20, 50, 50);\nscale(0.5, 1.3);\nrect(30, 20, 50, 50);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "s", + "description": "percent to scale the object, or percentage to\nscale the object in the x-axis if multiple arguments\nare given", + "type": "Number|p5.Vector|Number[]" + }, + { + "name": "y", + "description": "percent to scale the object in the y-axis", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "percent to scale the object in the z-axis (webgl only)", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "scales", + "description": "per-axis percents to scale the object", + "type": "p5.Vector|Number[]" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "shearX", + "file": "src/core/transform.js", + "line": 483, + "itemtype": "method", + "chainable": 1, + "description": "

    Shears a shape around the x-axis by the amount specified by the angle\nparameter. Angles should be specified in the current angleMode.\nObjects are always sheared around their relative position to the origin\nand positive numbers shear objects in a clockwise direction.

    \n

    Transformations apply to everything that happens after and subsequent\ncalls to the function accumulates the effect. For example, calling\nshearX(PI/2) and then shearX(PI/2) is the same as shearX(PI).\nIf shearX() is called within the draw(),\nthe transformation is reset when the loop begins again.

    \n

    Technically, shearX() multiplies the current\ntransformation matrix by a rotation matrix. This function can be further\ncontrolled by the push() and pop() functions.

    \n", + "example": [ + "
    \n\ntranslate(width / 4, height / 4);\nshearX(PI / 4.0);\nrect(0, 0, 30, 30);\n\n
    " + ], + "alt": "white irregular quadrilateral with black outline at top middle.", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "angle of shear specified in radians or degrees,\ndepending on current angleMode", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "shearY", + "file": "src/core/transform.js", + "line": 522, + "itemtype": "method", + "chainable": 1, + "description": "

    Shears a shape around the y-axis the amount specified by the angle\nparameter. Angles should be specified in the current angleMode. Objects\nare always sheared around their relative position to the origin and\npositive numbers shear objects in a clockwise direction.

    \n

    Transformations apply to everything that happens after and subsequent\ncalls to the function accumulates the effect. For example, calling\nshearY(PI/2) and then shearY(PI/2) is the same as shearY(PI). If\nshearY() is called within the draw(), the transformation is reset when\nthe loop begins again.

    \n

    Technically, shearY() multiplies the current transformation matrix by a\nrotation matrix. This function can be further controlled by the\npush() and pop() functions.

    \n", + "example": [ + "
    \n\ntranslate(width / 4, height / 4);\nshearY(PI / 4.0);\nrect(0, 0, 30, 30);\n\n
    " + ], + "alt": "white irregular quadrilateral with black outline at middle bottom.", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "angle of shear specified in radians or degrees,\ndepending on current angleMode", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "translate", + "file": "src/core/transform.js", + "line": 587, + "itemtype": "method", + "chainable": 1, + "description": "

    Specifies an amount to displace objects within the display window.\nThe x parameter specifies left/right translation, the y parameter\nspecifies up/down translation.

    \n

    Transformations are cumulative and apply to everything that happens after\nand subsequent calls to the function accumulates the effect. For example,\ncalling translate(50, 0) and then translate(20, 0) is the same as\ntranslate(70, 0). If translate() is called within draw(), the\ntransformation is reset when the loop begins again. This function can be\nfurther controlled by using push() and pop().

    \n", + "example": [ + "
    \n\ntranslate(30, 20);\nrect(0, 0, 55, 55);\n\n
    \n\n
    \n\nrect(0, 0, 55, 55); // Draw rect at original 0,0\ntranslate(30, 20);\nrect(0, 0, 55, 55); // Draw rect at new 0,0\ntranslate(14, 14);\nrect(0, 0, 55, 55); // Draw rect at new 0,0\n\n
    \n\n\n
    \n\nfunction draw() {\n background(200);\n rectMode(CENTER);\n translate(width / 2, height / 2);\n translate(p5.Vector.fromAngle(millis() / 1000, 40));\n rect(0, 0, 20, 20);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "left/right translation", + "type": "Number" + }, + { + "name": "y", + "description": "up/down translation", + "type": "Number" + }, + { + "name": "z", + "description": "forward/backward translation (WEBGL only)", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "vector", + "description": "the vector to translate by", + "type": "p5.Vector" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Transform", + "submodule": "Transform" + }, + { + "name": "storeItem", + "file": "src/data/local_storage.js", + "line": 58, + "itemtype": "method", + "description": "

    Stores a value in local storage under the key name.\nLocal storage is saved in the browser and persists\nbetween browsing sessions and page reloads.\nThe key can be the name of the variable but doesn't\nhave to be. To retrieve stored items\nsee getItem.

    \n

    Sensitive data such as passwords or personal information\nshould not be stored in local storage.

    \n", + "example": [ + "
    \n// Type to change the letter in the\n// center of the canvas.\n// If you reload the page, it will\n// still display the last key you entered\n\nlet myText;\n\nfunction setup() {\n createCanvas(100, 100);\n myText = getItem('myText');\n if (myText === null) {\n myText = '';\n }\n describe(`When you type the key name is displayed as black text on white background.\n If you reload the page, the last letter typed is still displaying.`);\n}\n\nfunction draw() {\n textSize(40);\n background(255);\n text(myText, width / 2, height / 2);\n}\n\nfunction keyPressed() {\n myText = key;\n storeItem('myText', myText);\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "type": "String" + }, + { + "name": "value", + "type": "String|Number|Object|Boolean|p5.Color|p5.Vector" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Data", + "submodule": "LocalStorage" + }, + { + "name": "getItem", + "file": "src/data/local_storage.js", + "line": 139, + "itemtype": "method", + "description": "Returns the value of an item that was stored in local storage\nusing storeItem()", + "example": [ + "
    \n// Click the mouse to change\n// the color of the background\n// Once you have changed the color\n// it will stay changed even when you\n// reload the page.\n\nlet myColor;\n\nfunction setup() {\n createCanvas(100, 100);\n myColor = getItem('myColor');\n}\n\nfunction draw() {\n if (myColor !== null) {\n background(myColor);\n }\n describe(`If you click, the canvas changes to a random color.Ā·\n If you reload the page, the canvas is still the color it was when the\n page was previously loaded.`);\n}\n\nfunction mousePressed() {\n myColor = color(random(255), random(255), random(255));\n storeItem('myColor', myColor);\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "name that you wish to use to store in local storage", + "type": "String" + } + ], + "return": { + "description": "Value of stored item", + "type": "Number|Object|String|Boolean|p5.Color|p5.Vector" + } + } + ], + "return": { + "description": "Value of stored item", + "type": "Number|Object|String|Boolean|p5.Color|p5.Vector" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "LocalStorage" + }, + { + "name": "clearStorage", + "file": "src/data/local_storage.js", + "line": 197, + "itemtype": "method", + "description": "Clears all local storage items set with storeItem()\nfor the current domain.", + "example": [ + "
    \n\nfunction setup() {\n let myNum = 10;\n let myBool = false;\n storeItem('myNum', myNum);\n storeItem('myBool', myBool);\n print(getItem('myNum')); // logs 10 to the console\n print(getItem('myBool')); // logs false to the console\n clearStorage();\n print(getItem('myNum')); // logs null to the console\n print(getItem('myBool')); // logs null to the console\n}\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Data", + "submodule": "LocalStorage" + }, + { + "name": "removeItem", + "file": "src/data/local_storage.js", + "line": 221, + "itemtype": "method", + "description": "Removes an item that was stored with storeItem()", + "example": [ + "
    \n\nfunction setup() {\n let myVar = 10;\n storeItem('myVar', myVar);\n print(getItem('myVar')); // logs 10 to the console\n removeItem('myVar');\n print(getItem('myVar')); // logs null to the console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Data", + "submodule": "LocalStorage" + }, + { + "name": "createStringDict", + "file": "src/data/p5.TypedDict.js", + "line": 43, + "itemtype": "method", + "description": "Creates a new instance of p5.StringDict using the key-value pair\nor the object you provide.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n print(myDictionary.hasKey('p5')); // logs true to console\n\n let anotherDictionary = createStringDict({ happy: 'coding' });\n print(anotherDictionary.hasKey('happy')); // logs true to console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "type": "String" + }, + { + "name": "value", + "type": "String" + } + ], + "return": { + "description": "", + "type": "p5.StringDict" + } + }, + { + "params": [ + { + "name": "object", + "description": "object", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "p5.StringDict" + } + } + ], + "return": { + "description": "", + "type": "p5.StringDict" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "createNumberDict", + "file": "src/data/p5.TypedDict.js", + "line": 77, + "itemtype": "method", + "description": "Creates a new instance of p5.NumberDict using the key-value pair\nor object you provide.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict(100, 42);\n print(myDictionary.hasKey(100)); // logs true to console\n\n let anotherDictionary = createNumberDict({ 200: 84 });\n print(anotherDictionary.hasKey(200)); // logs true to console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "type": "Number" + }, + { + "name": "value", + "type": "Number" + } + ], + "return": { + "description": "", + "type": "p5.NumberDict" + } + }, + { + "params": [ + { + "name": "object", + "description": "object", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "p5.NumberDict" + } + } + ], + "return": { + "description": "", + "type": "p5.NumberDict" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "select", + "file": "src/dom/dom.js", + "line": 92, + "itemtype": "method", + "description": "

    Searches the page for the first element that matches the given\nCSS selector string.\nThe string can be an ID, class, tag name, or a combination. select()\nreturns a p5.Element object if it finds a match\nand null otherwise.

    \n

    The second parameter, container, is optional. It specifies a container to\nsearch within. container can be CSS selector string, a\np5.Element object, or an\nHTMLElement object.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n\n // Select the canvas by its tag.\n let cnv = select('canvas');\n cnv.style('border', '5px deeppink dashed');\n\n describe('A gray square with a dashed pink border.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n // Add a class attribute to the canvas.\n cnv.class('pinkborder');\n\n background(200);\n\n // Select the canvas by its class.\n cnv = select('.pinkborder');\n // Style its border.\n cnv.style('border', '5px deeppink dashed');\n\n describe('A gray square with a dashed pink border.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n // Set the canvas ID.\n cnv.id('mycanvas');\n\n background(200);\n\n // Select the canvas by its ID.\n cnv = select('#mycanvas');\n // Style its border.\n cnv.style('border', '5px deeppink dashed');\n\n describe('A gray square with a dashed pink border.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "selectors", + "description": "CSS selector string of element to search for.", + "type": "String" + }, + { + "name": "container", + "description": "CSS selector string, p5.Element, or\nHTMLElement to search within.", + "optional": 1, + "type": "String|p5.Element|HTMLElement" + } + ], + "return": { + "description": "p5.Element containing the element.", + "type": "p5.Element|" + } + } + ], + "return": { + "description": "p5.Element containing the element.", + "type": "p5.Element|" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "selectAll", + "file": "src/dom/dom.js", + "line": 177, + "itemtype": "method", + "description": "

    Searches the page for all elements that matches the given\nCSS selector string.\nThe string can be an ID, class, tag name, or a combination. selectAll()\nreturns an array of p5.Element objects if it\nfinds any matches and an empty array otherwise.

    \n

    The second parameter, container, is optional. It specifies a container to\nsearch within. container can be CSS selector string, a\np5.Element object, or an\nHTMLElement object.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create three buttons.\n createButton('1');\n createButton('2');\n createButton('3');\n\n // Select the buttons by their tag.\n let buttons = selectAll('button');\n\n // Position the buttons.\n for (let i = 0; i < 3; i += 1) {\n buttons[i].position(0, i * 30);\n }\n\n describe('Three buttons stacked vertically. The buttons are labeled, \"1\", \"2\", and \"3\".');\n}\n\n
    \n\n
    \n\nfunction setup() {\n // Create three buttons and position them.\n let b1 = createButton('1');\n b1.position(0, 0);\n let b2 = createButton('2');\n b2.position(0, 30);\n let b3 = createButton('3');\n b3.position(0, 60);\n\n // Add a class attribute to each button.\n b1.class('btn');\n b2.class('btn btn-pink');\n b3.class('btn');\n\n // Select the buttons by their class.\n let buttons = selectAll('.btn');\n let pinkButtons = selectAll('.btn-pink');\n\n // Style the selected buttons.\n buttons.forEach(btn => {\n btn.style('font-family', 'Comic Sans MS');\n });\n\n pinkButtons.forEach(btn => {\n btn.style('background', 'deeppink');\n btn.style('color', 'white');\n });\n\n describe('Three buttons stacked vertically. The buttons are labeled, \"1\", \"2\", and \"3\". Buttons \"1\" and \"3\" are gray. Button \"2\" is pink.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "selectors", + "description": "CSS selector string of element to search for.", + "type": "String" + }, + { + "name": "container", + "description": "CSS selector string, p5.Element, or\nHTMLElement to search within.", + "optional": 1, + "type": "String|p5.Element|HTMLElement" + } + ], + "return": { + "description": "array of p5.Elements containing any elements found.", + "type": "p5.Element[]" + } + } + ], + "return": { + "description": "array of p5.Elements containing any elements found.", + "type": "p5.Element[]" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "removeElements", + "file": "src/dom/dom.js", + "line": 301, + "itemtype": "method", + "description": "Removes all elements created by p5.js, including any event handlers.\nThere are two exceptions:\ncanvas elements created by createCanvas\nand p5.Render objects created by\ncreateGraphics.", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n\n // Create a paragraph element and place\n // it in the middle of the canvas.\n let p = createP('p5*js');\n p.position(25, 25);\n\n describe('A gray square with the text \"p5*js\" written in its center. The text disappears when the mouse is pressed.');\n}\n\nfunction mousePressed() {\n removeElements();\n}\n\n
    \n\n
    \n\nlet slider;\n\nfunction setup() {\n createCanvas(100, 100);\n\n // Create a paragraph element and place\n // it at the top of the canvas.\n let p = createP('p5*js');\n p.position(25, 25);\n\n // Create a slider element and place it\n // beneath the canvas.\n slider = createSlider(0, 255, 200);\n slider.position(0, 100);\n\n describe('A gray square with the text \"p5*js\" written in its center and a range slider beneath it. The square changes color when the slider is moved. The text and slider disappear when the square is double-clicked.');\n}\n\nfunction draw() {\n // Use the slider value to change the background color.\n let g = slider.value();\n background(g);\n}\n\nfunction doubleClicked() {\n removeElements();\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "changed", + "file": "src/dom/dom.js", + "line": 366, + "itemtype": "method", + "chainable": 1, + "description": "myElement.changed() sets a function to call when the value of the\np5.Element object changes. Calling\nmyElement.changed(false) disables the function.", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create a dropdown menu and add a few color options.\n let drop = createSelect();\n drop.position(0, 0);\n drop.option('red');\n drop.option('green');\n drop.option('blue');\n\n // When the color option changes, paint the background with\n // that color.\n drop.changed(() => {\n let c = drop.value();\n background(c);\n });\n\n describe('A gray square with a dropdown menu at the top. The square changes color when an option is selected.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create a checkbox and place it beneath the canvas.\n let checkbox = createCheckbox(' circle');\n checkbox.position(0, 100);\n\n // When the checkbox changes, paint the background gray\n // and determine whether to draw a circle.\n checkbox.changed(() => {\n background(200);\n if (checkbox.checked() === true) {\n circle(50, 50, 30);\n }\n });\n\n describe('A gray square with a checkbox underneath it that says \"circle\". A white circle appears when the box is checked and disappears otherwise.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when the element changes.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "input", + "file": "src/dom/dom.js", + "line": 426, + "itemtype": "method", + "chainable": 1, + "description": "myElement.input() sets a function to call when input is detected within\nthe p5.Element object. It's often used to with\ntext inputs and sliders. Calling myElement.input(false) disables the\nfunction.", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create a slider and place it beneath the canvas.\n let slider = createSlider(0, 255, 200);\n slider.position(0, 100);\n\n // When the slider changes, use its value to paint\n // the background.\n slider.input(() => {\n let g = slider.value();\n background(g);\n });\n\n describe('A gray square with a range slider underneath it. The background changes shades of gray when the slider is moved.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create an input and place it beneath the canvas.\n let inp = createInput('');\n inp.position(0, 100);\n\n // When input is detected, paint the background gray\n // and display the text.\n inp.input(() => {\n background(200);\n let msg = inp.value();\n text(msg, 5, 50);\n });\n\n describe('A gray square with a text input bar beneath it. Any text written in the input appears in the middle of the square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fxn", + "description": "function to call when input is detected within\nthe element.\nfalse disables the function.", + "type": "Function|Boolean" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "addElement", + "file": "src/dom/dom.js", + "line": 434, + "itemtype": "method", + "description": "Helpers for create methods.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createDiv", + "file": "src/dom/dom.js", + "line": 482, + "itemtype": "method", + "description": "

    Creates a <div></div> element. It's commonly used as a\ncontainer for other elements.

    \n

    The parameter html is optional. It accepts a string that sets the\ninner HTML of the new <div></div>.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n let div = createDiv('p5*js');\n div.position(25, 35);\n\n describe('A gray square with the text \"p5*js\" written in its center.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create an h3 element within the div.\n let div = createDiv('

    p5*js

    ');\n div.position(20, 5);\n\n describe('A gray square with the text \"p5*js\" written in its center.');\n}\n
    \n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "html", + "description": "inner HTML for the new <div></div> element.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createP", + "file": "src/dom/dom.js", + "line": 512, + "itemtype": "method", + "description": "

    Creates a <p></p> element. It's commonly used for\nparagraph-length text.

    \n

    The parameter html is optional. It accepts a string that sets the\ninner HTML of the new <p></p>.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n let p = createP('Tell me a story.');\n p.position(5, 0);\n\n describe('A gray square displaying the text \"Tell me a story.\" written in black.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "html", + "description": "inner HTML for the new <p></p> element.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createSpan", + "file": "src/dom/dom.js", + "line": 577, + "itemtype": "method", + "description": "

    Creates a <span></span> element. It's commonly used as a\ncontainer for inline elements. For example, a <span></span>\ncan hold part of a sentence that's a\ndifferent style.

    \n

    The parameter html is optional. It accepts a string that sets the\ninner HTML of the new <span></span>.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create a span element.\n let span = createSpan('p5*js');\n span.position(25, 35);\n\n describe('A gray square with the text \"p5*js\" written in its center.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create a div element as\n // a container.\n let div = createDiv();\n // Place the div at the\n // center.\n div.position(25, 35);\n\n // Create a span element.\n let s1 = createSpan('p5');\n // Create a second span element.\n let s2 = createSpan('*');\n // Set the span's font color.\n s2.style('color', 'deeppink');\n // Create a third span element.\n let s3 = createSpan('js');\n\n // Add all the spans to the\n // container div.\n s1.parent(div);\n s2.parent(div);\n s3.parent(div);\n\n describe('A gray square with the text \"p5*js\" written in black at its center. The asterisk is pink.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "html", + "description": "inner HTML for the new <span></span> element.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createImg", + "file": "src/dom/dom.js", + "line": 633, + "itemtype": "method", + "description": "

    Creates an <img> element that can appear outside of the canvas.

    \n

    The first parameter, src, is a string with the path to the image file.\nsrc should be a relative path, as in 'assets/image.png', or a URL, as\nin 'https://example.com/image.png'.

    \n

    The second parameter, alt, is a string with the\nalternate text\nfor the image. An empty string '' can be used for images that aren't displayed.

    \n

    The third parameter, crossOrigin, is optional. It's a string that sets the\ncrossOrigin property\nof the image. Use 'anonymous' or 'use-credentials' to fetch the image\nwith cross-origin access.

    \n

    The fourth parameter, callback, is also optional. It sets a function to\ncall after the image loads. The new image is passed to the callback\nfunction as a p5.Element object.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n let img = createImg(\n 'https://p5js.org/assets/img/asterisk-01.png',\n 'The p5.js magenta asterisk.'\n );\n img.position(0, -10);\n\n describe('A gray square with a magenta asterisk in its center.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "src", + "description": "relative path or URL for the image.", + "type": "String" + }, + { + "name": "alt", + "description": "alternate text for the image.", + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + }, + { + "params": [ + { + "name": "src", + "type": "String" + }, + { + "name": "alt", + "type": "String" + }, + { + "name": "crossOrigin", + "description": "crossOrigin property to use when fetching the image.", + "optional": 1, + "type": "String" + }, + { + "name": "successCallback", + "description": "function to call once the image loads. The new image will be passed\nto the function as a p5.Element object.", + "optional": 1, + "type": "Function" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createA", + "file": "src/dom/dom.js", + "line": 706, + "itemtype": "method", + "description": "

    Creates an <a></a> element that links to another web page.

    \n

    The first parmeter, href, is a string that sets the URL of the linked\npage.

    \n

    The second parameter, html, is a string that sets the inner HTML of the\nlink. It's common to use text, images, or buttons as links.

    \n

    The third parameter, target, is optional. It's a string that tells the\nweb browser where to open the link. By default, links open in the current\nbrowser tab. Passing '_blank' will cause the link to open in a new\nbrowser tab. MDN describes a few\nother options.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create an anchor element that links to p5js.org.\n let a = createA('http://p5js.org/', 'p5*js');\n a.position(25, 35);\n\n describe('The text \"p5*js\" written at the center of a gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create an anchor element that links to p5js.org.\n // Open the link in a new tab.\n let a = createA('http://p5js.org/', 'p5*js', '_blank');\n a.position(25, 35);\n\n describe('The text \"p5*js\" written at the center of a gray square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "href", + "description": "URL of linked page.", + "type": "String" + }, + { + "name": "html", + "description": "inner HTML of link element to display.", + "type": "String" + }, + { + "name": "target", + "description": "target where the new link should open,\neither '_blank', '_self', '_parent', or '_top'.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createSlider", + "file": "src/dom/dom.js", + "line": 827, + "itemtype": "method", + "description": "

    Creates a slider <input></input> element. Range sliders are\nuseful for quickly selecting numbers from a given range.

    \n

    The first two parameters, min and max, are numbers that set the\nslider's minimum and maximum.

    \n

    The third parameter, value, is optional. It's a number that sets the\nslider's default value.

    \n

    The fourth parameter, step, is also optional. It's a number that sets the\nspacing between each value in the slider's range. Setting step to 0\nallows the slider to move smoothly from min to max.

    \n", + "example": [ + "
    \n\nlet slider;\n\nfunction setup() {\n // Create a slider and place it at the top of the canvas.\n slider = createSlider(0, 255);\n slider.position(10, 10);\n slider.size(80);\n\n describe('A dark gray square with a range slider at the top. The square changes color when the slider is moved.');\n}\n\nfunction draw() {\n // Use the slider as a grayscale value.\n let g = slider.value();\n background(g);\n}\n\n
    \n\n
    \n\nlet slider;\n\nfunction setup() {\n // Create a slider and place it at the top of the canvas.\n // Set its default value to 0.\n slider = createSlider(0, 255, 0);\n slider.position(10, 10);\n slider.size(80);\n\n describe('A black square with a range slider at the top. The square changes color when the slider is moved.');\n}\n\nfunction draw() {\n // Use the slider as a grayscale value.\n let g = slider.value();\n background(g);\n}\n\n
    \n\n
    \n\nlet slider;\n\nfunction setup() {\n // Create a slider and place it at the top of the canvas.\n // Set its default value to 0.\n // Set its step size to 50.\n slider = createSlider(0, 255, 0, 50);\n slider.position(10, 10);\n slider.size(80);\n\n describe('A black square with a range slider at the top. The square changes color when the slider is moved.');\n}\n\nfunction draw() {\n // Use the slider as a grayscale value.\n let g = slider.value();\n background(g);\n}\n\n
    \n\n
    \n\nlet slider;\n\nfunction setup() {\n // Create a slider and place it at the top of the canvas.\n // Set its default value to 0.\n // Set its step size to 0 so that it moves smoothly.\n slider = createSlider(0, 255, 0, 0);\n slider.position(10, 10);\n slider.size(80);\n\n describe('A black square with a range slider at the top. The square changes color when the slider is moved.');\n}\n\nfunction draw() {\n // Use the slider as a grayscale value.\n let g = slider.value();\n background(g);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "min", + "description": "minimum value of the slider.", + "type": "Number" + }, + { + "name": "max", + "description": "maximum value of the slider.", + "type": "Number" + }, + { + "name": "value", + "description": "default value of the slider.", + "optional": 1, + "type": "Number" + }, + { + "name": "step", + "description": "size for each step in the slider's range.", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createButton", + "file": "src/dom/dom.js", + "line": 906, + "itemtype": "method", + "description": "

    Creates a <button></button> element.

    \n

    The first parameter, label, is a string that sets the label displayed on\nthe button.

    \n

    The second parameter, value, is optional. It's a string that sets the\nbutton's value. See\nMDN\nfor more details.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create a button and place it beneath the canvas.\n let button = createButton('click me');\n button.position(0, 100);\n\n // Use the button to change the background color.\n button.mousePressed(() => {\n let g = random(255);\n background(g);\n });\n\n describe('A gray square with a button that says \"click me\" beneath it. The square changes color when the button is clicked.');\n}\n\n
    \n\n
    \n\nlet button;\n\nfunction setup() {\n // Create a button and set its value to 0.\n // Place the button beneath the canvas.\n button = createButton('click me', 'red');\n button.position(0, 100);\n\n // Change the button's value when the mouse\n // is pressed.\n button.mousePressed(() => {\n let c = random(['red', 'green', 'blue', 'yellow']);\n button.value(c);\n });\n\n describe('A red square with a button that says \"click me\" beneath it. The square changes color when the button is clicked.');\n}\n\nfunction draw() {\n // Use the button's value to set the background color.\n let c = button.value();\n background(c);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "label", + "description": "label displayed on the button.", + "type": "String" + }, + { + "name": "value", + "description": "value of the button.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createCheckbox", + "file": "src/dom/dom.js", + "line": 1002, + "itemtype": "method", + "description": "

    Creates a checkbox <input></input> element. Checkboxes extend\nthe p5.Element class with a checked() method.\nCalling myBox.checked() returns true if it the box is checked and\nfalse otherwise.

    \n

    The first parameter, label, is optional. It's a string that sets the label\nto display next to the checkbox.

    \n

    The second parameter, value, is also optional. It's a boolean that sets the\ncheckbox's value.

    \n", + "example": [ + "
    \n\nlet checkbox;\n\nfunction setup() {\n // Create a checkbox and place it beneath the canvas.\n checkbox = createCheckbox();\n checkbox.position(0, 100);\n\n describe('A black square with a checkbox beneath it. The square turns white when the box is checked.');\n}\n\nfunction draw() {\n // Use the checkbox to set the background color.\n if (checkbox.checked()) {\n background(255);\n } else {\n background(0);\n }\n}\n\n
    \n\n
    \n\nlet checkbox;\n\nfunction setup() {\n // Create a checkbox and place it beneath the canvas.\n // Label the checkbox \"white\".\n checkbox = createCheckbox(' white');\n checkbox.position(0, 100);\n\n describe('A black square with a checkbox labeled \"white\" beneath it. The square turns white when the box is checked.');\n}\n\nfunction draw() {\n // Use the checkbox to set the background color.\n if (checkbox.checked()) {\n background(255);\n } else {\n background(0);\n }\n}\n\n
    \n\n
    \n\nlet checkbox;\n\nfunction setup() {\n // Create a checkbox and place it beneath the canvas.\n // Label the checkbox \"white\" and set its value to true.\n checkbox = createCheckbox(' white', true);\n checkbox.position(0, 100);\n\n describe('A white square with a checkbox labeled \"white\" beneath it. The square turns black when the box is unchecked.');\n}\n\nfunction draw() {\n // Use the checkbox to set the background color.\n if (checkbox.checked()) {\n background(255);\n } else {\n background(0);\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "label", + "description": "label displayed after the checkbox.", + "optional": 1, + "type": "String" + }, + { + "name": "value", + "description": "value of the checkbox. Checked is true and unchecked is false.", + "optional": 1, + "type": "boolean" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createSelect", + "file": "src/dom/dom.js", + "line": 1214, + "itemtype": "method", + "description": "

    Creates a dropdown menu <select></select> element.

    \n

    The parameter is optional. If true is passed, as in\nlet mySelect = createSelect(true), then the dropdown will support\nmultiple selections. If an existing <select></select> element\nis passed, as in let mySelect = createSelect(otherSelect), the existing\nelement will be wrapped in a new p5.Element\nobject.

    \n

    Dropdowns extend the p5.Element class with a few\nhelpful methods for managing options:

    \n
    • mySelect.option(name, [value]) adds an option to the menu. The first paremeter, name, is a string that sets the option's name and value. The second parameter, value, is optional. If provided, it sets the value that corresponds to the key name. If an option with name already exists, its value is changed to value.
    • mySelect.value() returns the currently-selected option's value.
    • mySelect.selected() returns the currently-selected option.
    • mySelect.selected(option) selects the given option by default.
    • mySelect.disable() marks the whole dropdown element as disabled.
    • mySelect.disable(option) marks a given option as disabled.
    • mySelect.enable() marks the whole dropdown element as enabled.
    • mySelect.enable(option) marks a given option as enabled.
    ", + "example": [ + "
    \n\nlet mySelect;\n\nfunction setup() {\n // Create a dropdown and place it beneath the canvas.\n mySelect = createSelect();\n mySelect.position(0, 100);\n\n // Add color options.\n mySelect.option('red');\n mySelect.option('green');\n mySelect.option('blue');\n mySelect.option('yellow');\n\n // Set the selected option to \"red\".\n mySelect.selected('red');\n\n describe('A red square with a dropdown menu beneath it. The square changes color when a new color is selected.');\n}\n\nfunction draw() {\n // Use the selected value to paint the background.\n let c = mySelect.selected();\n background(c);\n}\n\n
    \n\n
    \n\nlet mySelect;\n\nfunction setup() {\n // Create a dropdown and place it beneath the canvas.\n mySelect = createSelect();\n mySelect.position(0, 100);\n\n // Add color options.\n mySelect.option('red');\n mySelect.option('green');\n mySelect.option('blue');\n mySelect.option('yellow');\n\n // Set the selected option to \"red\".\n mySelect.selected('red');\n\n // Disable the \"yellow\" option.\n mySelect.disable('yellow');\n\n describe('A red square with a dropdown menu beneath it. The square changes color when a new color is selected.');\n}\n\nfunction draw() {\n // Use the selected value to paint the background.\n let c = mySelect.selected();\n background(c);\n}\n\n
    \n\n
    \n\nlet mySelect;\n\nfunction setup() {\n // Create a dropdown and place it beneath the canvas.\n mySelect = createSelect();\n mySelect.position(0, 100);\n\n // Add color options with names and values.\n mySelect.option('one', 'red');\n mySelect.option('two', 'green');\n mySelect.option('three', 'blue');\n mySelect.option('four', 'yellow');\n\n // Set the selected option to \"one\".\n mySelect.selected('one');\n\n describe('A red square with a dropdown menu beneath it. The square changes color when a new color is selected.');\n}\n\nfunction draw() {\n // Use the selected value to paint the background.\n let c = mySelect.selected();\n background(c);\n}\n\n
    \n\n
    \n\n// Hold CTRL to select multiple options on Windows and Linux.\n// Hold CMD to select multiple options on macOS.\nlet mySelect;\n\nfunction setup() {\n // Create a dropdown and allow multiple selections.\n // Place it beneath the canvas.\n mySelect = createSelect(true);\n mySelect.position(0, 100);\n\n // Add color options.\n mySelect.option('red');\n mySelect.option('green');\n mySelect.option('blue');\n mySelect.option('yellow');\n\n describe('A gray square with a dropdown menu beneath it. Colorful circles appear when their color is selected.');\n}\n\nfunction draw() {\n background(200);\n\n // Use the selected value(s) to draw circles.\n let colors = mySelect.selected();\n colors.forEach((c, index) => {\n let x = 10 + index * 20;\n fill(c);\n circle(x, 50, 20);\n });\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "multiple", + "description": "support multiple selections.", + "optional": 1, + "type": "boolean" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + }, + { + "params": [ + { + "name": "existing", + "description": "select element to wrap, either as a p5.Element or\na HTMLSelectElement.", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createRadio", + "file": "src/dom/dom.js", + "line": 1456, + "itemtype": "method", + "description": "

    Creates a radio button element.

    \n

    The parameter is optional. If a string is passed, as in\nlet myRadio = createSelect('food'), then each radio option will\nhave \"food\" as its name parameter: <input name=\"food\"></input>.\nIf an existing <div></div> or <span></span>\nelement is passed, as in let myRadio = createSelect(container), it will\nbecome the radio button's parent element.

    \n

    Radio buttons extend the p5.Element class with a few\nhelpful methods for managing options:

    \n
    • myRadio.option(value, [label]) adds an option to the menu. The first paremeter, value, is a string that sets the option's value and label. The second parameter, label, is optional. If provided, it sets the label displayed for the value. If an option with value already exists, its label is changed and its value is returned.
    • myRadio.value() returns the currently-selected option's value.
    • myRadio.selected() returns the currently-selected option.
    • myRadio.selected(value) selects the given option and returns it as an HTMLInputElement.
    • myRadio.disable(shouldDisable) enables the entire radio button if true is passed and disables it if false is passed.
    ", + "example": [ + "
    \n\nlet myRadio;\n\nfunction setup() {\n // Create a radio button element and place it\n // in the top-left corner.\n myRadio = createRadio();\n myRadio.position(0, 0);\n myRadio.size(60);\n\n // Add a few color options.\n myRadio.option('red');\n myRadio.option('yellow');\n myRadio.option('blue');\n\n // Choose a default option.\n myRadio.selected('yellow');\n\n describe('A yellow square with three color options listed, \"red\", \"yellow\", and \"blue\". The square changes color when the user selects a new option.');\n}\n\nfunction draw() {\n // Set the background color using the radio button.\n let g = myRadio.value();\n background(g);\n}\n\n
    \n\n
    \n\nlet myRadio;\n\nfunction setup() {\n // Create a radio button element and place it\n // in the top-left corner.\n myRadio = createRadio();\n myRadio.position(0, 0);\n myRadio.size(50);\n\n // Add a few color options.\n // Color values are labeled with\n // emotions they evoke.\n myRadio.option('red', 'love');\n myRadio.option('yellow', 'joy');\n myRadio.option('blue', 'trust');\n\n // Choose a default option.\n myRadio.selected('yellow');\n\n describe('A yellow square with three options listed, \"love\", \"joy\", and \"trust\". The square changes color when the user selects a new option.');\n}\n\nfunction draw() {\n // Set the background color using the radio button.\n let c = myRadio.value();\n background(c);\n}\n\n
    \n\n
    \n\nlet myRadio;\n\nfunction setup() {\n // Create a radio button element and place it\n // in the top-left corner.\n myRadio = createRadio();\n myRadio.position(0, 0);\n myRadio.size(50);\n\n // Add a few color options.\n myRadio.option('red');\n myRadio.option('yellow');\n myRadio.option('blue');\n\n // Choose a default option.\n myRadio.selected('yellow');\n\n // Create a button and place it beneath the canvas.\n let btn = createButton('disable');\n btn.position(0, 100);\n\n // Use the button to disable the radio button.\n btn.mousePressed(() => {\n myRadio.disable(true);\n });\n\n describe('A yellow square with three options listed, \"red\", \"yellow\", and \"blue\". The square changes color when the user selects a new option. A \"disable\" button beneath the canvas disables the color options when pressed.');\n}\n\nfunction draw() {\n // Set the background color using the radio button.\n let c = myRadio.value();\n background(c);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "containerElement", + "description": "container HTML Element, either a <div></div>\nor <span></span>.", + "optional": 1, + "type": "Object" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + }, + { + "params": [ + { + "name": "name", + "description": "name parameter assigned to each option's <input></input> element.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + }, + { + "params": [], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createColorPicker", + "file": "src/dom/dom.js", + "line": 1672, + "itemtype": "method", + "description": "

    Creates a color picker element.

    \n

    The parameter, value, is optional. If a color string or\np5.Color object is passed, it will set the default\ncolor.

    \n

    Color pickers extend the p5.Element class with a\ncouple of helpful methods for managing colors:

    \n
    • myPicker.value() returns the current color as a hex string in the format '#rrggbb'.
    • myPicker.color() returns the current color as a p5.Color object.
    ", + "example": [ + "
    \n\nlet myPicker;\n\nfunction setup() {\n myPicker = createColorPicker('deeppink');\n myPicker.position(0, 100);\n\n describe('A pink square with a color picker beneath it. The square changes color when the user picks a new color.');\n}\n\nfunction draw() {\n // Use the color picker to paint the background.\n let c = myPicker.color();\n background(c);\n}\n\n
    \n\n
    \n\nlet myPicker;\n\nfunction setup() {\n myPicker = createColorPicker('deeppink');\n myPicker.position(0, 100);\n\n describe('A number with the format \"#rrggbb\" is displayed on a pink canvas. The background color and number change when the user picks a new color.');\n}\n\nfunction draw() {\n // Use the color picker to paint the background.\n let c = myPicker.value();\n background(c);\n\n // Display the current color as a hex string.\n text(c, 25, 55);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "default color as a CSS color string.", + "optional": 1, + "type": "String|p5.Color" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createInput", + "file": "src/dom/dom.js", + "line": 1777, + "itemtype": "method", + "description": "

    Creates a text <input></input> element. Call myInput.size()\nto set the length of the text box.

    \n

    The first parameter, value, is optional. It's a string that sets the\ninput's default value. The input is blank by default.

    \n

    The second parameter, type, is also optional. It's a string that\nspecifies the type of text being input. See MDN for a full\nlist of options.\nThe default is 'text'.

    \n", + "example": [ + "
    \n\nlet myInput;\n\nfunction setup() {\n // Create an input element and place it\n // beneath the canvas.\n myInput = createInput();\n myInput.position(0, 100);\n\n describe('A gray square with a text box beneath it. The text in the square changes when the user types something new in the input bar.');\n}\n\nfunction draw() {\n background(200);\n\n // Use the input to display a message.\n let msg = myInput.value();\n text(msg, 25, 55);\n}\n\n
    \n\n
    \n\nlet myInput;\n\nfunction setup() {\n // Create an input element and place it\n // beneath the canvas. Set its default\n // text to \"hello!\".\n myInput = createInput('hello!');\n myInput.position(0, 100);\n\n describe('The text \"hello!\" written at the center of a gray square. A text box beneath the square also says \"hello!\". The text in the square changes when the user types something new in the input bar.');\n}\n\nfunction draw() {\n background(200);\n\n // Use the input to display a message.\n let msg = myInput.value();\n text(msg, 25, 55);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "default value of the input box. Defaults to an empty string ''.", + "optional": 1, + "type": "String" + }, + { + "name": "type", + "description": "type of input. Defaults to 'text'.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + }, + { + "params": [ + { + "name": "value", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createFileInput", + "file": "src/dom/dom.js", + "line": 1879, + "itemtype": "method", + "description": "

    Creates an <input></input> element of type 'file'.\nThis allows users to select local files for use in a sketch.

    \n

    The first parameter, callback, is a function that's called when the file\nloads. The callback function should have one parameter, file, that's a\np5.File object.

    \n

    The second parameter, multiple, is optional. It's a boolean value that\nallows loading multiple files if set to true. If true, callback\nwill be called once per file.

    \n", + "example": [ + "
    \n\n// Use the file input to select an image to\n// load and display.\nlet input;\nlet img;\n\nfunction setup() {\n // Create a file input and place it beneath\n // the canvas.\n input = createFileInput(handleImage);\n input.position(0, 100);\n\n describe('A gray square with a file input beneath it. If the user selects an image file to load, it is displayed on the square.');\n}\n\nfunction draw() {\n background(200);\n\n // Draw the image if loaded.\n if (img) {\n image(img, 0, 0, width, height);\n }\n}\n\n// Create an image if the file is an image.\nfunction handleImage(file) {\n if (file.type === 'image') {\n img = createImg(file.data, '');\n img.hide();\n } else {\n img = null;\n }\n}\n\n
    \n\n
    \n\n// Use the file input to select multiple images\n// to load and display.\nlet input;\nlet images = [];\n\nfunction setup() {\n // Create a file input and place it beneath\n // the canvas. Allow it to load multiple files.\n input = createFileInput(handleImage, true);\n input.position(0, 100);\n}\n\nfunction draw() {\n background(200);\n\n // Draw the images if loaded. Each image\n // is drawn 20 pixels lower than the\n // previous image.\n images.forEach((img, index) => {\n let y = index * 20;\n image(img, 0, y, width, height);\n });\n\n describe('A gray square with a file input beneath it. If the user selects multiple image files to load, they are displayed on the square.');\n}\n\n// Create an image if the file is an image,\n// then add it to the images array.\nfunction handleImage(file) {\n if (file.type === 'image') {\n let img = createImg(file.data, '');\n img.hide();\n images.push(img);\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "callback", + "description": "function to call once the file loads.", + "type": "Function" + }, + { + "name": "multiple", + "description": "allow multiple files to be selected.", + "optional": 1, + "type": "Boolean" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createMedia", + "file": "src/dom/dom.js", + "line": 1906, + "itemtype": "method", + "description": "VIDEO STUFF *", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createVideo", + "file": "src/dom/dom.js", + "line": 2036, + "itemtype": "method", + "description": "

    Creates a <video> element for simple audio/video playback.\nReturns a new p5.MediaElement object.

    \n

    Videos are shown by default. They can be hidden by calling video.hide()\nand drawn to the canvas using image().

    \n

    The first parameter, src, is the path the video. If a single string is\npassed, as in 'assets/topsecret.mp4', a single video is loaded. An array\nof strings can be used to load the same video in different formats. For\nexample, ['assets/topsecret.mp4', 'assets/topsecret.ogv', 'assets/topsecret.webm'].\nThis is useful for ensuring that the video can play across different browsers with\ndifferent capabilities. See\nMDN\nfor more information about supported formats.

    \n

    The second parameter, callback, is optional. It's a function to call once\nthe video is ready to play.

    \n", + "example": [ + "
    \n\nfunction setup() {\n noCanvas();\n\n // Load a video and add it to the page.\n // Note: this may not work in some browsers.\n let video = createVideo('assets/small.mp4');\n // Show the default video controls.\n video.showControls();\n\n describe('A video of a toy robot with playback controls beneath it.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n noCanvas();\n\n // Load a video and add it to the page.\n // Provide an array options for different file formats.\n let video = createVideo(\n ['assets/small.mp4', 'assets/small.ogv', 'assets/small.webm']\n );\n // Show the default video controls.\n video.showControls();\n\n describe('A video of a toy robot with playback controls beneath it.');\n}\n\n
    \n\n
    \n\nlet video;\n\nfunction setup() {\n noCanvas();\n\n // Load a video and add it to the page.\n // Provide an array options for different file formats.\n // Call mute() once the video loads.\n video = createVideo(\n ['assets/small.mp4', 'assets/small.ogv', 'assets/small.webm'],\n muteVideo\n );\n // Show the default video controls.\n video.showControls();\n\n describe('A video of a toy robot with playback controls beneath it.');\n}\n\n// Mute the video once it loads.\nfunction muteVideo() {\n video.volume(0);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "src", + "description": "path to a video file, or an array of paths for\nsupporting different browsers.", + "type": "String|String[]" + }, + { + "name": "callback", + "description": "function to call once the video is ready to play.", + "optional": 1, + "type": "Function" + } + ], + "return": { + "description": "new p5.MediaElement object.", + "type": "p5.MediaElement" + } + } + ], + "return": { + "description": "new p5.MediaElement object.", + "type": "p5.MediaElement" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createAudio", + "file": "src/dom/dom.js", + "line": 2080, + "itemtype": "method", + "description": "

    Creates a hidden <audio> element for simple audio playback.\nReturns a new p5.MediaElement object.

    \n

    The first parameter, src, is the path the video. If a single string is\npassed, as in 'assets/video.mp4', a single video is loaded. An array\nof strings can be used to load the same video in different formats. For\nexample, ['assets/video.mp4', 'assets/video.ogv', 'assets/video.webm'].\nThis is useful for ensuring that the video can play across different\nbrowsers with different capabilities. See\nMDN\nfor more information about supported formats.

    \n

    The second parameter, callback, is optional. It's a function to call once\nthe audio is ready to play.

    \n", + "example": [ + "
    \n\nfunction setup() {\n noCanvas();\n\n // Load the audio.\n let beat = createAudio('assets/beat.mp3');\n // Show the default audio controls.\n beat.showControls();\n\n describe('An audio beat plays when the user double-clicks the square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "src", + "description": "path to an audio file, or an array of paths\nfor supporting different browsers.", + "optional": 1, + "type": "String|String[]" + }, + { + "name": "callback", + "description": "function to call once the audio is ready to play.", + "optional": 1, + "type": "Function" + } + ], + "return": { + "description": "new p5.MediaElement object.", + "type": "p5.MediaElement" + } + } + ], + "return": { + "description": "new p5.MediaElement object.", + "type": "p5.MediaElement" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createCapture", + "file": "src/dom/dom.js", + "line": 2212, + "itemtype": "method", + "description": "

    Creates a <video> element that \"captures\" the audio/video stream from\nthe webcam and microphone. Returns a new\np5.Element object.

    \n

    Videos are shown by default. They can be hidden by calling capture.hide()\nand drawn to the canvas using image().

    \n

    The first parameter, type, is optional. It sets the type of capture to\nuse. By default, createCapture() captures both audio and video. If VIDEO\nis passed, as in createCapture(VIDEO), only video will be captured.\nIf AUDIO is passed, as in createCapture(AUDIO), only audio will be\ncaptured. A constraints object can also be passed to customize the stream.\nSee the \nW3C documentation for possible properties. Different browsers support different\nproperties.

    \n

    The second parameter, callback, is optional. It's a function to call once\nthe capture is ready for use. The callback function should have one\nparameter, stream, that's a\nMediaStream object.

    \n

    Note: createCapture() only works when running a sketch locally or using HTTPS. Learn more\nhere\nand here.

    \n", + "example": [ + "
    \n\nfunction setup() {\n noCanvas();\n createCapture(VIDEO);\n\n describe('A video stream from the webcam.');\n}\n\n
    \n\n
    \n\nlet capture;\n\nfunction setup() {\n // Create the video capture and hide the element.\n capture = createCapture(VIDEO);\n capture.hide();\n\n describe('A video stream from the webcam with inverted colors.');\n}\n\nfunction draw() {\n // Draw the video capture within the canvas.\n image(capture, 0, 0, width, width * capture.height / capture.width);\n // Invert the colors in the stream.\n filter(INVERT);\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(480, 120);\n\n // Create a constraints object.\n let constraints = {\n video: {\n mandatory: {\n minWidth: 1280,\n minHeight: 720\n },\n optional: [{ maxFrameRate: 10 }]\n },\n audio: false\n };\n\n // Create the video capture.\n createCapture(constraints);\n\n describe('A video stream from the webcam.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "type", + "description": "type of capture, either AUDIO or VIDEO,\nor a constraints object. Both video and audio\naudio streams are captured by default.", + "optional": 1, + "type": "String|Constant|Object" + }, + { + "name": "callback", + "description": "function to call once the stream\nhas loaded.", + "optional": 1, + "type": "Function" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createElement", + "file": "src/dom/dom.js", + "line": 2311, + "itemtype": "method", + "description": "

    Creates a new p5.Element object.

    \n

    The first parameter, tag, is a string an HTML tag such as 'h5'.

    \n

    The second parameter, content, is optional. It's a string that sets the\nHTML content to insert into the new element. New elements have no content\nby default.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create an h5 element with nothing in it.\n createElement('h5');\n\n describe('A gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create an h5 element with the content\n // \"p5*js\".\n let h5 = createElement('h5', 'p5*js');\n // Set the element's style and position.\n h5.style('color', 'deeppink');\n h5.position(30, 15);\n\n describe('The text \"p5*js\" written in pink in the middle of a gray square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "tag", + "description": "tag for the new element.", + "type": "String" + }, + { + "name": "content", + "description": "HTML content to insert into the element.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + } + } + ], + "return": { + "description": "new p5.Element object.", + "type": "p5.Element" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "addClass", + "file": "src/dom/dom.js", + "line": 2337, + "itemtype": "method", + "chainable": 1, + "description": "Adds specified class to the element.", + "example": [ + "
    \nlet div = createDiv('div');\ndiv.addClass('myClass');\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "class", + "description": "name of class to add", + "type": "String" + } + ] + } + ], + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "removeClass", + "file": "src/dom/dom.js", + "line": 2373, + "itemtype": "method", + "chainable": 1, + "description": "Removes specified class from the element.", + "example": [ + "
    \n// In this example, a class is set when the div is created\n// and removed when mouse is pressed. This could link up\n// with a CSS style rule to toggle style properties.\n\nlet div;\n\nfunction setup() {\n div = createDiv('div');\n div.addClass('myClass');\n}\n\nfunction mousePressed() {\n div.removeClass('myClass');\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "class", + "description": "name of class to remove", + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "hasClass", + "file": "src/dom/dom.js", + "line": 2404, + "itemtype": "method", + "description": "Checks if specified class is already applied to element.", + "example": [ + "
    \nlet div;\n\nfunction setup() {\n div = createDiv('div');\n div.addClass('show');\n}\n\nfunction mousePressed() {\n if (div.hasClass('show')) {\n div.addClass('show');\n } else {\n div.removeClass('show');\n }\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "c", + "description": "{String} class name of class to check" + } + ], + "return": { + "description": "a boolean value if element has specified class", + "type": "boolean" + } + } + ], + "return": { + "description": "a boolean value if element has specified class", + "type": "boolean" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "toggleClass", + "file": "src/dom/dom.js", + "line": 2429, + "itemtype": "method", + "chainable": 1, + "description": "Toggles element class.", + "example": [ + "
    \nlet div;\n\nfunction setup() {\n div = createDiv('div');\n div.addClass('show');\n}\n\nfunction mousePressed() {\n div.toggleClass('show');\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "c", + "description": "{String} class name to toggle" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "child", + "file": "src/dom/dom.js", + "line": 2475, + "itemtype": "method", + "chainable": 1, + "description": "Attaches the element as a child to the parent specified.\nAccepts either a string ID, DOM node, or p5.Element.\nIf no argument is specified, an array of children DOM nodes is returned.", + "example": [ + "
    \nlet div0 = createDiv('this is the parent');\nlet div1 = createDiv('this is the child');\ndiv0.child(div1); // use p5.Element\n
    \n
    \nlet div0 = createDiv('this is the parent');\nlet div1 = createDiv('this is the child');\ndiv1.id('apples');\ndiv0.child('apples'); // use id\n
    \n
    \n// this example assumes there is a div already on the page\n// with id \"myChildDiv\"\nlet div0 = createDiv('this is the parent');\nlet elt = document.getElementById('myChildDiv');\ndiv0.child(elt); // use element from page\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "an array of child nodes", + "type": "Node[]" + } + }, + { + "params": [ + { + "name": "child", + "description": "the ID, DOM node, or p5.Element\nto add to the current element", + "optional": 1, + "type": "String|p5.Element" + } + ] + } + ], + "return": { + "description": "an array of child nodes", + "type": "Node[]" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "center", + "file": "src/dom/dom.js", + "line": 2513, + "itemtype": "method", + "chainable": 1, + "description": "Centers a p5.Element either vertically, horizontally,\nor both, relative to its parent or according to\nthe body if the p5.Element has no parent. If no argument is passed\nthe p5.Element is aligned both vertically and horizontally.", + "example": [ + "
    \nfunction setup() {\n let div = createDiv('').size(10, 10);\n div.style('background-color', 'orange');\n div.center();\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "align", + "description": "passing 'vertical', 'horizontal' aligns element accordingly", + "optional": 1, + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "html", + "file": "src/dom/dom.js", + "line": 2572, + "itemtype": "method", + "chainable": 1, + "description": "If an argument is given, sets the inner HTML of the element,\nreplacing any existing HTML. If true is included as a second\nargument, HTML is appended instead of replacing existing HTML.\nIf no arguments are given, returns\nthe inner HTML of the element.", + "example": [ + "
    \nlet div = createDiv('').size(100, 100);\ndiv.html('hi');\n
    \n
    \nlet div = createDiv('Hello ').size(100, 100);\ndiv.html('World', true);\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the inner HTML of the element", + "type": "String" + } + }, + { + "params": [ + { + "name": "html", + "description": "the HTML to be placed inside the element", + "optional": 1, + "type": "String" + }, + { + "name": "append", + "description": "whether to append HTML to existing", + "optional": 1, + "type": "boolean" + } + ] + } + ], + "return": { + "description": "the inner HTML of the element", + "type": "String" + }, + "class": "p5.Element", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "position", + "file": "src/dom/dom.js", + "line": 2624, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the position of the element. If no position type argument is given, the\nposition will be relative to (0, 0) of the window.\nEssentially, this sets position:absolute and left and top\nproperties of style. If an optional third argument specifying position type is given,\nthe x and y-coordinates will be interpreted based on the positioning scheme.\nIf no arguments given, the function returns the x and y position of the element.

    \n

    found documentation on how to be more specific with object type\nhttps://stackoverflow.com/questions/14714314/how-do-i-comment-object-literals-in-yuidoc

    \n", + "example": [ + "
    \nfunction setup() {\n let cnv = createCanvas(100, 100);\n // positions canvas 50px to the right and 100px\n // below upper left corner of the window\n cnv.position(50, 100);\n}\n
    \n
    \nfunction setup() {\n let cnv = createCanvas(100, 100);\n // positions canvas at upper left corner of the window\n // with a 'fixed' position type\n cnv.position(0, 0, 'fixed');\n}\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "object of form { x: 0, y: 0 } containing the position of the element in an object", + "type": "Object" + } + }, + { + "params": [ + { + "name": "x", + "description": "x-position relative to upper left of window (optional)", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "y-position relative to upper left of window (optional)", + "optional": 1, + "type": "Number" + }, + { + "name": "positionType", + "description": "it can be static, fixed, relative, sticky, initial or inherit (optional)", + "optional": 1, + "type": "String" + } + ] + } + ], + "return": { + "description": "object of form { x: 0, y: 0 } containing the position of the element in an object", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "style", + "file": "src/dom/dom.js", + "line": 2809, + "itemtype": "method", + "chainable": 1, + "description": "

    Applies a style to an element by adding a\nCSS declaration.

    \n

    The first parameter, property, is a string. If the name of a style\nproperty is passed, as in myElement.style('color'), the method returns\nthe current value as a string or null if it hasn't been set. If a\nproperty:style string is passed, as in\nmyElement.style('color:deeppink'), the method sets property to\nvalue.

    \n

    The second parameter, value, is optional. It sets the property's value.\nvalue can be a string, as in\nmyElement.style('color', 'deeppink'), or a\np5.Color object, as in\nmyElement.style('color', myColor).

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create a paragraph element and\n // set its font color to \"deeppink\".\n let p = createP('p5*js');\n p.position(25, 20);\n p.style('color', 'deeppink');\n\n describe('The text p5*js written in pink on a gray background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create a p5.Color object.\n let c = color('deeppink');\n\n // Create a paragraph element and\n // set its font color using a\n // p5.Color object.\n let p = createP('p5*js');\n p.position(25, 20);\n p.style('color', c);\n\n describe('The text p5*js written in pink on a gray background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create a paragraph element and\n // set its font color to \"deeppink\"\n // using property:value syntax.\n let p = createP('p5*js');\n p.position(25, 20);\n p.style('color:deeppink');\n\n describe('The text p5*js written in pink on a gray background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create an empty paragraph element\n // and set its font color to \"deeppink\".\n let p = createP();\n p.position(5, 5);\n p.style('color', 'deeppink');\n\n // Get the element's color as an\n // RGB color string.\n let c = p.style('color');\n\n // Set the element's inner HTML\n // using the RGB color string.\n p.html(c);\n\n describe('The text \"rgb(255, 20, 147)\" written in pink on a gray background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "property", + "description": "style property to set.", + "type": "String" + } + ], + "return": { + "description": "value of the property.", + "type": "String" + } + }, + { + "params": [ + { + "name": "property", + "type": "String" + }, + { + "name": "value", + "description": "value to assign to the property.", + "type": "String|p5.Color" + } + ], + "return": { + "description": "value of the property.", + "type": "String" + } + } + ], + "return": { + "description": "value of the property.", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "attribute", + "file": "src/dom/dom.js", + "line": 2925, + "itemtype": "method", + "chainable": 1, + "description": "

    Adds an\nattribute\nto the element. This method is useful for advanced tasks.

    \n

    Most commonly-used attributes, such as id, can be set with their\ndedicated methods. For example, nextButton.id('next') sets an element's\nid attribute.

    \n

    The first parameter, attr, is the attribute's name as a string. Calling\nmyElement.attribute('align') returns the attribute's current value as a\nstring or null if it hasn't been set.

    \n

    The second parameter, value, is optional. It's a string used to set the\nattribute's value. For example, calling\nmyElement.attribute('align', 'center') sets the element's horizontal\nalignment to center.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a container div and\n // place it at the top-left\n // corner.\n let container = createDiv();\n container.position(0, 0);\n\n // Create a paragraph element\n // and place it within the container.\n // Set its horizontal alignment to\n // \"left\".\n let p1 = createP('hi');\n p1.parent(container);\n p1.attribute('align', 'left');\n\n // Create a paragraph element\n // and place it within the container.\n // Set its horizontal alignment to\n // \"center\".\n let p2 = createP('hi');\n p2.parent(container);\n p2.attribute('align', 'center');\n\n // Create a paragraph element\n // and place it within the container.\n // Set its horizontal alignment to\n // \"right\".\n let p3 = createP('hi');\n p3.parent(container);\n p3.attribute('align', 'right');\n\n describe('A gray square with the text \"hi\" written on three separate lines, each placed further to the right.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "value of the attribute.", + "type": "String" + } + }, + { + "params": [ + { + "name": "attr", + "description": "attribute to set.", + "type": "String" + }, + { + "name": "value", + "description": "value to assign to the attribute.", + "type": "String" + } + ] + } + ], + "return": { + "description": "value of the attribute.", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "removeAttribute", + "file": "src/dom/dom.js", + "line": 2983, + "itemtype": "method", + "chainable": 1, + "description": "

    Removes an attribute from the element.

    \n

    The parameter attr is the attribute's name as a string. For example,\ncalling myElement.removeAttribute('align') removes its align\nattribute if it's been set.

    \n", + "example": [ + "
    \n\nlet p;\n\nfunction setup() {\n background(200);\n\n // Create a paragraph element and place it\n // in the center of the canvas.\n // Set its \"align\" attribute to \"center\".\n p = createP('hi');\n p.position(0, 20);\n p.attribute('align', 'center');\n\n describe('The text \"hi\" written in black at the center of a gray square. The text moves to the left edge when double-clicked.');\n}\n\nfunction doubleClicked() {\n p.removeAttribute('align');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "attr", + "description": "attribute to remove.", + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "value", + "file": "src/dom/dom.js", + "line": 3066, + "itemtype": "method", + "chainable": 1, + "description": "

    Returns or sets the element's value.

    \n

    Calling myElement.value() returns the element's current value.

    \n

    The parameter, value, is an optional number or string. If provided,\nas in myElement.value(123), it's used to set the element's value.

    \n", + "example": [ + "
    \n\nlet inp;\n\nfunction setup() {\n // Create a text input and place it\n // beneath the canvas. Set its default\n // value to \"hello\".\n inp = createInput('hello');\n inp.position(0, 100);\n\n describe('The text from an input box is displayed on a gray square.');\n}\n\nfunction draw() {\n background(200);\n\n // Use the input's value to display a message.\n let msg = inp.value();\n text(msg, 0, 55);\n}\n\n
    \n\n
    \n\nlet inp;\n\nfunction setup() {\n // Create a text input and place it\n // beneath the canvas. Set its default\n // value to \"hello\".\n inp = createInput('hello');\n inp.position(0, 100);\n\n describe('The text from an input box is displayed on a gray square. The text resets to \"hello\" when the user double-clicks the square.');\n}\n\nfunction draw() {\n background(200);\n\n // Use the input's value to display a message.\n let msg = inp.value();\n text(msg, 0, 55);\n}\n\n// Reset the input's value.\nfunction doubleClicked() {\n inp.value('hello');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "value of the element.", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "value", + "type": "String|Number" + } + ] + } + ], + "return": { + "description": "value of the element.", + "type": "String|Number" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "show", + "file": "src/dom/dom.js", + "line": 3105, + "itemtype": "method", + "chainable": 1, + "description": "Shows the current element.", + "example": [ + "
    \n\nlet p;\n\nfunction setup() {\n background(200);\n\n // Create a paragraph element and hide it.\n p = createP('p5*js');\n p.position(10, 10);\n p.hide();\n\n describe('A gray square. The text \"p5*js\" appears when the user double-clicks the square.');\n}\n\n// Show the paragraph when double-clicked.\nfunction doubleClicked() {\n p.show();\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "hide", + "file": "src/dom/dom.js", + "line": 3135, + "itemtype": "method", + "chainable": 1, + "description": "Hides the current element.", + "example": [ + "let p;\n\nfunction setup() {\n background(200);\n\n // Create a paragraph element.\n p = createP('p5*js');\n p.position(10, 10);\n\n describe('The text \"p5*js\" at the center of a gray square. The text disappears when the user double-clicks the square.');\n}\n\n// Hide the paragraph when double-clicked.\nfunction doubleClicked() {\n p.hide();\n}\n
    \n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "size", + "file": "src/dom/dom.js", + "line": 3250, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the element's width and height.

    \n

    Calling myElement.size() without an argument returns the element's size\nas an object with the properties width and height. For example,\n{ width: 20, height: 10 }.

    \n

    The first parameter, width, is optional. It's a number used to set the\nelement's width. Calling myElement.size(10)

    \n

    The second parameter, 'height, is also optional. It's a\nnumber used to set the element's height. For example, calling\nmyElement.size(20, 10)` sets the element's width to 20 pixels and height\nto 10 pixels.

    \n

    The constant AUTO can be used to adjust one dimension at a time while\nmaintaining the aspect ratio, which is width / height. For example,\nconsider an element that's 200 pixels wide and 100 pixels tall. Calling\nmyElement.size(20, AUTO) sets the width to 20 pixels and height to 10\npixels.

    \n

    Note: In the case of elements that need to load data, such as images, wait\nto call myElement.size() until after the data loads.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n // Create a pink div element and place it at\n // the top-left corner.\n let div = createDiv();\n div.position(10, 10);\n div.style('background-color', 'deeppink');\n\n // Set the div's width to 80 pixels and\n // height to 20 pixels.\n div.size(80, 20);\n\n describe('A gray square with a pink rectangle near its top.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Create a pink div element and place it at\n // the top-left corner.\n let div = createDiv();\n div.position(10, 10);\n div.style('background-color', 'deeppink');\n\n // Set the div's width to 80 pixels and\n // height to 40 pixels.\n div.size(80, 40);\n\n // Get the div's size as an object.\n let s = div.size();\n // Write the div's dimensions.\n div.html(`${s.width} x ${s.height}`);\n\n describe('A gray square with a pink rectangle near its top. The text \"80 x 40\" is written within the rectangle.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n // Load an image of an astronaut on the moon\n // and place it at the top-left of the canvas.\n let img1 = createImg(\n 'assets/moonwalk.jpg',\n 'An astronaut walking on the moon',\n ''\n );\n img1.position(0, 0);\n\n // Load an image of an astronaut on the moon\n // and place it at the top-left of the canvas.\n // Resize the image once it's loaded.\n let img2 = createImg(\n 'assets/moonwalk.jpg',\n 'An astronaut walking on the moon',\n '',\n () => {\n img2.size(50, AUTO);\n }\n );\n img2.position(0, 0);\n\n describe('A gray square two copies of a space image at the top-left. The copy in front is smaller.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "width and height of the element in an object.", + "type": "Object" + } + }, + { + "params": [ + { + "name": "w", + "description": "width of the element, either AUTO, or a number.", + "type": "Number|Constant" + }, + { + "name": "h", + "description": "height of the element, either AUTO, or a number.", + "optional": 1, + "type": "Number|Constant" + } + ] + } + ], + "return": { + "description": "width and height of the element in an object.", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "remove", + "file": "src/dom/dom.js", + "line": 3326, + "itemtype": "method", + "description": "Removes the element, stops all audio/video streams, and removes all\ncallback functions.", + "example": [ + "
    \n\nlet p;\n\nfunction setup() {\n background(200);\n\n // Create a paragraph element.\n p = createP('p5*js');\n p.position(10, 10);\n\n describe('The text \"p5*js\" written at the center of a gray square. ');\n}\n\n// Remove the paragraph when double-clicked.\nfunction doubleClicked() {\n p.remove();\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "drop", + "file": "src/dom/dom.js", + "line": 3466, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets a function to call when the user drops a file on the element.

    \n

    The first parameter, callback, is a function to call once the file loads.\nThe callback function should have one parameter, file, that's a\np5.File object. If the user drops multiple files on\nthe element, callback, is called once for each file.

    \n

    The second parameter, fxn, is a function to call when the browser detects\none or more dropped files. The callback function should have one\nparameter, event, that's a\nDragEvent.

    \n", + "example": [ + "
    \n\n// Drop an image on the canvas to view\n// this example.\nlet img;\n\nfunction setup() {\n let c = createCanvas(100, 100);\n\n background(200);\n\n // Call a function when a file\n // dropped on the canvas has\n // loaded.\n c.drop(file => {\n // Remove the current image, if any.\n if (img) {\n img.remove();\n }\n\n // Create an element with the\n // dropped file.\n img = createImg(file.data, '');\n img.hide();\n\n // Draw the image.\n image(img, 0, 0, width, height);\n });\n\n describe('A gray square. When the user drops an image on the square, it is displayed.');\n}\n\n
    \n\n
    \n\n// Drop an image on the canvas to view\n// this example.\nlet img;\nlet msg;\n\nfunction setup() {\n let c = createCanvas(100, 100);\n\n background(200);\n\n // Call functions when the user\n // drops a file on the canvas\n // and when the file loads.\n c.drop(handleFile, handleDrop);\n\n describe('A gray square. When the user drops an image on the square, it is displayed. The id attribute of canvas element is also displayed.');\n}\n\nfunction handleFile(file) {\n // Remove the current image, if any.\n if (img) {\n img.remove();\n }\n\n // Create an element with the\n // dropped file.\n img = createImg(file.data, '');\n img.hide();\n\n // Draw the image.\n image(img, 0, 0, width, height);\n}\n\nfunction handleDrop(event) {\n // Remove current paragraph, if any.\n if (msg) {\n msg.remove();\n }\n\n // Use event to get the drop\n // target's id.\n let id = event.target.id;\n\n // Write the canvas' id\n // beneath it.\n msg = createP(id);\n msg.position(0, 100);\n\n // Set the font color\n // randomly for each drop.\n let c = random(['red', 'green', 'blue']);\n msg.style('color', c);\n msg.style('font-size', '12px');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "callback", + "description": "called when a file loads. Called once for each file dropped.", + "type": "Function" + }, + { + "name": "fxn", + "description": "called once when any files are dropped.", + "optional": 1, + "type": "Function" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "draggable", + "file": "src/dom/dom.js", + "line": 3557, + "itemtype": "method", + "chainable": 1, + "description": "Turns p5.Element into a draggable item. If an argument is given, it will drag that p5.Element instead, ie. drag a entire GUI panel (parent container) with the panel's title bar.", + "example": [ + "
    \nfunction setup() {\n createCanvas(100, 100);\n background(200);\n\n createDiv('Post-It')\n .position(5, 5)\n .size(75, 20)\n .style('font-size', '16px')\n .style('background', 'yellow')\n .style('color', '#000')\n .style('border', '1px solid #aaaa00')\n .style('padding', '5px')\n .draggable();\n // .style('cursor', 'help') // override cursor\n\n let gui = createDiv('')\n .position(5, 40)\n .size(85, 50)\n .style('font-size', '16px')\n .style('background', 'yellow')\n .style('z-index', '100')\n .style('border', '1px solid #00aaaa');\n\n createDiv('= PANEL =')\n .parent(gui)\n .style('background', 'cyan')\n .style('padding', '2px')\n .style('text-align', 'center')\n .draggable(gui);\n\n createSlider(0, 100, random(100))\n .style('cursor', 'pointer')\n .size(80, 5)\n .parent(gui);\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "elmnt", + "description": "pass another p5.Element", + "optional": 1, + "type": "p5.Element" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "volume", + "file": "src/dom/dom.js", + "line": 4145, + "itemtype": "method", + "chainable": 1, + "description": "", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "val", + "description": "volume between 0.0 and 1.0.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "setMoveThreshold", + "file": "src/events/acceleration.js", + "line": 455, + "itemtype": "method", + "description": "The setMoveThreshold() function is used to set the movement threshold for\nthe deviceMoved() function. The default threshold is set to 0.5.", + "example": [ + "
    \n\n// Run this example on a mobile device\n// You will need to move the device incrementally further\n// the closer the square's color gets to white in order to change the value.\n\nlet value = 0;\nlet threshold = 0.5;\nfunction setup() {\n setMoveThreshold(threshold);\n}\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when device moves`);\n}\nfunction deviceMoved() {\n value = value + 5;\n threshold = threshold + 0.1;\n if (value > 255) {\n value = 0;\n threshold = 30;\n }\n setMoveThreshold(threshold);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "The threshold value", + "type": "number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Acceleration" + }, + { + "name": "setShakeThreshold", + "file": "src/events/acceleration.js", + "line": 497, + "itemtype": "method", + "description": "The setShakeThreshold() function is used to set the movement threshold for\nthe deviceShaken() function. The default threshold is set to 30.", + "example": [ + "
    \n\n// Run this example on a mobile device\n// You will need to shake the device more firmly\n// the closer the box's fill gets to white in order to change the value.\n\nlet value = 0;\nlet threshold = 30;\nfunction setup() {\n setShakeThreshold(threshold);\n}\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when device is being shaked`);\n}\nfunction deviceMoved() {\n value = value + 5;\n threshold = threshold + 5;\n if (value > 255) {\n value = 0;\n threshold = 30;\n }\n setShakeThreshold(threshold);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "The threshold value", + "type": "number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Acceleration" + }, + { + "name": "deviceMoved", + "file": "src/events/acceleration.js", + "line": 620, + "itemtype": "method", + "description": "The deviceMoved() function is called when the device is moved by more than\nthe threshold value along X, Y or Z axis. The default threshold is set to 0.5.\nThe threshold value can be changed using setMoveThreshold().", + "example": [ + "
    \n\n// Run this example on a mobile device\n// Move the device around\n// to change the value.\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when device moves`);\n}\nfunction deviceMoved() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Acceleration" + }, + { + "name": "deviceTurned", + "file": "src/events/acceleration.js", + "line": 620, + "itemtype": "method", + "description": "

    The deviceTurned() function is called when the device rotates by\nmore than 90 degrees continuously.

    \n

    The axis that triggers the deviceTurned() method is stored in the turnAxis\nvariable. The deviceTurned() method can be locked to trigger on any axis:\nX, Y or Z by comparing the turnAxis variable to 'X', 'Y' or 'Z'.

    \n", + "example": [ + "
    \n\n// Run this example on a mobile device\n// Rotate the device by 90 degrees\n// to change the value.\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when device turns`);\n}\nfunction deviceTurned() {\n if (value === 0) {\n value = 255;\n } else if (value === 255) {\n value = 0;\n }\n}\n\n
    \n
    \n\n// Run this example on a mobile device\n// Rotate the device by 90 degrees in the\n// X-axis to change the value.\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when x-axis turns`);\n}\nfunction deviceTurned() {\n if (turnAxis === 'X') {\n if (value === 0) {\n value = 255;\n } else if (value === 255) {\n value = 0;\n }\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Acceleration" + }, + { + "name": "deviceShaken", + "file": "src/events/acceleration.js", + "line": 620, + "itemtype": "method", + "description": "The deviceShaken() function is called when the device total acceleration\nchanges of accelerationX and accelerationY values is more than\nthe threshold value. The default threshold is set to 30.\nThe threshold value can be changed using setShakeThreshold().", + "example": [ + "
    \n\n// Run this example on a mobile device\n// Shake the device to change the value.\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`50-by-50 black rect in center of canvas.\n turns white on mobile when device shakes`);\n}\nfunction deviceShaken() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Acceleration" + }, + { + "name": "keyPressed", + "file": "src/events/keyboard.js", + "line": 167, + "itemtype": "method", + "description": "

    The keyPressed() function is called once every time a key is pressed. The\nkeyCode for the key that was pressed is stored in the keyCode variable.

    \n

    For non-ASCII keys, use the keyCode variable. You can check if the keyCode\nequals BACKSPACE, DELETE, ENTER, RETURN, TAB, ESCAPE, SHIFT, CONTROL,\nOPTION, ALT, UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW.

    \n

    For ASCII keys, the key that was pressed is stored in the key variable. However, it\ndoes not distinguish between uppercase and lowercase. For this reason, it\nis recommended to use keyTyped() to read the key variable, in which the\ncase of the variable will be distinguished.

    \n

    Because of how operating systems handle key repeats, holding down a key\nmay cause multiple calls to keyTyped() (and keyReleased() as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured.

    \nBrowsers may have different default\nbehaviors attached to various key events. To prevent any default\nbehavior for this event, add \"return false\" to the end of the method.

    \n", + "example": [ + "
    \n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`black rect center. turns white when key pressed and black\n when released.`);\n}\nfunction keyPressed() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n}\n\n
    \n
    \n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`black rect center. turns white when left arrow pressed and\n black when right.`);\n}\nfunction keyPressed() {\n if (keyCode === LEFT_ARROW) {\n value = 255;\n } else if (keyCode === RIGHT_ARROW) {\n value = 0;\n }\n}\n\n
    \n
    \n\nfunction keyPressed() {\n // Do something\n return false; // prevent any default behaviour\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "event", + "description": "optional KeyboardEvent callback argument.", + "optional": 1, + "type": "KeyboardEvent" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Keyboard" + }, + { + "name": "keyReleased", + "file": "src/events/keyboard.js", + "line": 215, + "itemtype": "method", + "description": "The keyReleased() function is called once every time a key is released.\nSee key and keyCode for more information.

    \nBrowsers may have different default\nbehaviors attached to various key events. To prevent any default\nbehavior for this event, add \"return false\" to the end of the function.", + "example": [ + "
    \n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`black rect center. turns white when key pressed and black\n when pressed again`);\n}\nfunction keyReleased() {\n if (value === 0) {\n value = 255;\n } else {\n value = 0;\n }\n return false; // prevent any default behavior\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "event", + "description": "optional KeyboardEvent callback argument.", + "optional": 1, + "type": "KeyboardEvent" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Keyboard" + }, + { + "name": "keyTyped", + "file": "src/events/keyboard.js", + "line": 275, + "itemtype": "method", + "description": "

    The keyTyped() function is called once every time a key is pressed, but\naction keys such as Backspace, Delete, Ctrl, Shift, and Alt are ignored. If you are trying to detect\na keyCode for one of these keys, use the keyPressed() function instead.\nThe most recent key typed will be stored in the key variable.

    \n

    Because of how operating systems handle key repeats, holding down a key\nwill cause multiple calls to keyTyped() (and keyReleased() as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured.

    \nBrowsers may have different default behaviors attached to various key\nevents. To prevent any default behavior for this event, add \"return false\"\nto the end of the function.

    \n", + "example": [ + "
    \n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`black rect center. turns white when 'a' key typed and\n black when 'b' pressed`);\n}\nfunction keyTyped() {\n if (key === 'a') {\n value = 255;\n } else if (key === 'b') {\n value = 0;\n }\n // uncomment to prevent any default behavior\n // return false;\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "event", + "description": "optional KeyboardEvent callback argument.", + "optional": 1, + "type": "KeyboardEvent" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Keyboard" + }, + { + "name": "keyIsDown", + "file": "src/events/keyboard.js", + "line": 372, + "itemtype": "method", + "description": "The keyIsDown() function checks if the key is currently down, i.e. pressed.\nIt can be used if you have an object that moves, and you want several keys\nto be able to affect its behaviour simultaneously, such as moving a\nsprite diagonally. You can put in any number representing the keyCode of\nthe key, or use any of the variable keyCode names listed\nhere.", + "example": [ + "
    \nlet x = 100;\nlet y = 100;\n\nfunction setup() {\n createCanvas(512, 512);\n fill(255, 0, 0);\n}\n\nfunction draw() {\n if (keyIsDown(LEFT_ARROW)) {\n x -= 5;\n }\n\n if (keyIsDown(RIGHT_ARROW)) {\n x += 5;\n }\n\n if (keyIsDown(UP_ARROW)) {\n y -= 5;\n }\n\n if (keyIsDown(DOWN_ARROW)) {\n y += 5;\n }\n\n clear();\n ellipse(x, y, 50, 50);\n describe(`50-by-50 red ellipse moves left, right, up, and\n down with arrow presses.`);\n}\n
    \n\n
    \nlet diameter = 50;\n\nfunction setup() {\n createCanvas(512, 512);\n}\n\nfunction draw() {\n // 107 and 187 are keyCodes for \"+\"\n if (keyIsDown(107) || keyIsDown(187)) {\n diameter += 1;\n }\n\n // 109 and 189 are keyCodes for \"-\"\n if (keyIsDown(109) || keyIsDown(189)) {\n diameter -= 1;\n }\n\n clear();\n fill(255, 0, 0);\n ellipse(50, 50, diameter, diameter);\n describe(`50-by-50 red ellipse gets bigger or smaller when\n + or - are pressed.`);\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "code", + "description": "The key to check for.", + "type": "Number" + } + ], + "return": { + "description": "whether key is down or not", + "type": "Boolean" + } + } + ], + "return": { + "description": "whether key is down or not", + "type": "Boolean" + }, + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Keyboard" + }, + { + "name": "mouseDragged", + "file": "src/events/mouse.js", + "line": 573, + "itemtype": "method", + "description": "The mouseDragged() function is called once every time the mouse moves and\na mouse button is pressed. If no mouseDragged() function is defined, the\ntouchMoved() function will be called instead if it is defined.

    \nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add \"return false\" to the end of the function.", + "example": [ + "
    \n\n// Drag the mouse across the page\n// to change its value\n\nlet value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n describe(`black 50-by-50 rect turns lighter with mouse click and\n drag until white, resets`);\n}\nfunction mouseDragged() {\n value = value + 5;\n if (value > 255) {\n value = 0;\n }\n}\n\n
    \n\n
    \n\nfunction mouseDragged() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n\n
    \n\n
    \n\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseDragged(event) {\n console.log(event);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "event", + "description": "optional MouseEvent callback argument.", + "optional": 1, + "type": "MouseEvent" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "requestPointerLock", + "file": "src/events/mouse.js", + "line": 982, + "itemtype": "method", + "description": "The function requestPointerLock()\nlocks the pointer to its current position and makes it invisible.\nUse movedX and movedY to get the difference the mouse was moved since\nthe last call of draw.\nNote that not all browsers support this feature.\nThis enables you to create experiences that aren't limited by the mouse moving out of the screen\neven if it is repeatedly moved into one direction.\nFor example, a first person perspective experience.", + "example": [ + "
    \n\nlet cam;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n requestPointerLock();\n cam = createCamera();\n}\n\nfunction draw() {\n background(255);\n cam.pan(-movedX * 0.001);\n cam.tilt(movedY * 0.001);\n sphere(25);\n describe(`3D scene moves according to mouse mouse movement in a\n first person perspective`);\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "exitPointerLock", + "file": "src/events/mouse.js", + "line": 1023, + "itemtype": "method", + "description": "The function exitPointerLock()\nexits a previously triggered pointer Lock\nfor example to make ui elements usable etc", + "example": [ + "
    \n\n//click the canvas to lock the pointer\n//click again to exit (otherwise escape)\nlet locked = false;\nfunction draw() {\n background(237, 34, 93);\n describe('cursor gets locked / unlocked on mouse-click');\n}\nfunction mouseClicked() {\n if (!locked) {\n locked = true;\n requestPointerLock();\n } else {\n exitPointerLock();\n locked = false;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Events", + "submodule": "Mouse" + }, + { + "name": "createImage", + "file": "src/image/image.js", + "line": 92, + "itemtype": "method", + "description": "

    Creates a new p5.Image object. The new image is\ntransparent by default.

    \n

    createImage() uses the width and height paremeters to set the new\np5.Image object's dimensions in pixels. The new\np5.Image can be modified by updating its\npixels array or by calling its\nget() and\nset() methods. The\nloadPixels() method must be called\nbefore reading or modifying pixel values. The\nupdatePixels() method must be called\nfor updates to take effect.

    \n", + "example": [ + "
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let x = 0; x < img.width; x += 1) {\n for (let y = 0; y < img.height; y += 1) {\n img.set(x, y, 0);\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    \n\n
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let x = 0; x < img.width; x += 1) {\n for (let y = 0; y < img.height; y += 1) {\n let a = map(x, 0, img.width, 0, 255);\n let c = color(0, a);\n img.set(x, y, c);\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A square with a horizontal color gradient that transitions from gray to black.');\n\n
    \n\n
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nlet d = pixelDensity();\nlet halfImage = 4 * (d * img.width) * (d * img.height / 2);\nfor (let i = 0; i < halfImage; i += 4) {\n // Red.\n img.pixels[i] = 0;\n // Green.\n img.pixels[i + 1] = 0;\n // Blue.\n img.pixels[i + 2] = 0;\n // Alpha.\n img.pixels[i + 3] = 255;\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "width", + "description": "width in pixels.", + "type": "Integer" + }, + { + "name": "height", + "description": "height in pixels.", + "type": "Integer" + } + ], + "return": { + "description": "new p5.Image object.", + "type": "p5.Image" + } + } + ], + "return": { + "description": "new p5.Image object.", + "type": "p5.Image" + }, + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "saveCanvas", + "file": "src/image/image.js", + "line": 173, + "itemtype": "method", + "description": "Saves the current canvas as an image. The browser will either save the\nfile immediately or prompt the user with a dialogue window.", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(255);\n saveCanvas();\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(255);\n saveCanvas('myCanvas.jpg');\n}\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(255);\n saveCanvas('myCanvas', 'jpg');\n}\n\n
    \n\n
    \n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(255);\n saveCanvas(cnv);\n}\n\n
    \n\n
    \n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(255);\n saveCanvas(cnv, 'myCanvas.jpg');\n}\n\n
    \n\n
    \n\nfunction setup() {\n let cnv = createCanvas(100, 100);\n background(255);\n saveCanvas(cnv, 'myCanvas', 'jpg');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "selectedCanvas", + "description": "reference to a\nspecific HTML5 canvas element.", + "type": "p5.Framebuffer|p5.Element|HTMLCanvasElement" + }, + { + "name": "filename", + "description": "file name. Defaults to 'untitled'.", + "optional": 1, + "type": "String" + }, + { + "name": "extension", + "description": "file extension, either 'jpg' or 'png'. Defaults to 'png'.", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "filename", + "optional": 1, + "type": "String" + }, + { + "name": "extension", + "optional": 1, + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "saveFrames", + "file": "src/image/image.js", + "line": 534, + "itemtype": "method", + "description": "

    Captures a sequence of frames from the canvas that can be used to create a\nmovie. Frames are downloaded as individual image files by default.

    \n

    The first parameter, filename, sets the prefix for the file names. For\nexample, setting the prefix to 'frame' would generate the image files\nframe0.png, frame1.png, and so on. The second parameter, extension,\nsets the file type to either 'png' or 'jpg'.

    \n

    The third parameter, duration, sets the duration to record in seconds.\nThe maximum duration is 15 seconds. The fourth parameter, framerate, sets\nthe number of frames to record per second. The maximum frame rate value is\n22. Limits are placed on duration and framerate to avoid using too much\nmemory. Recording large canvases can easily crash sketches or even web\nbrowsers.

    \n

    The fifth parameter, callback, is optional. If a function is passed,\nimage files won't be saved by default. The callback function can be used\nto process an array containing the data for each captured frame. The array\nof image data contains a sequence of objects with three properties for each\nframe: imageData, filename, and extension.

    \n", + "example": [ + "
    \n\nfunction draw() {\n let r = frameCount % 255;\n let g = 50;\n let b = 100;\n background(r, g, b);\n\n describe('A square repeatedly changes color from blue to pink.');\n}\n\nfunction keyPressed() {\n if (key === 's') {\n saveFrames('frame', 'png', 1, 5);\n }\n}\n\n
    \n\n
    \n\nfunction draw() {\n let r = frameCount % 255;\n let g = 50;\n let b = 100;\n background(r, g, b);\n\n describe('A square repeatedly changes color from blue to pink.');\n}\n\nfunction mousePressed() {\n saveFrames('frame', 'png', 1, 5, data => {\n // Prints an array of objects containing raw image data,\n // filenames, and extensions.\n print(data);\n });\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filename", + "description": "prefix of file name.", + "type": "String" + }, + { + "name": "extension", + "description": "file extension, either 'jpg' or 'png'.", + "type": "String" + }, + { + "name": "duration", + "description": "duration in seconds to record. This parameter will be constrained to be less or equal to 15.", + "type": "Number" + }, + { + "name": "framerate", + "description": "number of frames to save per second. This parameter will be constrained to be less or equal to 22.", + "type": "Number" + }, + { + "name": "callback", + "description": "callback function that will be executed\nto handle the image data. This function\nshould accept an array as argument. The\narray will contain the specified number of\nframes of objects. Each object has three\nproperties: imageData, filename, and extension.", + "optional": 1 + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "loadImage", + "file": "src/image/loading_displaying.js", + "line": 92, + "itemtype": "method", + "description": "

    Loads an image to create a p5.Image object.

    \n

    loadImage() interprets the first parameter one of three ways. If the path\nto an image file is provided, loadImage() will load it. Paths to local\nfiles should be relative, such as 'assets/thundercat.jpg'. URLs such as\n'https://example.com/thundercat.jpg' may be blocked due to browser\nsecurity. Raw image data can also be passed as a base64 encoded image in\nthe form 'data:image/png;base64,arandomsequenceofcharacters'.

    \n

    The second parameter is optional. If a function is passed, it will be\ncalled once the image has loaded. The callback function can optionally use\nthe new p5.Image object.

    \n

    The third parameter is also optional. If a function is passed, it will be\ncalled if the image fails to load. The callback function can optionally use\nthe event error.

    \n

    Images can take time to load. Calling loadImage() in\npreload() ensures images load before they're\nused in setup() or draw().

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n describe('Image of the underside of a white umbrella and a gridded ceiling.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n loadImage('assets/laDefense.jpg', img => {\n image(img, 0, 0);\n });\n describe('Image of the underside of a white umbrella and a gridded ceiling.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n loadImage('assets/laDefense.jpg', success, failure);\n}\n\nfunction success(img) {\n image(img, 0, 0);\n describe('Image of the underside of a white umbrella and a gridded ceiling.');\n}\n\nfunction failure(event) {\n console.error('Oops!', event);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "path of the image to be loaded or base64 encoded image.", + "type": "String" + }, + { + "name": "successCallback", + "description": "function called with\np5.Image once it\nloads.", + "optional": 1 + }, + { + "name": "failureCallback", + "description": "function called with event\nerror if the image fails to load.", + "optional": 1 + } + ], + "return": { + "description": "the p5.Image object.", + "type": "p5.Image" + } + } + ], + "return": { + "description": "the p5.Image object.", + "type": "p5.Image" + }, + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Loading & Displaying" + }, + { + "name": "saveGif", + "file": "src/image/loading_displaying.js", + "line": 247, + "itemtype": "method", + "description": "

    Generates a gif from a sketch and saves it to a file. saveGif() may be\ncalled in setup() or at any point while a sketch\nis running.

    \n

    The first parameter, fileName, sets the gif's file name. The second\nparameter, duration, sets the gif's duration in seconds.

    \n

    The third parameter, options, is optional. If an object is passed,\nsaveGif() will use its properties to customize the gif. saveGif()\nrecognizes the properties delay, units, silent,\nnotificationDuration, and notificationID.

    \n", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n let c = frameCount % 255;\n fill(c);\n circle(50, 50, 25);\n\n describe('A circle drawn in the middle of a gray square. The circle changes color from black to white, then repeats.');\n}\n\nfunction keyPressed() {\n if (key === 's') {\n saveGif('mySketch', 5);\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filename", + "description": "file name of gif.", + "type": "String" + }, + { + "name": "duration", + "description": "duration in seconds to capture from the sketch.", + "type": "Number" + }, + { + "name": "options", + "description": "an object that can contain five more properties:\ndelay, a Number specifying how much time to wait before recording;\nunits, a String that can be either 'seconds' or 'frames'. By default it's 'secondsā€™;\nsilent, a Boolean that defines presence of progress notifications. By default itā€™s false;\nnotificationDuration, a Number that defines how long in seconds the final notification\nwill live. By default it's 0, meaning the notification will never be removed;\nnotificationID, a String that specifies the id of the notification's DOM element. By default itā€™s 'progressBarā€™.", + "optional": 1, + "type": "Object" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Loading & Displaying" + }, + { + "name": "image", + "file": "src/image/loading_displaying.js", + "line": 1017, + "itemtype": "method", + "description": "

    Draws a source image to the canvas.

    \n

    The first parameter, img, is the source image to be drawn. The second and\nthird parameters, dx and dy, set the coordinates of the destination\nimage's top left corner. See imageMode() for\nother ways to position images.

    \n

    Here's a diagram that explains how optional parameters work in image():

    \n

    \n

    The fourth and fifth parameters, dw and dh, are optional. They set the\nthe width and height to draw the destination image. By default, image()\ndraws the full source image at its original size.

    \n

    The sixth and seventh parameters, sx and sy, are also optional.\nThese coordinates define the top left corner of a subsection to draw from\nthe source image.

    \n

    The eighth and ninth parameters, sw and sh, are also optional.\nThey define the width and height of a subsection to draw from the source\nimage. By default, image() draws the full subsection that begins at\n(sx, sy) and extends to the edges of the source image.

    \n

    The ninth parameter, fit, is also optional. It enables a subsection of\nthe source image to be drawn without affecting its aspect ratio. If\nCONTAIN is passed, the full subsection will appear within the destination\nrectangle. If COVER is passed, the subsection will completely cover the\ndestination rectangle. This may have the effect of zooming into the\nsubsection.

    \n

    The tenth and eleventh paremeters, xAlign and yAlign, are also\noptional. They determine how to align the fitted subsection. xAlign can\nbe set to either LEFT, RIGHT, or CENTER. yAlign can be set to\neither TOP, BOTTOM, or CENTER. By default, both xAlign and yAlign\nare set to CENTER.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n background(50);\n image(img, 0, 0);\n\n describe('An image of the underside of a white umbrella with a gridded ceiling above.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n background(50);\n image(img, 10, 10);\n\n describe('An image of the underside of a white umbrella with a gridded ceiling above. The image has dark gray borders on its left and top.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n background(50);\n image(img, 0, 0, 50, 50);\n\n describe('An image of the underside of a white umbrella with a gridded ceiling above. The image is drawn in the top left corner of a dark gray square.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n background(50);\n image(img, 25, 25, 50, 50, 25, 25, 50, 50);\n\n describe('An image of a gridded ceiling drawn in the center of a dark gray square.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/moonwalk.jpg');\n}\n\nfunction setup() {\n background(50);\n image(img, 0, 0, width, height, 0, 0, img.width, img.height, CONTAIN);\n\n describe('An image of an astronaut on the moon. The top and bottom borders of the image are dark gray.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n // Image is 50 x 50 pixels.\n img = loadImage('assets/laDefense50.png');\n}\n\nfunction setup() {\n background(50);\n image(img, 0, 0, width, height, 0, 0, img.width, img.height, COVER);\n\n describe('A pixelated image of the underside of a white umbrella with a gridded ceiling above.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "img", + "description": "image to display.", + "type": "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture" + }, + { + "name": "x", + "description": "x-coordinate of the top-left corner of the image.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the top-left corner of the image.", + "type": "Number" + }, + { + "name": "width", + "description": "width to draw the image.", + "optional": 1, + "type": "Number" + }, + { + "name": "height", + "description": "height to draw the image.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "img", + "type": "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture" + }, + { + "name": "dx", + "description": "the x-coordinate of the destination\nrectangle in which to draw the source image", + "type": "Number" + }, + { + "name": "dy", + "description": "the y-coordinate of the destination\nrectangle in which to draw the source image", + "type": "Number" + }, + { + "name": "dWidth", + "description": "the width of the destination rectangle", + "type": "Number" + }, + { + "name": "dHeight", + "description": "the height of the destination rectangle", + "type": "Number" + }, + { + "name": "sx", + "description": "the x-coordinate of the subsection of the source\nimage to draw into the destination rectangle", + "type": "Number" + }, + { + "name": "sy", + "description": "the y-coordinate of the subsection of the source\nimage to draw into the destination rectangle", + "type": "Number" + }, + { + "name": "sWidth", + "description": "the width of the subsection of the\nsource image to draw into the destination\nrectangle", + "optional": 1, + "type": "Number" + }, + { + "name": "sHeight", + "description": "the height of the subsection of the\nsource image to draw into the destination rectangle", + "optional": 1, + "type": "Number" + }, + { + "name": "fit", + "description": "either CONTAIN or COVER", + "optional": 1, + "type": "Constant" + }, + { + "name": "xAlign", + "description": "either LEFT, RIGHT or CENTER default is CENTER", + "optional": 1, + "type": "Constant" + }, + { + "name": "yAlign", + "description": "either TOP, BOTTOM or CENTER default is CENTER", + "optional": 1, + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Loading & Displaying" + }, + { + "name": "tint", + "file": "src/image/loading_displaying.js", + "line": 1232, + "itemtype": "method", + "description": "

    Tints images using a specified color.

    \n

    The version of tint() with one parameter interprets it one of four ways.\nIf the parameter is a number, it's interpreted as a grayscale value. If the\nparameter is a string, it's interpreted as a CSS color string. An array of\n[R, G, B, A] values or a p5.Color object can\nalso be used to set the tint color.

    \n

    The version of tint() with two parameters uses the first one as a\ngrayscale value and the second as an alpha value. For example, calling\ntint(255, 128) will make an image 50% transparent.

    \n

    The version of tint() with three parameters interprets them as RGB or\nHSB values, depending on the current\ncolorMode(). The optional fourth parameter\nsets the alpha value. For example, tint(255, 0, 0, 100) will give images\na red tint and make them transparent.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n tint('red');\n image(img, 50, 0);\n\n describe('Two images of an umbrella and a ceiling side-by-side. The image on the right has a red tint.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n tint(255, 0, 0);\n image(img, 50, 0);\n\n describe('Two images of an umbrella and a ceiling side-by-side. The image on the right has a red tint.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n tint(255, 0, 0, 100);\n image(img, 50, 0);\n\n describe('Two images of an umbrella and a ceiling side-by-side. The image on the right has a transparent red tint.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n tint(255, 180);\n image(img, 50, 0);\n\n describe('Two images of an umbrella and a ceiling side-by-side. The image on the right is transparent.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value.", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value.", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness.", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "CSS color string.", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "grayscale value.", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "array containing the red, green, blue &\nalpha components of the color.", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "the tint color", + "type": "p5.Color" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Loading & Displaying" + }, + { + "name": "noTint", + "file": "src/image/loading_displaying.js", + "line": 1262, + "itemtype": "method", + "description": "Removes the current tint set by tint() and restores\nimages to their original colors.", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\nfunction setup() {\n tint('red');\n image(img, 0, 0);\n noTint();\n image(img, 50, 0);\n\n describe('Two images of an umbrella and a ceiling side-by-side. The image on the left has a red tint.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Loading & Displaying" + }, + { + "name": "imageMode", + "file": "src/image/loading_displaying.js", + "line": 1353, + "itemtype": "method", + "description": "

    Changes the location from which images are drawn when\nimage() is called.

    \n

    By default, the first\ntwo parameters of image() are the x- and\ny-coordinates of the image's upper-left corner. The next parameters are\nits width and height. This is the same as calling imageMode(CORNER).

    \n

    imageMode(CORNERS) also uses the first two parameters of\nimage() as the x- and y-coordinates of the image's\ntop-left corner. The third and fourth parameters are the coordinates of its\nbottom-right corner.

    \n

    imageMode(CENTER) uses the first two parameters of\nimage() as the x- and y-coordinates of the image's\ncenter. The next parameters are its width and height.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n background(200);\n imageMode(CORNER);\n image(img, 10, 10, 50, 50);\n\n describe('A square image of a brick wall is drawn at the top left of a gray square.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n background(200);\n imageMode(CORNERS);\n image(img, 10, 10, 90, 40);\n\n describe('An image of a brick wall is drawn on a gray square. The image is squeezed into a small rectangular area.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n background(200);\n imageMode(CENTER);\n image(img, 50, 50, 80, 80);\n\n describe('A square image of a brick wall is drawn on a gray square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "either CORNER, CORNERS, or CENTER.", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Loading & Displaying" + }, + { + "name": "blend", + "file": "src/image/pixels.js", + "line": 198, + "itemtype": "method", + "description": "Copies a region of pixels from one image to another. The blendMode\nparameter blends the images' colors to create different effects.", + "example": [ + "
    \n\nlet img0;\nlet img1;\n\nfunction preload() {\n img0 = loadImage('assets/rockies.jpg');\n img1 = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n background(img0);\n image(img1, 0, 0);\n blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);\n\n describe('A wall of bricks in front of a mountain landscape. The same wall of bricks appears faded on the right of the image.');\n}\n\n
    \n\n
    \n\nlet img0;\nlet img1;\n\nfunction preload() {\n img0 = loadImage('assets/rockies.jpg');\n img1 = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n background(img0);\n image(img1, 0, 0);\n blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);\n\n describe('A wall of bricks in front of a mountain landscape. The same wall of bricks appears transparent on the right of the image.');\n}\n\n
    \n\n
    \n\nlet img0;\nlet img1;\n\nfunction preload() {\n img0 = loadImage('assets/rockies.jpg');\n img1 = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n background(img0);\n image(img1, 0, 0);\n blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, ADD);\n\n describe('A wall of bricks in front of a mountain landscape. The same wall of bricks appears washed out on the right of the image.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "source image.", + "type": "p5.Image" + }, + { + "name": "sx", + "description": "x-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sy", + "description": "y-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sw", + "description": "source image width.", + "type": "Integer" + }, + { + "name": "sh", + "description": "source image height.", + "type": "Integer" + }, + { + "name": "dx", + "description": "x-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dy", + "description": "y-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dw", + "description": "destination image width.", + "type": "Integer" + }, + { + "name": "dh", + "description": "destination image height.", + "type": "Integer" + }, + { + "name": "blendMode", + "description": "the blend mode. either\nBLEND, DARKEST, LIGHTEST, DIFFERENCE,\nMULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\nSOFT_LIGHT, DODGE, BURN, ADD or NORMAL.", + "type": "Constant" + } + ] + }, + { + "params": [ + { + "name": "sx", + "type": "Integer" + }, + { + "name": "sy", + "type": "Integer" + }, + { + "name": "sw", + "type": "Integer" + }, + { + "name": "sh", + "type": "Integer" + }, + { + "name": "dx", + "type": "Integer" + }, + { + "name": "dy", + "type": "Integer" + }, + { + "name": "dw", + "type": "Integer" + }, + { + "name": "dh", + "type": "Integer" + }, + { + "name": "blendMode", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Pixels" + }, + { + "name": "copy", + "file": "src/image/pixels.js", + "line": 257, + "itemtype": "method", + "description": "Copies pixels from a source image to a region of the canvas. The source\nimage can be the canvas itself or a p5.Image\nobject. copy() will scale pixels from the source region if it isn't the\nsame size as the destination region.", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n background(img);\n copy(img, 7, 22, 10, 10, 35, 25, 50, 50);\n // Show copied region.\n stroke(255);\n noFill();\n square(7, 22, 10);\n\n describe('An image of a mountain landscape. A square region is outlined in white. A larger square contains a pixelated view of the outlined region.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "source image.", + "type": "p5.Image|p5.Element" + }, + { + "name": "sx", + "description": "x-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sy", + "description": "y-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sw", + "description": "source image width.", + "type": "Integer" + }, + { + "name": "sh", + "description": "source image height.", + "type": "Integer" + }, + { + "name": "dx", + "description": "x-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dy", + "description": "y-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dw", + "description": "destination image width.", + "type": "Integer" + }, + { + "name": "dh", + "description": "destination image height.", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "sx", + "type": "Integer" + }, + { + "name": "sy", + "type": "Integer" + }, + { + "name": "sw", + "type": "Integer" + }, + { + "name": "sh", + "type": "Integer" + }, + { + "name": "dx", + "type": "Integer" + }, + { + "name": "dy", + "type": "Integer" + }, + { + "name": "dw", + "type": "Integer" + }, + { + "name": "dh", + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Pixels" + }, + { + "name": "filter", + "file": "src/image/pixels.js", + "line": 571, + "itemtype": "method", + "description": "

    Applies an image filter to the canvas. The preset options are:

    \n

    INVERT\nInverts the colors in the image. No parameter is used.

    \n

    GRAY\nConverts the image to grayscale. No parameter is used.

    \n

    THRESHOLD\nConverts the image to black and white. Pixels with a grayscale value\nabove a given threshold are converted to white. The rest are converted to\nblack. The threshold must be between 0.0 (black) and 1.0 (white). If no\nvalue is specified, 0.5 is used.

    \n

    OPAQUE\nSets the alpha channel to entirely opaque. No parameter is used.

    \n

    POSTERIZE\nLimits the number of colors in the image. Each color channel is limited to\nthe number of colors specified. Values between 2 and 255 are valid, but\nresults are most noticeable with lower values. The default value is 4.

    \n

    BLUR\nBlurs the image. The level of blurring is specified by a blur radius. Larger\nvalues increase the blur. The default value is 4. A gaussian blur is used\nin P2D mode. A box blur is used in WEBGL mode.

    \n

    ERODE\nReduces the light areas. No parameter is used.

    \n

    DILATE\nIncreases the light areas. No parameter is used.

    \n

    filter() uses WebGL in the background by default because it's faster.\nThis can be disabled in P2D mode by adding a false argument, as in\nfilter(BLUR, false). This may be useful to keep computation off the GPU\nor to work around a lack of WebGL support.

    \n

    In WEBGL mode, filter() can also use custom shaders. See\ncreateFilterShader() for more\ninformation.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(INVERT);\n\n describe('A blue brick wall.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(GRAY);\n\n describe('A brick wall drawn in grayscale.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(THRESHOLD);\n\n describe('A brick wall drawn in black and white.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(OPAQUE);\n\n describe('A red brick wall.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(POSTERIZE, 3);\n\n describe('An image of a red brick wall drawn with limited color palette.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(BLUR, 3);\n\n describe('A blurry image of a red brick wall.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(DILATE);\n\n describe('A red brick wall with bright lines between each brick.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n filter(ERODE);\n\n describe('A red brick wall with faint lines between each brick.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n // Don't use WebGL.\n filter(BLUR, 3, false);\n\n describe('A blurry image of a red brick wall.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filterType", + "description": "either THRESHOLD, GRAY, OPAQUE, INVERT,\nPOSTERIZE, BLUR, ERODE, DILATE or BLUR.", + "type": "Constant" + }, + { + "name": "filterParam", + "description": "parameter unique to each filter.", + "optional": 1, + "type": "Number" + }, + { + "name": "useWebGL", + "description": "flag to control whether to use fast\nWebGL filters (GPU) or original image\nfilters (CPU); defaults to true.", + "optional": 1, + "type": "Boolean" + } + ] + }, + { + "params": [ + { + "name": "filterType", + "type": "Constant" + }, + { + "name": "filterParam", + "optional": 1, + "type": "Number" + }, + { + "name": "useWebGL", + "optional": 1, + "type": "Boolean" + } + ] + }, + { + "params": [ + { + "name": "shaderFilter", + "description": "shader that's been loaded, with the\nfrag shader using a tex0 uniform.", + "type": "p5.Shader" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Pixels" + }, + { + "name": "get", + "file": "src/io/p5.TableRow.js", + "line": 223, + "itemtype": "method", + "description": "

    Gets a pixel or a region of pixels from the canvas.

    \n

    get() is easy to use but it's not as fast as\npixels. Use pixels\nto read many pixel values.

    \n

    The version of get() with no parameters returns the entire canvas.

    \n

    The version of get() with two parameters interprets them as\ncoordinates. It returns an array with the [R, G, B, A] values of the\npixel at the given point.

    \n

    The version of get() with four parameters interprets them as coordinates\nand dimensions. It returns a subsection of the canvas as a\np5.Image object. The first two parameters are the\ncoordinates for the upper-left corner of the subsection. The last two\nparameters are the width and height of the subsection.

    \n

    Use p5.Image.get() to work directly with\np5.Image objects.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let c = get();\n image(c, width / 2, 0);\n\n describe('Two identical mountain landscapes shown side-by-side.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let c = get(50, 90);\n fill(c);\n noStroke();\n square(25, 25, 50);\n\n describe('A mountain landscape with an olive green square in its center.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let c = get(0, 0, width / 2, height / 2);\n image(c, width / 2, height / 2);\n\n describe('A mountain landscape drawn on top of another mountain landscape.');\n}\n\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let names = [];\n let rows = table.getRows();\n for (let r = 0; r < rows.length; r++) {\n names.push(rows[r].get('name'));\n }\n\n print(names);\n\n describe('no image displayed');\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "w", + "description": "width of the subsection to be returned.", + "type": "Number" + }, + { + "name": "h", + "description": "height of the subsection to be returned.", + "type": "Number" + } + ], + "return": { + "description": "subsection as a p5.Image object.", + "type": "p5.Image" + } + }, + { + "params": [], + "return": { + "description": "whole canvas as a p5.Image.", + "type": "p5.Image" + } + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + } + ], + "return": { + "description": "color of the pixel at (x, y) in array format [R, G, B, A].", + "type": "Number[]" + } + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + } + ], + "return": { + "description": "subsection as a p5.Image object.", + "type": "p5.Image" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "loadPixels", + "file": "src/image/pixels.js", + "line": 797, + "itemtype": "method", + "description": "Loads the current value of each pixel on the canvas into the\npixels array. This\nfunction must be called before reading from or writing to\npixels.", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0, width, height);\n let d = pixelDensity();\n let halfImage = 4 * (d * width) * (d * height / 2);\n loadPixels();\n for (let i = 0; i < halfImage; i += 1) {\n pixels[i + halfImage] = pixels[i];\n }\n updatePixels();\n\n describe('Two identical images of mountain landscapes, one on top of the other.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Pixels" + }, + { + "name": "set", + "file": "src/io/p5.TableRow.js", + "line": 75, + "itemtype": "method", + "description": "

    Sets the color of a pixel or draws an image to the canvas.

    \n

    set() is easy to use but it's not as fast as\npixels. Use pixels\nto set many pixel values.

    \n

    set() interprets the first two parameters as x- and y-coordinates. It\ninterprets the last parameter as a grayscale value, a [R, G, B, A] pixel\narray, a p5.Color object, or a\np5.Image object. If an image is passed, the first\ntwo parameters set the coordinates for the image's upper-left corner,\nregardless of the current imageMode().

    \n

    updatePixels() must be called after using\nset() for changes to appear.

    \n", + "example": [ + "
    \n\nset(30, 20, 0);\nset(85, 20, 0);\nset(85, 75, 0);\nset(30, 75, 0);\nupdatePixels();\n\ndescribe('Four black dots arranged in a square drawn on a gray background.');\n\n
    \n\n
    \n\nlet black = color(0);\nset(30, 20, black);\nset(85, 20, black);\nset(85, 75, black);\nset(30, 75, black);\nupdatePixels();\n\ndescribe('Four black dots arranged in a square drawn on a gray background.');\n\n
    \n\n
    \n\nfor (let x = 0; x < width; x += 1) {\n for (let y = 0; y < height; y += 1) {\n let c = map(x, 0, width, 0, 255);\n set(x, y, c);\n }\n}\nupdatePixels();\n\ndescribe('A horiztonal color gradient from black to white.');\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n set(0, 0, img);\n updatePixels();\n\n describe('An image of a mountain landscape.');\n}\n\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "c", + "description": "grayscale value | pixel array |\np5.Color object | p5.Image to copy.", + "type": "Number|Number[]|Object" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (Number)\nor Title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "The value to be stored", + "type": "String|Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "updatePixels", + "file": "src/image/pixels.js", + "line": 925, + "itemtype": "method", + "description": "

    Updates the canvas with the RGBA values in the\npixels array.

    \n

    updatePixels() only needs to be called after changing values in the\npixels array. Such changes can be made directly\nafter calling loadPixels() or by calling\nset().

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0, width, height);\n let d = pixelDensity();\n let halfImage = 4 * (d * width) * (d * height / 2);\n loadPixels();\n for (let i = 0; i < halfImage; i += 1) {\n pixels[i + halfImage] = pixels[i];\n }\n updatePixels();\n\n describe('Two identical images of mountain landscapes, one on top of the other.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the upper-left corner of region\nto update.", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the upper-left corner of region\nto update.", + "optional": 1, + "type": "Number" + }, + { + "name": "w", + "description": "width of region to update.", + "optional": 1, + "type": "Number" + }, + { + "name": "h", + "description": "height of region to update.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Image", + "submodule": "Pixels" + }, + { + "name": "loadJSON", + "file": "src/io/files.js", + "line": 114, + "itemtype": "method", + "description": "

    Loads a JSON file from a file or a URL, and returns an Object.\nNote that even if the JSON file contains an Array, an Object will be\nreturned with index numbers as keys.

    \n

    This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. JSONP is supported via a polyfill and you\ncan pass in as the second argument an object with definitions of the json\ncallback following the syntax specified here.

    \n

    This method is suitable for fetching files up to size of 64MB.

    \n", + "example": [ + "Calling loadJSON() inside preload() guarantees to complete the\noperation before setup() and draw() are called.\n\n
    \n// Examples use USGS Earthquake API:\n// https://earthquake.usgs.gov/fdsnws/event/1/#methods\nlet earthquakes;\nfunction preload() {\n // Get the most recent earthquake in the database\n let url =\n'https://earthquake.usgs.gov/earthquakes/feed/v1.0/' +\n 'summary/all_day.geojson';\n earthquakes = loadJSON(url);\n}\n\nfunction setup() {\n noLoop();\n}\n\nfunction draw() {\n background(200);\n // Get the magnitude and name of the earthquake out of the loaded JSON\n let earthquakeMag = earthquakes.features[0].properties.mag;\n let earthquakeName = earthquakes.features[0].properties.place;\n ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);\n textAlign(CENTER);\n text(earthquakeName, 0, height - 30, width, 30);\n describe(`50Ɨ50 ellipse that changes from black to white\n depending on the current humidity`);\n}\n
    \n\nOutside of preload(), you may supply a callback function to handle the\nobject:\n
    \nfunction setup() {\n noLoop();\n let url =\n'https://earthquake.usgs.gov/earthquakes/feed/v1.0/' +\n 'summary/all_day.geojson';\n loadJSON(url, drawEarthquake);\n}\n\nfunction draw() {\n background(200);\n describe(`50Ɨ50 ellipse that changes from black to white\n depending on the current humidity`);\n}\n\nfunction drawEarthquake(earthquakes) {\n // Get the magnitude and name of the earthquake out of the loaded JSON\n let earthquakeMag = earthquakes.features[0].properties.mag;\n let earthquakeName = earthquakes.features[0].properties.place;\n ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);\n textAlign(CENTER);\n text(earthquakeName, 0, height - 30, width, 30);\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "name of the file or url to load", + "type": "String" + }, + { + "name": "jsonpOptions", + "description": "options object for jsonp related settings", + "optional": 1, + "type": "Object" + }, + { + "name": "datatype", + "description": "\"json\" or \"jsonp\"", + "optional": 1, + "type": "String" + }, + { + "name": "callback", + "description": "function to be executed after\nloadJSON() completes, data is passed\nin as first argument", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if\nthere is an error, response is passed\nin as first argument", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "JSON data", + "type": "Object|Array" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "datatype", + "type": "String" + }, + { + "name": "callback", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "", + "type": "Object|Array" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "callback", + "type": "function" + }, + { + "name": "errorCallback", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "", + "type": "Object|Array" + } + } + ], + "return": { + "description": "JSON data", + "type": "Object|Array" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "loadStrings", + "file": "src/io/files.js", + "line": 229, + "itemtype": "method", + "description": "

    Reads the contents of a file and creates a String array of its individual\nlines. If the name of the file is used as the parameter, as in the above\nexample, the file must be located in the sketch directory/folder.

    \n

    Alternatively, the file may be loaded from anywhere on the local\ncomputer using an absolute path (something that starts with / on Unix and\nLinux, or a drive letter on Windows), or the filename parameter can be a\nURL for a file found on a network.

    \n

    This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed.

    \n

    This method is suitable for fetching files up to size of 64MB.

    \n", + "example": [ + "Calling loadStrings() inside preload() guarantees to complete the\noperation before setup() and draw() are called.\n\n
    \nlet result;\nfunction preload() {\n result = loadStrings('assets/test.txt');\n}\n\nfunction setup() {\n background(200);\n text(random(result), 10, 10, 80, 80);\n describe(`randomly generated text from a file,\n for example \"i smell like butter\"`);\n}\n
    \n\nOutside of preload(), you may supply a callback function to handle the\nobject:\n\n
    \nfunction setup() {\n loadStrings('assets/test.txt', pickString);\n describe(`randomly generated text from a file,\n for example \"i have three feet\"`);\n}\n\nfunction pickString(result) {\n background(200);\n text(random(result), 10, 10, 80, 80);\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filename", + "description": "name of the file or url to load", + "type": "String" + }, + { + "name": "callback", + "description": "function to be executed after loadStrings()\ncompletes, Array is passed in as first\nargument", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if\nthere is an error, response is passed\nin as first argument", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "Array of Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "Array of Strings", + "type": "String[]" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "loadTable", + "file": "src/io/files.js", + "line": 361, + "itemtype": "method", + "description": "

    Reads the contents of a file or URL and creates a p5.Table object with\nits values. If a file is specified, it must be located in the sketch's\n\"data\" folder. The filename parameter can also be a URL to a file found\nonline. By default, the file is assumed to be comma-separated (in CSV\nformat). Table only looks for a header row if the 'header' option is\nincluded.

    \n

    This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling loadTable() inside preload()\nguarantees to complete the operation before setup() and draw() are called.\nOutside of preload(), you may supply a callback function to handle the\nobject:

    \n

    All files loaded and saved use UTF-8 encoding. This method is suitable for fetching files up to size of 64MB.

    \n", + "example": [ + "
    \n\n// Given the following CSV file called \"mammals.csv\"\n// located in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n //the file can be remote\n //table = loadTable(\"http://p5js.org/reference/assets/mammals.csv\",\n // \"csv\", \"header\");\n}\n\nfunction setup() {\n //count the columns\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n\n print(table.getColumn('name'));\n //[\"Goat\", \"Leopard\", \"Zebra\"]\n\n //cycle through the table\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(table.getString(r, c));\n }\n describe(`randomly generated text from a file,\n for example \"i smell like butter\"`);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filename", + "description": "name of the file or URL to load", + "type": "String" + }, + { + "name": "extension", + "description": "parse the table by comma-separated values \"csv\", semicolon-separated\nvalues \"ssv\", or tab-separated values \"tsv\"", + "optional": 1, + "type": "String" + }, + { + "name": "header", + "description": "\"header\" to indicate table has header row", + "optional": 1, + "type": "String" + }, + { + "name": "callback", + "description": "function to be executed after\nloadTable() completes. On success, the\nTable object is passed in as the\nfirst argument.", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if\nthere is an error, response is passed\nin as first argument", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "Table object containing data", + "type": "Object" + } + } + ], + "return": { + "description": "Table object containing data", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "loadXML", + "file": "src/io/files.js", + "line": 629, + "itemtype": "method", + "description": "

    Reads the contents of a file and creates an XML object with its values.\nIf the name of the file is used as the parameter, as in the above example,\nthe file must be located in the sketch directory/folder.

    \n

    Alternatively, the file maybe be loaded from anywhere on the local\ncomputer using an absolute path (something that starts with / on Unix and\nLinux, or a drive letter on Windows), or the filename parameter can be a\nURL for a file found on a network.

    \n

    This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling loadXML() inside preload()\nguarantees to complete the operation before setup() and draw() are called.

    \n

    Outside of preload(), you may supply a callback function to handle the\nobject.

    \n

    This method is suitable for fetching files up to size of 64MB.

    \n", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let children = xml.getChildren('animal');\n\n for (let i = 0; i < children.length; i++) {\n let id = children[i].getNum('id');\n let coloring = children[i].getString('species');\n let name = children[i].getContent();\n print(id + ', ' + coloring + ', ' + name);\n }\n describe('no image displayed');\n}\n\n// Sketch prints:\n// 0, Capra hircus, Goat\n// 1, Panthera pardus, Leopard\n// 2, Equus zebra, Zebra\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filename", + "description": "name of the file or URL to load", + "type": "String" + }, + { + "name": "callback", + "description": "function to be executed after loadXML()\ncompletes, XML object is passed in as\nfirst argument", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if\nthere is an error, response is passed\nin as first argument", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "XML object containing data", + "type": "Object" + } + } + ], + "return": { + "description": "XML object containing data", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "loadBytes", + "file": "src/io/files.js", + "line": 700, + "itemtype": "method", + "description": "This method is suitable for fetching files up to size of 64MB.", + "example": [ + "
    \nlet data;\n\nfunction preload() {\n data = loadBytes('assets/mammals.xml');\n}\n\nfunction setup() {\n for (let i = 0; i < 5; i++) {\n console.log(data.bytes[i].toString(16));\n }\n describe('no image displayed');\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "file", + "description": "name of the file or URL to load", + "type": "string" + }, + { + "name": "callback", + "description": "function to be executed after loadBytes()\ncompletes", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if there\nis an error", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "an object whose 'bytes' property will be the loaded buffer", + "type": "Object" + } + } + ], + "return": { + "description": "an object whose 'bytes' property will be the loaded buffer", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "httpGet", + "file": "src/io/files.js", + "line": 800, + "itemtype": "method", + "description": "Method for executing an HTTP GET request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text. This is equivalent to\ncalling httpDo(path, 'GET'). The 'binary' datatype will return\na Blob object, and the 'arrayBuffer' datatype will return an ArrayBuffer\nwhich can be used to initialize typed arrays (such as Uint8Array).", + "example": [ + "
    \n// Examples use USGS Earthquake API:\n// https://earthquake.usgs.gov/fdsnws/event/1/#methods\nlet earthquakes;\nfunction preload() {\n // Get the most recent earthquake in the database\n let url =\n'https://earthquake.usgs.gov/fdsnws/event/1/query?' +\n 'format=geojson&limit=1&orderby=time';\n httpGet(url, 'json', function(response) {\n // when the HTTP request completes, populate the variable that holds the\n // earthquake data used in the visualization.\n earthquakes = response;\n });\n}\n\nfunction draw() {\n if (!earthquakes) {\n // Wait until the earthquake data has loaded before drawing.\n return;\n }\n background(200);\n // Get the magnitude and name of the earthquake out of the loaded JSON\n let earthquakeMag = earthquakes.features[0].properties.mag;\n let earthquakeName = earthquakes.features[0].properties.place;\n ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);\n textAlign(CENTER);\n text(earthquakeName, 0, height - 30, width, 30);\n noLoop();\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "name of the file or url to load", + "type": "String" + }, + { + "name": "datatype", + "description": "\"json\", \"jsonp\", \"binary\", \"arrayBuffer\",\n\"xml\", or \"text\"", + "optional": 1, + "type": "String" + }, + { + "name": "data", + "description": "param data passed sent with request", + "optional": 1, + "type": "Object|Boolean" + }, + { + "name": "callback", + "description": "function to be executed after\nhttpGet() completes, data is passed in\nas first argument", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if\nthere is an error, response is passed\nin as first argument", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs.", + "type": "Promise" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "data", + "type": "Object|Boolean" + }, + { + "name": "callback", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "", + "type": "Promise" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "callback", + "type": "function" + }, + { + "name": "errorCallback", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "", + "type": "Promise" + } + } + ], + "return": { + "description": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs.", + "type": "Promise" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "httpPost", + "file": "src/io/files.js", + "line": 890, + "itemtype": "method", + "description": "Method for executing an HTTP POST request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text. This is equivalent to\ncalling httpDo(path, 'POST').", + "example": [ + "
    \n\n// Examples use jsonplaceholder.typicode.com for a Mock Data API\n\nlet url = 'https://jsonplaceholder.typicode.com/posts';\nlet postData = { userId: 1, title: 'p5 Clicked!', body: 'p5.js is very cool.' };\n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n}\n\nfunction mousePressed() {\n httpPost(url, 'json', postData, function(result) {\n strokeWeight(2);\n text(result.body, mouseX, mouseY);\n });\n}\n\n
    \n\n
    \nlet url = 'ttps://invalidURL'; // A bad URL that will cause errors\nlet postData = { title: 'p5 Clicked!', body: 'p5.js is very cool.' };\n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n}\n\nfunction mousePressed() {\n httpPost(\n url,\n 'json',\n postData,\n function(result) {\n // ... won't be called\n },\n function(error) {\n strokeWeight(2);\n text(error.toString(), mouseX, mouseY);\n }\n );\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "name of the file or url to load", + "type": "String" + }, + { + "name": "datatype", + "description": "\"json\", \"jsonp\", \"xml\", or \"text\".\nIf omitted, httpPost() will guess.", + "optional": 1, + "type": "String" + }, + { + "name": "data", + "description": "param data passed sent with request", + "optional": 1, + "type": "Object|Boolean" + }, + { + "name": "callback", + "description": "function to be executed after\nhttpPost() completes, data is passed in\nas first argument", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if\nthere is an error, response is passed\nin as first argument", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs.", + "type": "Promise" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "data", + "type": "Object|Boolean" + }, + { + "name": "callback", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "", + "type": "Promise" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "callback", + "type": "function" + }, + { + "name": "errorCallback", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "", + "type": "Promise" + } + } + ], + "return": { + "description": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs.", + "type": "Promise" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "httpDo", + "file": "src/io/files.js", + "line": 979, + "itemtype": "method", + "description": "Method for executing an HTTP request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text.

    \nFor more advanced use, you may also pass in the path as the first argument\nand a object as the second argument, the signature follows the one specified\nin the Fetch API specification.\nThis method is suitable for fetching files up to size of 64MB when \"GET\" is used.", + "example": [ + "
    \n\n// Examples use USGS Earthquake API:\n// https://earthquake.usgs.gov/fdsnws/event/1/#methods\n\n// displays an animation of all USGS earthquakes\nlet earthquakes;\nlet eqFeatureIndex = 0;\n\nfunction preload() {\n let url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson';\n httpDo(\n url,\n {\n method: 'GET',\n // Other Request options, like special headers for apis\n headers: { authorization: 'Bearer secretKey' }\n },\n function(res) {\n earthquakes = res;\n }\n );\n}\n\nfunction draw() {\n // wait until the data is loaded\n if (!earthquakes || !earthquakes.features[eqFeatureIndex]) {\n return;\n }\n clear();\n\n let feature = earthquakes.features[eqFeatureIndex];\n let mag = feature.properties.mag;\n let rad = mag / 11 * ((width + height) / 2);\n fill(255, 0, 0, 100);\n ellipse(width / 2 + random(-2, 2), height / 2 + random(-2, 2), rad, rad);\n\n if (eqFeatureIndex >= earthquakes.features.length) {\n eqFeatureIndex = 0;\n } else {\n eqFeatureIndex += 1;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "name of the file or url to load", + "type": "String" + }, + { + "name": "method", + "description": "either \"GET\", \"POST\", or \"PUT\",\ndefaults to \"GET\"", + "optional": 1, + "type": "String" + }, + { + "name": "datatype", + "description": "\"json\", \"jsonp\", \"xml\", or \"text\"", + "optional": 1, + "type": "String" + }, + { + "name": "data", + "description": "param data passed sent with request", + "optional": 1, + "type": "Object" + }, + { + "name": "callback", + "description": "function to be executed after\nhttpGet() completes, data is passed in\nas first argument", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "function to be executed if\nthere is an error, response is passed\nin as first argument", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs.", + "type": "Promise" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "options", + "description": "Request object options as documented in the\n\"fetch\" API\nreference", + "type": "Object" + }, + { + "name": "callback", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "", + "type": "Promise" + } + } + ], + "return": { + "description": "A promise that resolves with the data when the operation\ncompletes successfully or rejects with the error after\none occurs.", + "type": "Promise" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "createWriter", + "file": "src/io/files.js", + "line": 1140, + "itemtype": "method", + "description": "", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n text('click here to save', 10, 10, 70, 80);\n}\n\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n const writer = createWriter('squares.txt');\n for (let i = 0; i < 10; i++) {\n writer.print(i * i);\n }\n writer.close();\n writer.clear();\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "name of the file to be created", + "type": "String" + }, + { + "name": "extension", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "p5.PrintWriter" + } + } + ], + "return": { + "description": "", + "type": "p5.PrintWriter" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "write", + "file": "src/io/files.js", + "line": 1224, + "itemtype": "method", + "description": "Writes data to the PrintWriter stream", + "example": [ + "
    \n\n// creates a file called 'newFile.txt'\nlet writer = createWriter('newFile.txt');\n// write 'Hello world!'' to the file\nwriter.write(['Hello world!']);\n// close the PrintWriter and save the file\nwriter.close();\n\n
    \n
    \n\n// creates a file called 'newFile2.txt'\nlet writer = createWriter('newFile2.txt');\n// write 'apples,bananas,123' to the file\nwriter.write(['apples', 'bananas', 123]);\n// close the PrintWriter and save the file\nwriter.close();\n\n
    \n
    \n\n// creates a file called 'newFile3.txt'\nlet writer = createWriter('newFile3.txt');\n// write 'My name is: Teddy' to the file\nwriter.write('My name is:');\nwriter.write(' Teddy');\n// close the PrintWriter and save the file\nwriter.close();\n\n
    \n
    \n\nfunction setup() {\n createCanvas(100, 100);\n button = createButton('SAVE FILE');\n button.position(21, 40);\n button.mousePressed(createFile);\n}\n\nfunction createFile() {\n // creates a file called 'newFile.txt'\n let writer = createWriter('newFile.txt');\n // write 'Hello world!'' to the file\n writer.write(['Hello world!']);\n // close the PrintWriter and save the file\n writer.close();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "data", + "description": "all data to be written by the PrintWriter", + "type": "Array" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "close", + "file": "src/io/files.js", + "line": 1325, + "itemtype": "method", + "description": "Closes the PrintWriter", + "example": [ + "
    \n\n// create a file called 'newFile.txt'\nlet writer = createWriter('newFile.txt');\n// close the PrintWriter and save the file\nwriter.close();\n\n
    \n
    \n\n// create a file called 'newFile2.txt'\nlet writer = createWriter('newFile2.txt');\n// write some data to the file\nwriter.write([100, 101, 102]);\n// close the PrintWriter and save the file\nwriter.close();\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "save", + "file": "src/io/files.js", + "line": 1448, + "itemtype": "method", + "description": "Saves a given element(image, text, json, csv, wav, or html) to the client's\ncomputer. The first parameter can be a pointer to element we want to save.\nThe element can be one of p5.Element,an Array of\nStrings, an Array of JSON, a JSON object, a p5.Table\n, a p5.Image, or a p5.SoundFile (requires\np5.sound). The second parameter is a filename (including extension).The\nthird parameter is for options specific to this type of object. This method\nwill save a file that fits the given parameters.\nIf it is called without specifying an element, by default it will save the\nwhole canvas as an image file. You can optionally specify a filename as\nthe first parameter in such a case.\nNote that it is not recommended to\ncall this method within draw, as it will open a new save dialog on every\nrender.", + "example": [ + "
    \n// Saves the canvas as an image\ncnv = createCanvas(300, 300);\nsave(cnv, 'myCanvas.jpg');\n\n// Saves the canvas as an image by default\nsave('myCanvas.jpg');\ndescribe('An example for saving a canvas as an image.');\n
    \n\n
    \n// Saves p5.Image as an image\nimg = createImage(10, 10);\nsave(img, 'myImage.png');\ndescribe('An example for saving a p5.Image element as an image.');\n
    \n\n
    \n// Saves p5.Renderer object as an image\nobj = createGraphics(100, 100);\nsave(obj, 'myObject.png');\ndescribe('An example for saving a p5.Renderer element.');\n
    \n\n
    \nlet myTable = new p5.Table();\n// Saves table as html file\nsave(myTable, 'myTable.html');\n\n// Comma Separated Values\nsave(myTable, 'myTable.csv');\n\n// Tab Separated Values\nsave(myTable, 'myTable.tsv');\n\ndescribe(`An example showing how to save a table in formats of\n HTML, CSV and TSV.`);\n
    \n\n
    \nlet myJSON = { a: 1, b: true };\n\n// Saves pretty JSON\nsave(myJSON, 'my.json');\n\n// Optimizes JSON filesize\nsave(myJSON, 'my.json', true);\n\ndescribe('An example for saving JSON to a txt file with some extra arguments.');\n
    \n\n
    \n// Saves array of strings to text file with line breaks after each item\nlet arrayOfStrings = ['a', 'b'];\nsave(arrayOfStrings, 'my.txt');\ndescribe(`An example for saving an array of strings to text file\n with line breaks.`);\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "objectOrFilename", + "description": "If filename is provided, will\nsave canvas as an image with\neither png or jpg extension\ndepending on the filename.\nIf object is provided, will\nsave depending on the object\nand filename (see examples\nabove).", + "optional": 1, + "type": "Object|String" + }, + { + "name": "filename", + "description": "If an object is provided as the first\nparameter, then the second parameter\nindicates the filename,\nand should include an appropriate\nfile extension (see examples above).", + "optional": 1, + "type": "String" + }, + { + "name": "options", + "description": "Additional options depend on\nfiletype. For example, when saving JSON,\ntrue indicates that the\noutput will be optimized for filesize,\nrather than readability.", + "optional": 1, + "type": "Boolean|String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "saveJSON", + "file": "src/io/files.js", + "line": 1536, + "itemtype": "method", + "description": "Writes the contents of an Array or a JSON object to a .json file.\nThe file saving process and location of the saved file will\nvary between web browsers.", + "example": [ + "
    \nlet json = {}; // new JSON Object\n\njson.id = 0;\njson.species = 'Panthera leo';\njson.name = 'Lion';\n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n text('click here to save', 10, 10, 70, 80);\n describe('no image displayed');\n}\n\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n saveJSON(json, 'lion.json');\n }\n}\n\n// saves the following to a file called \"lion.json\":\n// {\n// \"id\": 0,\n// \"species\": \"Panthera leo\",\n// \"name\": \"Lion\"\n// }\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "json", + "type": "Array|Object" + }, + { + "name": "filename", + "type": "String" + }, + { + "name": "optimize", + "description": "If true, removes line breaks\nand spaces from the output\nfile to optimize filesize\n(but not readability).", + "optional": 1, + "type": "Boolean" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "saveStrings", + "file": "src/io/files.js", + "line": 1588, + "itemtype": "method", + "description": "Writes an array of Strings to a text file, one line per String.\nThe file saving process and location of the saved file will\nvary between web browsers.", + "example": [ + "
    \nlet words = 'apple bear cat dog';\n\n// .split() outputs an Array\nlet list = split(words, ' ');\n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n text('click here to save', 10, 10, 70, 80);\n describe('no image displayed');\n}\n\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n saveStrings(list, 'nouns.txt');\n }\n}\n\n// Saves the following to a file called 'nouns.txt':\n//\n// apple\n// bear\n// cat\n// dog\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "list", + "description": "string array to be written", + "type": "String[]" + }, + { + "name": "filename", + "description": "filename for output", + "type": "String" + }, + { + "name": "extension", + "description": "the filename's extension", + "optional": 1, + "type": "String" + }, + { + "name": "isCRLF", + "description": "if true, change line-break to CRLF", + "optional": 1, + "type": "Boolean" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "saveTable", + "file": "src/io/files.js", + "line": 1650, + "itemtype": "method", + "description": "Writes the contents of a Table object to a file. Defaults to a\ntext file with comma-separated-values ('csv') but can also\nuse tab separation ('tsv'), or generate an HTML table ('html').\nThe file saving process and location of the saved file will\nvary between web browsers.", + "example": [ + "
    \nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('id');\n table.addColumn('species');\n table.addColumn('name');\n\n let newRow = table.addRow();\n newRow.setNum('id', table.getRowCount() - 1);\n newRow.setString('species', 'Panthera leo');\n newRow.setString('name', 'Lion');\n\n // To save, un-comment next line then click 'run'\n // saveTable(table, 'new.csv');\n\n describe('no image displayed');\n}\n\n// Saves the following to a file called 'new.csv':\n// id,species,name\n// 0,Panthera leo,Lion\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "Table", + "description": "the Table object to save to a file", + "type": "p5.Table" + }, + { + "name": "filename", + "description": "the filename to which the Table should be saved", + "type": "String" + }, + { + "name": "options", + "description": "can be one of \"tsv\", \"csv\", or \"html\"", + "optional": 1, + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "abs", + "file": "src/math/calculation.js", + "line": 36, + "itemtype": "method", + "description": "Calculates the absolute value of a number. A number's absolute value is its\ndistance from zero on the number line. -5 and 5 are both five units away\nfrom zero, so calling abs(-5) and abs(5) both return 5. The absolute\nvalue of a number is always positive.", + "example": [ + "
    \n\nfunction draw() {\n // Invert the y-axis.\n scale(1, -1);\n translate(0, -height);\n\n let centerX = width / 2;\n let x = frameCount;\n let y = abs(x - centerX);\n point(x, y);\n\n describe('A series of black dots that form a \"V\" shape.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number to compute.", + "type": "Number" + } + ], + "return": { + "description": "absolute value of given number.", + "type": "Number" + } + } + ], + "return": { + "description": "absolute value of given number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "ceil", + "file": "src/math/calculation.js", + "line": 66, + "itemtype": "method", + "description": "Calculates the closest integer value that is greater than or equal to the\nparameter's value. For example, calling ceil(9.03) returns the value\n10.", + "example": [ + "
    \n\n// Set the range for RGB values from 0 to 1.\ncolorMode(RGB, 1);\nnoStroke();\n\nlet r = 0.3;\nfill(r, 0, 0);\nrect(0, 0, width / 2, height);\n\n// Round r up to 1.\nr = ceil(r);\nfill(r, 0, 0);\nrect(width / 2, 0, width / 2, height);\n\ndescribe('Two rectangles. The one on the left is dark red and the one on the right is bright red.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number to round up.", + "type": "Number" + } + ], + "return": { + "description": "rounded up number.", + "type": "Integer" + } + } + ], + "return": { + "description": "rounded up number.", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "constrain", + "file": "src/math/calculation.js", + "line": 118, + "itemtype": "method", + "description": "Constrains a number between a minimum and maximum value.", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n\n let x = constrain(mouseX, 33, 67);\n let y = 50;\n\n strokeWeight(5);\n point(x, y);\n\n describe('A black dot drawn on a gray square follows the mouse from left to right. Its movement is constrained to the middle third of the square.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n // Set boundaries and draw them.\n let leftWall = width * 0.25;\n let rightWall = width * 0.75;\n line(leftWall, 0, leftWall, height);\n line(rightWall, 0, rightWall, height);\n\n // Draw a circle that follows the mouse freely.\n fill(255);\n circle(mouseX, height / 3, 9);\n\n // Draw a circle that's constrained.\n let xc = constrain(mouseX, leftWall, rightWall);\n fill(0);\n circle(xc, 2 * height / 3, 9);\n\n describe('Two vertical lines. Two circles move horizontally with the mouse. One circle stops at the vertical lines.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number to constrain.", + "type": "Number" + }, + { + "name": "low", + "description": "minimum limit.", + "type": "Number" + }, + { + "name": "high", + "description": "maximum limit.", + "type": "Number" + } + ], + "return": { + "description": "constrained number.", + "type": "Number" + } + } + ], + "return": { + "description": "constrained number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "dist", + "file": "src/math/calculation.js", + "line": 172, + "itemtype": "method", + "description": "

    Calculates the distance between two points.

    \n

    The version of dist() with four parameters calculates distance in two\ndimensions.

    \n

    The version of dist() with six parameters calculates distance in three\ndimensions.

    \n

    Use p5.Vector.dist() to calculate the\ndistance between two p5.Vector objects.

    \n", + "example": [ + "
    \n\nlet x1 = 10;\nlet y1 = 50;\nlet x2 = 90;\nlet y2 = 50;\n\nline(x1, y1, x2, y2);\nstrokeWeight(5);\npoint(x1, y1);\npoint(x2, y2);\n\nlet d = dist(x1, y1, x2, y2);\ntext(d, 43, 40);\n\ndescribe('Two dots connected by a horizontal line. The number 80 is written above the center of the line.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "x-coordinate of the first point.", + "type": "Number" + }, + { + "name": "y1", + "description": "y-coordinate of the first point.", + "type": "Number" + }, + { + "name": "x2", + "description": "x-coordinate of the second point.", + "type": "Number" + }, + { + "name": "y2", + "description": "y-coordinate of the second point.", + "type": "Number" + } + ], + "return": { + "description": "distance between the two points.", + "type": "Number" + } + }, + { + "params": [ + { + "name": "x1", + "type": "Number" + }, + { + "name": "y1", + "type": "Number" + }, + { + "name": "z1", + "description": "z-coordinate of the first point.", + "type": "Number" + }, + { + "name": "x2", + "type": "Number" + }, + { + "name": "y2", + "type": "Number" + }, + { + "name": "z2", + "description": "z-coordinate of the second point.", + "type": "Number" + } + ], + "return": { + "description": "distance between the two points.", + "type": "Number" + } + } + ], + "return": { + "description": "distance between the two points.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "exp", + "file": "src/math/calculation.js", + "line": 209, + "itemtype": "method", + "description": "Returns Euler's number e (2.71828...) raised to the power of the n\nparameter.", + "example": [ + "
    \n\nfunction draw() {\n // Invert the y-axis.\n scale(1, -1);\n translate(0, -height);\n\n let x = frameCount;\n let y = 0.005 * exp(x * 0.1);\n point(x, y);\n\n describe('A series of black dots that grow exponentially from left to right.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "exponent to raise.", + "type": "Number" + } + ], + "return": { + "description": "e^n", + "type": "Number" + } + } + ], + "return": { + "description": "e^n", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "floor", + "file": "src/math/calculation.js", + "line": 238, + "itemtype": "method", + "description": "Calculates the closest integer value that is less than or equal to the\nvalue of the n parameter.", + "example": [ + "
    \n\n// Set the range for RGB values from 0 to 1.\ncolorMode(RGB, 1);\nnoStroke();\n\nlet r = 0.8;\nfill(r, 0, 0);\nrect(0, 0, width / 2, height);\n\n// Round r down to 0.\nr = floor(r);\nfill(r, 0, 0);\nrect(width / 2, 0, width / 2, height);\n\ndescribe('Two rectangles. The one on the left is bright red and the one on the right is black.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number to round down.", + "type": "Number" + } + ], + "return": { + "description": "rounded down number.", + "type": "Integer" + } + } + ], + "return": { + "description": "rounded down number.", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "lerp", + "file": "src/math/calculation.js", + "line": 285, + "itemtype": "method", + "description": "

    Calculates a number between two numbers at a specific increment. The amt\nparameter is the amount to interpolate between the two numbers. 0.0 is\nequal to the first number, 0.1 is very near the first number, 0.5 is\nhalf-way in between, and 1.0 is equal to the second number. The lerp()\nfunction is convenient for creating motion along a straight path and for\ndrawing dotted lines.

    \n

    If the value of amt is less than 0 or more than 1, lerp() will return a\nnumber outside of the original interval. For example, calling\nlerp(0, 10, 1.5) will return 15.

    \n", + "example": [ + "
    \n\nlet a = 20;\nlet b = 80;\nlet c = lerp(a, b, 0.2);\nlet d = lerp(a, b, 0.5);\nlet e = lerp(a, b, 0.8);\n\nlet y = 50;\n\nstrokeWeight(5);\n\n// Draw the original points in black.\nstroke(0);\npoint(a, y);\npoint(b, y);\n\n// Draw the lerped points in gray.\nstroke(100);\npoint(c, y);\npoint(d, y);\npoint(e, y);\n\ndescribe('Five points in a horizontal line. The outer points are black and the inner points are gray.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "start", + "description": "first value.", + "type": "Number" + }, + { + "name": "stop", + "description": "second value.", + "type": "Number" + }, + { + "name": "amt", + "description": "number.", + "type": "Number" + } + ], + "return": { + "description": "lerped value.", + "type": "Number" + } + } + ], + "return": { + "description": "lerped value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "mag", + "file": "src/math/calculation.js", + "line": 343, + "itemtype": "method", + "description": "

    Calculates the magnitude, or length, of a vector. A vector is like an arrow\npointing in space. Vectors are commonly used for programming motion.

    \n

    Vectors don't have a \"start\" position because the same arrow can be drawn\nanywhere. A vector's magnitude can be thought of as the distance from the\norigin (0, 0) to its tip at (x, y). mag(x, y) is a shortcut for calling\ndist(0, 0, x, y).

    \n", + "example": [ + "
    \n\nlet x = 30;\nlet y = 40;\nlet m = mag(x, y);\n\nline(0, 0, x, y);\ntext(m, x, y);\n\ndescribe('A diagonal line is drawn from the top left of the canvas. The number 50 is written at the end of the line.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "first component.", + "type": "Number" + }, + { + "name": "y", + "description": "second component.", + "type": "Number" + } + ], + "return": { + "description": "magnitude of vector from (0,0) to (x,y).", + "type": "Number" + } + } + ], + "return": { + "description": "magnitude of vector from (0,0) to (x,y).", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "map", + "file": "src/math/calculation.js", + "line": 398, + "itemtype": "method", + "description": "

    Re-maps a number from one range to another.

    \n

    For example, calling map(2, 0, 10, 0, 100) returns 20. The first three\narguments set the original value to 2 and the original range from 0 to 10.\nThe last two arguments set the target range from 0 to 100. 20's position\nin the target range [0, 100] is proportional to 2's position in the\noriginal range [0, 10].

    \n", + "example": [ + "
    \n\nlet n = map(7, 0, 10, 0, 100);\ntext(n, 50, 50);\n\ndescribe('The number 70 written in the middle of a gray square.');\n\n
    \n\n
    \n\nlet x = map(2, 0, 10, 0, width);\ncircle(x, 50, 10);\n\ndescribe('A white circle drawn on the left side of a gray square.');\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let c = map(mouseX, 0, width, 0, 255);\n fill(c);\n circle(50, 50, 20);\n\n describe('A circle changes color from black to white as the mouse moves from left to right.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "the incoming value to be converted.", + "type": "Number" + }, + { + "name": "start1", + "description": "lower bound of the value's current range.", + "type": "Number" + }, + { + "name": "stop1", + "description": "upper bound of the value's current range.", + "type": "Number" + }, + { + "name": "start2", + "description": "lower bound of the value's target range.", + "type": "Number" + }, + { + "name": "stop2", + "description": "upper bound of the value's target range.", + "type": "Number" + }, + { + "name": "withinBounds", + "description": "constrain the value to the newly mapped range.", + "optional": 1, + "type": "Boolean" + } + ], + "return": { + "description": "remapped number.", + "type": "Number" + } + } + ], + "return": { + "description": "remapped number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "max", + "file": "src/math/calculation.js", + "line": 473, + "itemtype": "method", + "description": "

    Returns the largest value in a sequence of numbers.

    \n

    The version of max() with one parameter interprets it as an array of\nnumbers and returns the largest number.

    \n

    The version of max() with two or more parameters interprets them as\nindividual numbers and returns the largest number.

    \n", + "example": [ + "
    \n\nlet m = max(10, 20);\ntext(m, 50, 50);\n\ndescribe('The number 20 written in the middle of a gray square.');\n\n
    \n\n
    \n\nlet m = max([10, 20]);\ntext(m, 50, 50);\n\ndescribe('The number 20 written in the middle of a gray square.');\n\n
    \n\n
    \n\nlet numbers = [2, 1, 5, 4, 8, 9];\n\n// Draw all of the numbers in the array.\nnoStroke();\nlet spacing = 15;\nnumbers.forEach((n, index) => {\n let x = index * spacing;\n let y = 25;\n text(n, x, y);\n});\n\n// Draw the maximum value in the array.\nlet m = max(numbers);\nlet maxX = 33;\nlet maxY = 80;\n\ntextSize(32);\ntext(m, maxX, maxY);\n\ndescribe('The numbers 2 1 5 4 8 9 are written in small text at the top of a gray square. The number 9 is written in large text at the center of the square.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n0", + "description": "first number to compare.", + "type": "Number" + }, + { + "name": "n1", + "description": "second number to compare.", + "type": "Number" + } + ], + "return": { + "description": "maximum number.", + "type": "Number" + } + }, + { + "params": [ + { + "name": "nums", + "description": "numbers to compare.", + "type": "Number[]" + } + ], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "maximum number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "min", + "file": "src/math/calculation.js", + "line": 551, + "itemtype": "method", + "description": "

    Returns the smallest value in a sequence of numbers.

    \n

    The version of min() with one parameter interprets it as an array of\nnumbers and returns the smallest number.

    \n

    The version of min() with two or more parameters interprets them as\nindividual numbers and returns the smallest number.

    \n", + "example": [ + "
    \n\nlet m = min(10, 20);\ntext(m, 50, 50);\n\ndescribe('The number 10 written in the middle of a gray square.');\n\n
    \n\n
    \n\nlet m = min([10, 20]);\ntext(m, 50, 50);\n\ndescribe('The number 10 written in the middle of a gray square.');\n\n
    \n\n
    \n\nlet numbers = [2, 1, 5, 4, 8, 9];\n\n// Draw all of the numbers in the array.\nnoStroke();\nlet spacing = 15;\nnumbers.forEach((n, index) => {\n let x = index * spacing;\n let y = 25;\n text(n, x, y);\n});\n\n// Draw the minimum value in the array.\nlet m = min(numbers);\nlet minX = 33;\nlet minY = 80;\n\ntextSize(32);\ntext(m, minX, minY);\n\ndescribe('The numbers 2 1 5 4 8 9 are written in small text at the top of a gray square. The number 1 is written in large text at the center of the square.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n0", + "description": "first number to compare.", + "type": "Number" + }, + { + "name": "n1", + "description": "second number to compare.", + "type": "Number" + } + ], + "return": { + "description": "minimum number.", + "type": "Number" + } + }, + { + "params": [ + { + "name": "nums", + "description": "numbers to compare.", + "type": "Number[]" + } + ], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "minimum number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "norm", + "file": "src/math/calculation.js", + "line": 597, + "itemtype": "method", + "description": "

    Maps a number from one range to a value between 0 and 1.

    \n

    For example, norm(2, 0, 10) returns 0.2. 2's position in the original\nrange [0, 10] is proportional to 0.2's position in the range [0, 1]. This\nis equivalent to calling map(2, 0, 10, 0, 1).

    \n

    Numbers outside of the original range are not constrained between 0 and 1.\nOut-of-range values are often intentional and useful.

    \n", + "example": [ + "
    \n\nfunction draw() {\n // Set the range for RGB values from 0 to 1.\n colorMode(RGB, 1);\n\n let r = norm(mouseX, 0, width);\n background(r, 0, 0);\n\n describe('A square changes color from black to red as the mouse moves from left to right.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "incoming value to be normalized.", + "type": "Number" + }, + { + "name": "start", + "description": "lower bound of the value's current range.", + "type": "Number" + }, + { + "name": "stop", + "description": "upper bound of the value's current range.", + "type": "Number" + } + ], + "return": { + "description": "normalized number.", + "type": "Number" + } + } + ], + "return": { + "description": "normalized number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "pow", + "file": "src/math/calculation.js", + "line": 634, + "itemtype": "method", + "description": "

    Calculates exponential expressions such as 2^3.

    \n

    For example, pow(2, 3) is equivalent to the expression\n2 Ɨ 2 Ɨ 2. pow(2, -3) is equivalent to 1 Ć·\n(2 Ɨ 2 Ɨ 2).

    \n", + "example": [ + "
    \n\nlet base = 3;\n\nlet d = pow(base, 1);\ncircle(10, 10, d);\n\nd = pow(base, 2);\ncircle(20, 20, d);\n\nd = pow(base, 3);\ncircle(40, 40, d);\n\nd = pow(base, 4);\ncircle(80, 80, d);\n\ndescribe('A series of circles that grow exponentially from top left to bottom right.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "base of the exponential expression.", + "type": "Number" + }, + { + "name": "e", + "description": "power by which to raise the base.", + "type": "Number" + } + ], + "return": { + "description": "n^e.", + "type": "Number" + } + } + ], + "return": { + "description": "n^e.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "round", + "file": "src/math/calculation.js", + "line": 663, + "itemtype": "method", + "description": "Calculates the integer closest to the n parameter. For example,\nround(133.8) returns the value 134.", + "example": [ + "
    \n\nlet x = round(3.7);\ntext(x, width / 2, height / 2);\n\ndescribe('The number 4 written in middle of canvas.');\n\n
    \n\n
    \n\nlet x = round(12.782383, 2);\ntext(x, width / 2, height / 2);\n\ndescribe('The number 12.78 written in middle of canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number to round.", + "type": "Number" + }, + { + "name": "decimals", + "description": "number of decimal places to round to, default is 0.", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "rounded number.", + "type": "Integer" + } + } + ], + "return": { + "description": "rounded number.", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "sq", + "file": "src/math/calculation.js", + "line": 699, + "itemtype": "method", + "description": "

    Squares a number, which means multiplying the number by itself. The value\nreturned is always a positive number.

    \n

    For example, sq(3) evaluates 3 Ɨ 3 which is 9. sq(-3) evaluates\n-3 Ɨ -3 which is also 9. Multiplying two negative numbers produces\na positive number.

    \n", + "example": [ + "
    \n\nfunction draw() {\n // Invert the y-axis.\n scale(1, -1);\n translate(0, -height);\n\n let x = frameCount;\n let y = 0.01 * sq(x);\n point(x, y);\n\n describe('A series of black dots that get higher quickly from left to right.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number to square.", + "type": "Number" + } + ], + "return": { + "description": "squared number.", + "type": "Number" + } + } + ], + "return": { + "description": "squared number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "sqrt", + "file": "src/math/calculation.js", + "line": 729, + "itemtype": "method", + "description": "

    Calculates the square root of a number. A number's square root can be\nmultiplied by itself to produce the original number.

    \n

    For example, sqrt(9) returns 3 because 3 Ɨ 3 = 9. sqrt() always\nreturns a positive value. sqrt() doesn't work with negative arguments\nsuch as sqrt(-9).

    \n", + "example": [ + "
    \n\nfunction draw() {\n // Invert the y-axis.\n scale(1, -1);\n translate(0, -height);\n\n let x = frameCount;\n let y = 5 * sqrt(x);\n point(x, y);\n\n describe('A series of black dots that get higher slowly from left to right.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "non-negative number to square root.", + "type": "Number" + } + ], + "return": { + "description": "square root of number.", + "type": "Number" + } + } + ], + "return": { + "description": "square root of number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "fract", + "file": "src/math/calculation.js", + "line": 750, + "itemtype": "method", + "description": "Calculates the fractional part of a number. For example,\nfract(12.34) returns 0.34.", + "example": [ + "
    \n\nlet n = 56.78;\ntext(n, 20, 33);\nlet f = fract(n);\ntext(f, 20, 66);\n\ndescribe('The number 56.78 written above the number 0.78.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "number whose fractional part will be found.", + "type": "Number" + } + ], + "return": { + "description": "fractional part of n.", + "type": "Number" + } + } + ], + "return": { + "description": "fractional part of n.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Calculation" + }, + { + "name": "createVector", + "file": "src/math/math.js", + "line": 74, + "itemtype": "method", + "description": "

    Creates a new p5.Vector object. A vector is like\nan arrow pointing in space. Vectors have both magnitude (length)\nand direction. Calling createVector() without arguments sets the new\nvector's components to 0.

    \n

    p5.Vector objects are often used to program\nmotion because they simplify the math. For example, a moving ball has a\nposition and a velocity. Position describes where the ball is in space. The\nball's position vector extends from the origin to the ball's center.\nVelocity describes the ball's speed and the direction it's moving. If the\nball is moving straight up, its velocity vector points straight up. Adding\nthe ball's velocity vector to its position vector moves it, as in\npos.add(vel). Vector math relies on methods inside the\np5.Vector class.

    \n", + "example": [ + "
    \n\nlet p1 = createVector(25, 25);\nlet p2 = createVector(50, 50);\nlet p3 = createVector(75, 75);\n\nstrokeWeight(5);\npoint(p1);\npoint(p2);\npoint(p3);\n\ndescribe('Three black dots form a diagonal line from top left to bottom right.');\n\n
    \n\n
    \n\nlet pos;\nlet vel;\n\nfunction setup() {\n createCanvas(100, 100);\n pos = createVector(width / 2, height);\n vel = createVector(0, -1);\n}\n\nfunction draw() {\n background(200);\n\n pos.add(vel);\n\n if (pos.y < 0) {\n pos.y = height;\n }\n\n strokeWeight(5);\n point(pos);\n\n describe('A black dot moves from bottom to top on a gray square. The dot reappears at the bottom when it reaches the top.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "y component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z component of the vector.", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "noise", + "file": "src/math/noise.js", + "line": 198, + "itemtype": "method", + "description": "

    Returns random numbers that can be tuned to feel more organic. The values\nreturned will always be between 0 and 1.

    \n

    Values returned by random() and\nrandomGaussian() can change by large\namounts between function calls. By contrast, values returned by noise()\ncan be made \"smooth\". Calls to noise() with similar inputs will produce\nsimilar outputs. noise() is used to create textures, motion, shapes,\nterrains, and so on. Ken Perlin invented noise() while animating the\noriginal Tron film in the 1980s.

    \n

    noise() returns the same value for a given input while a sketch is\nrunning. It produces different results each time a sketch runs. The\nnoiseSeed() function can be used to generate\nthe same sequence of Perlin noise values each time a sketch runs.

    \n

    The character of the noise can be adjusted in two ways. The first way is to\nscale the inputs. noise() interprets inputs as coordinates. The sequence\nof noise values will be smoother when the input coordinates are closer. The\nsecond way is to use the noiseDetail()\nfunction.

    \n

    The version of noise() with one parameter computes noise values in one\ndimension. This dimension can be thought of as space, as in noise(x), or\ntime, as in noise(t).

    \n

    The version of noise() with two parameters computes noise values in two\ndimensions. These dimensions can be thought of as space, as in\nnoise(x, y), or space and time, as in noise(x, t).

    \n

    The version of noise() with three parameters computes noise values in\nthree dimensions. These dimensions can be thought of as space, as in\nnoise(x, y, z), or space and time, as in noise(x, y, t).

    \n", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n\n let x = 100 * noise(0.005 * frameCount);\n let y = 100 * noise(0.005 * frameCount + 10000);\n\n strokeWeight(5);\n point(x, y);\n\n describe('A black dot moves randomly on a gray square.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let noiseLevel = 100;\n let noiseScale = 0.005;\n // Scale input coordinate.\n let nt = noiseScale * frameCount;\n // Compute noise value.\n let x = noiseLevel * noise(nt);\n let y = noiseLevel * noise(nt + 10000);\n // Render.\n strokeWeight(5);\n point(x, y);\n\n describe('A black dot moves randomly on a gray square.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n let noiseLevel = 100;\n let noiseScale = 0.02;\n // Scale input coordinate.\n let x = frameCount;\n let nx = noiseScale * x;\n // Compute noise value.\n let y = noiseLevel * noise(nx);\n // Render.\n line(x, 0, x, y);\n\n describe('A hilly terrain drawn in gray against a black sky.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let noiseLevel = 100;\n let noiseScale = 0.002;\n for (let x = 0; x < width; x += 1) {\n // Scale input coordinates.\n let nx = noiseScale * x;\n let nt = noiseScale * frameCount;\n // Compute noise value.\n let y = noiseLevel * noise(nx, nt);\n // Render.\n line(x, 0, x, y);\n }\n\n describe('A calm sea drawn in gray against a black sky.');\n}\n\n
    \n\n
    \n\nlet noiseLevel = 255;\nlet noiseScale = 0.01;\nfor (let y = 0; y < height; y += 1) {\n for (let x = 0; x < width; x += 1) {\n // Scale input coordinates.\n let nx = noiseScale * x;\n let ny = noiseScale * y;\n // Compute noise value.\n let c = noiseLevel * noise(nx, ny);\n // Render.\n stroke(c);\n point(x, y);\n }\n}\n\ndescribe('A gray cloudy pattern.');\n\n
    \n\n
    \n\nfunction draw() {\n let noiseLevel = 255;\n let noiseScale = 0.009;\n for (let y = 0; y < height; y += 1) {\n for (let x = 0; x < width; x += 1) {\n // Scale input coordinates.\n let nx = noiseScale * x;\n let ny = noiseScale * y;\n let nt = noiseScale * frameCount;\n // Compute noise value.\n let c = noiseLevel * noise(nx, ny, nt);\n // Render.\n stroke(c);\n point(x, y);\n }\n }\n\n describe('A gray cloudy pattern that changes.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate in noise space.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate in noise space.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z-coordinate in noise space.", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "Perlin noise value at specified coordinates.", + "type": "Number" + } + } + ], + "return": { + "description": "Perlin noise value at specified coordinates.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Noise" + }, + { + "name": "noiseDetail", + "file": "src/math/noise.js", + "line": 327, + "itemtype": "method", + "description": "

    Adjusts the character of the noise produced by the\nnoise() function.

    \n

    Perlin noise values are created by adding layers of noise together. The\nnoise layers, called octaves, are similar to harmonics in music. Lower\noctaves contribute more to the output signal. They define the overall\nintensity of the noise. Higher octaves create finer-grained details.

    \n

    By default, noise values are created by combining four octaves. Each higher\noctave contributes half as much (50% less) compared to its predecessor.\nnoiseDetail() changes the number of octaves and the falloff amount. For\nexample, calling noiseDetail(6, 0.25) ensures that\nnoise() will use six octaves. Each higher octave\nwill contribute 25% as much (75% less) compared to its predecessor. Falloff\nvalues between 0 and 1 are valid. However, falloff values greater than 0.5\nmight result in noise values greater than 1.

    \n", + "example": [ + "
    \n\nlet noiseLevel = 255;\nlet noiseScale = 0.02;\nfor (let y = 0; y < height; y += 1) {\n for (let x = 0; x < width / 2; x += 1) {\n // Scale input coordinates.\n let nx = noiseScale * x;\n let ny = noiseScale * y;\n\n // Compute noise value.\n noiseDetail(6, 0.25);\n let c = noiseLevel * noise(nx, ny);\n // Render left side.\n stroke(c);\n point(x, y);\n\n // Compute noise value.\n noiseDetail(4, 0.5);\n c = noiseLevel * noise(nx, ny);\n // Render right side.\n stroke(c);\n point(x + width / 2, y);\n }\n}\n\ndescribe('Two gray cloudy patterns. The pattern on the right is cloudier than the pattern on the left.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "lod", + "description": "number of octaves to be used by the noise.", + "type": "Number" + }, + { + "name": "falloff", + "description": "falloff factor for each octave.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Noise" + }, + { + "name": "noiseSeed", + "file": "src/math/noise.js", + "line": 368, + "itemtype": "method", + "description": "Sets the seed value for noise(). By default,\nnoise() produces different results each time\na sketch is run. Calling noiseSeed() with a constant\nargument, such as noiseSeed(99), makes noise()\nproduce the same results each time a sketch is run.", + "example": [ + "
    \n\nfunction setup() {\n noiseSeed(99);\n background(255);\n}\n\nfunction draw() {\n let noiseLevel = 100;\n let noiseScale = 0.005;\n // Scale input coordinate.\n let nt = noiseScale * frameCount;\n // Compute noise value.\n let x = noiseLevel * noise(nt);\n // Render.\n line(x, 0, x, height);\n\n describe('A black rectangle that grows randomly, first to the right and then to the left.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "seed", + "description": "seed value.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Noise" + }, + { + "name": "randomSeed", + "file": "src/math/random.js", + "line": 64, + "itemtype": "method", + "description": "Sets the seed value for random() and\nrandomGaussian(). By default,\nrandom() and\nrandomGaussian() produce different\nresults each time a sketch is run. Calling randomSeed() with a constant\nargument, such as randomSeed(99), makes these functions produce the same\nresults each time a sketch is run.", + "example": [ + "
    \n\nlet x = random(width);\nlet y = random(height);\ncircle(x, y, 10);\n\nrandomSeed(99);\nx = random(width);\ny = random(height);\nfill(0);\ncircle(x, y, 10);\n\ndescribe('A white circle appears at a random position. A black circle appears at (27.4, 25.8).');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "seed", + "description": "seed value.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Random" + }, + { + "name": "random", + "file": "src/math/random.js", + "line": 164, + "itemtype": "method", + "description": "

    Returns a random number or a random element from an array.

    \n

    random() follows uniform distribution, which means that all outcomes are\nequally likely. When random() is used to generate numbers, all\nnumbers in the output range are equally likely to be returned. When\nrandom() is used to select elements from an array, all elements are\nequally likely to be chosen.

    \n

    By default, random() produces different results each time a sketch runs.\nThe randomSeed() function can be used to\ngenerate the same sequence of numbers or choices each time a sketch runs.

    \n

    The version of random() with no parameters returns a random number from 0\nup to but not including 1.

    \n

    The version of random() with one parameter works one of two ways. If the\nargument passed is a number, random() returns a random number from 0 up\nto but not including the number. For example, calling random(5) returns\nvalues between 0 and 5. If the argument passed is an array, random()\nreturns a random element from that array. For example, calling\nrandom(['šŸ¦', 'šŸÆ', 'šŸ»']) returns either a lion, tiger, or bear emoji.

    \n

    The version of random() with two parameters returns a random number from\na given range. The arguments passed set the range's lower and upper bounds.\nFor example, calling random(-5, 10.2) returns values from -5 up to but\nnot including 10.2.

    \n", + "example": [ + "
    \n\nlet x = random(width);\nlet y = random(height);\n\nstrokeWeight(5);\npoint(x, y);\n\ndescribe('A black dot appears in a random position on a gray square.');\n\n
    \n\n
    \n\nlet animals = ['šŸ¦', 'šŸÆ', 'šŸ»'];\nlet animal = random(animals);\ntext(animal, 50, 50);\n\ndescribe('An animal face is displayed at random. Either a lion, tiger, or bear.');\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n frameRate(5);\n let x = random(width);\n let y = random(height);\n\n strokeWeight(5);\n point(x, y);\n\n describe('A black dot moves around randomly on a gray square.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n frameRate(5);\n let x = random(45, 55);\n let y = random(45, 55);\n\n strokeWeight(5);\n point(x, y);\n\n describe('A black dot moves around randomly in the middle of a gray square.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "min", + "description": "lower bound (inclusive).", + "optional": 1, + "type": "Number" + }, + { + "name": "max", + "description": "upper bound (exclusive).", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "random number.", + "type": "Number" + } + }, + { + "params": [ + { + "name": "choices", + "description": "array to choose from.", + "type": "Array" + } + ], + "return": { + "description": "random element from the array." + } + } + ], + "return": { + "description": "random number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Random" + }, + { + "name": "randomGaussian", + "file": "src/math/random.js", + "line": 246, + "itemtype": "method", + "description": "

    Returns a random number fitting a Gaussian, or normal, distribution. Normal\ndistributions look like bell curves when plotted. Values from a normal\ndistribution cluster around a central value called the mean. The cluster's\nstandard deviation describes its spread.

    \n

    By default, randomGaussian() produces different results each time a\nsketch runs. The randomSeed() function can be\nused to generate the same sequence of numbers each time a sketch runs.

    \n

    There's no minimum or maximum value that randomGaussian() might return.\nValues far from the mean are very unlikely and values near the mean are\nvery likely.

    \n

    The version of randomGaussian() with no parameters returns values with a\nmean of 0 and standard deviation of 1.

    \n

    The version of randomGaussian() with one parameter interprets the\nargument passed as the mean. The standard deviation is 1.

    \n

    The version of randomGaussian() with two parameters interprets the first\nargument passed as the mean and the second as the standard deviation.

    \n", + "example": [ + "
    \n\nfunction draw() {\n noStroke();\n fill(0, 10);\n\n // Uniform distribution.\n let x = random(width);\n let y = 25;\n circle(x, y, 5);\n\n // Gaussian distribution with sd = 1.\n x = randomGaussian(50);\n y = 50;\n circle(x, y, 5);\n\n // Gaussian distribution with sd = 10.\n x = randomGaussian(50, 10);\n y = 75;\n circle(x, y, 5);\n\n describe('Three horizontal black lines are filled in randomly. The top line spans entire canvas. The middle line is very short. The bottom line spans two-thirds of the canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "mean", + "description": "mean.", + "optional": 1, + "type": "Number" + }, + { + "name": "sd", + "description": "standard deviation.", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "random number.", + "type": "Number" + } + } + ], + "return": { + "description": "random number.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Random" + }, + { + "name": "acos", + "file": "src/math/trigonometry.js", + "line": 56, + "itemtype": "method", + "description": "The inverse of cos(), returns the arc cosine of a\nvalue. This function expects arguments in the range -1 to 1. By default,\nacos() returns values in the range 0 to Ļ€ (about 3.14). If the\nangleMode() is DEGREES, then values are\nreturned in the range 0 to 180.", + "example": [ + "
    \n\nlet a = PI + QUARTER_PI;\nlet c = cos(a);\nlet ac = acos(c);\ntext(`${round(a, 3)}`, 35, 25);\ntext(`${round(c, 3)}`, 35, 50);\ntext(`${round(ac, 3)}`, 35, 75);\n\ndescribe('The numbers 3.142, -1, and 3.142 written on separate rows.');\n\n
    \n\n
    \n\nlet a = PI;\nlet c = cos(a);\nlet ac = acos(c);\ntext(`${round(a, 3)}`, 35, 25);\ntext(`${round(c, 3)}`, 35, 50);\ntext(`${round(ac, 3)}`, 35, 75);\n\ndescribe('The numbers 3.927, -0.707, and 2.356 written on separate rows.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "value whose arc cosine is to be returned.", + "type": "Number" + } + ], + "return": { + "description": "arc cosine of the given value.", + "type": "Number" + } + } + ], + "return": { + "description": "arc cosine of the given value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "asin", + "file": "src/math/trigonometry.js", + "line": 99, + "itemtype": "method", + "description": "The inverse of sin(), returns the arc sine of a\nvalue. This function expects input values in the range of -1 to 1. By\ndefault, asin() returns values in the range -Ļ€ Ć· 2\n(about -1.57) to Ļ€ Ć· 2 (about 1.57). If the\nangleMode() is DEGREES then values are\nreturned in the range -90 to 90.", + "example": [ + "
    \n\nlet a = PI / 3;\nlet s = sin(a);\nlet as = asin(s);\ntext(`${round(a, 3)}`, 35, 25);\ntext(`${round(s, 3)}`, 35, 50);\ntext(`${round(as, 3)}`, 35, 75);\n\ndescribe('The numbers 1.047, 0.866, and 1.047 written on separate rows.');\n\n
    \n\n
    \n\nlet a = PI + PI / 3;\nlet s = sin(a);\nlet as = asin(s);\ntext(`${round(a, 3)}`, 35, 25);\ntext(`${round(s, 3)}`, 35, 50);\ntext(`${round(as, 3)}`, 35, 75);\n\ndescribe('The numbers 4.189, -0.866, and -1.047 written on separate rows.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "value whose arc sine is to be returned.", + "type": "Number" + } + ], + "return": { + "description": "arc sine of the given value.", + "type": "Number" + } + } + ], + "return": { + "description": "arc sine of the given value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "atan", + "file": "src/math/trigonometry.js", + "line": 142, + "itemtype": "method", + "description": "The inverse of tan(), returns the arc tangent of a\nvalue. This function expects input values in the range of -Infinity to\nInfinity. By default, atan() returns values in the range -Ļ€ Ć· 2\n(about -1.57) to Ļ€ Ć· 2 (about 1.57). If the\nangleMode() is DEGREES then values are\nreturned in the range -90 to 90.", + "example": [ + "
    \n\nlet a = PI / 3;\nlet t = tan(a);\nlet at = atan(t);\ntext(`${round(a, 3)}`, 35, 25);\ntext(`${round(t, 3)}`, 35, 50);\ntext(`${round(at, 3)}`, 35, 75);\n\ndescribe('The numbers 1.047, 1.732, and 1.047 written on separate rows.');\n\n
    \n\n
    \n\nlet a = PI + PI / 3;\nlet t = tan(a);\nlet at = atan(t);\ntext(`${round(a, 3)}`, 35, 25);\ntext(`${round(t, 3)}`, 35, 50);\ntext(`${round(at, 3)}`, 35, 75);\n\ndescribe('The numbers 4.189, 1.732, and 1.047 written on separate rows.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "value whose arc tangent is to be returned.", + "type": "Number" + } + ], + "return": { + "description": "arc tangent of the given value.", + "type": "Number" + } + } + ], + "return": { + "description": "arc tangent of the given value.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "atan2", + "file": "src/math/trigonometry.js", + "line": 179, + "itemtype": "method", + "description": "

    Calculates the angle formed by a specified point, the origin, and the\npositive x-axis. By default, atan2() returns values in the range\n-Ļ€ (about -3.14) to Ļ€ (3.14). If the\nangleMode() is DEGREES, then values are\nreturned in the range -180 to 180. The atan2() function is most often\nused for orienting geometry to the mouse's position.

    \n

    Note: The y-coordinate of the point is the first parameter and the\nx-coordinate is the second parameter.

    \n", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n translate(width / 2, height / 2);\n let x = mouseX - width / 2;\n let y = mouseY - height / 2;\n let a = atan2(y, x);\n rotate(a);\n rect(-30, -5, 60, 10);\n\n describe('A rectangle at the center of the canvas rotates with mouse movements.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "y", + "description": "y-coordinate of the point.", + "type": "Number" + }, + { + "name": "x", + "description": "x-coordinate of the point.", + "type": "Number" + } + ], + "return": { + "description": "arc tangent of the given point.", + "type": "Number" + } + } + ], + "return": { + "description": "arc tangent of the given point.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "cos", + "file": "src/math/trigonometry.js", + "line": 235, + "itemtype": "method", + "description": "Calculates the cosine of an angle. cos() is useful for many geometric\ntasks in creative coding. The values returned oscillate between -1 and 1\nas the input angle increases. cos() takes into account the current\nangleMode.", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n\n let t = frameCount;\n let x = 30 * cos(t * 0.05) + 50;\n let y = 50;\n line(50, y, x, y);\n circle(x, y, 20);\n\n describe('A white ball on a string oscillates left and right.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n let x = frameCount;\n let y = 30 * cos(x * 0.1) + 50;\n point(x, y);\n\n describe('A series of black dots form a wave pattern.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n let t = frameCount;\n let x = 30 * cos(t * 0.1) + 50;\n let y = 10 * sin(t * 0.2) + 50;\n point(x, y);\n\n describe('A series of black dots form an infinity symbol.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "the angle.", + "type": "Number" + } + ], + "return": { + "description": "cosine of the angle.", + "type": "Number" + } + } + ], + "return": { + "description": "cosine of the angle.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "sin", + "file": "src/math/trigonometry.js", + "line": 291, + "itemtype": "method", + "description": "Calculates the sine of an angle. sin() is useful for many geometric tasks\nin creative coding. The values returned oscillate between -1 and 1 as the\ninput angle increases. sin() takes into account the current\nangleMode.", + "example": [ + "
    \n\nfunction draw() {\n background(200);\n\n let t = frameCount;\n let x = 50;\n let y = 30 * sin(t * 0.05) + 50;\n line(x, 50, x, y);\n circle(x, y, 20);\n\n describe('A white ball on a string oscillates up and down.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n let x = frameCount;\n let y = 30 * sin(x * 0.1) + 50;\n point(x, y);\n\n describe('A series of black dots form a wave pattern.');\n}\n\n
    \n\n
    \n\nfunction draw() {\n let t = frameCount;\n let x = 30 * cos(t * 0.1) + 50;\n let y = 10 * sin(t * 0.2) + 50;\n point(x, y);\n\n describe('A series of black dots form an infinity symbol.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "the angle.", + "type": "Number" + } + ], + "return": { + "description": "sine of the angle.", + "type": "Number" + } + } + ], + "return": { + "description": "sine of the angle.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "tan", + "file": "src/math/trigonometry.js", + "line": 318, + "itemtype": "method", + "description": "Calculates the tangent of an angle. tan() is useful for many geometric\ntasks in creative coding. The values returned range from -Infinity\nto Infinity and repeat periodically as the input angle increases. tan()\ntakes into account the current angleMode.", + "example": [ + "
    \n\nfunction draw() {\n let x = frameCount;\n let y = 5 * tan(x * 0.1) + 50;\n point(x, y);\n\n describe('A series of identical curves drawn with black dots. Each curve starts from the top of the canvas, continues down at a slight angle, flattens out at the middle of the canvas, then continues to the bottom.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "the angle.", + "type": "Number" + } + ], + "return": { + "description": "tangent of the angle.", + "type": "Number" + } + } + ], + "return": { + "description": "tangent of the angle.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "degrees", + "file": "src/math/trigonometry.js", + "line": 345, + "itemtype": "method", + "description": "Converts an angle measurement in radians to its corresponding value in\ndegrees. Degrees and radians are two ways of measuring the same thing.\nThere are 360 degrees in a circle and 2 Ɨ Ļ€ (about 6.28)\nradians in a circle. For example, 90Ā° = Ļ€ Ć· 2 (about 1.57)\nradians. This function doesn't take into account the current\nangleMode().", + "example": [ + "
    \n\nlet rad = QUARTER_PI;\nlet deg = degrees(rad);\ntext(`${round(rad, 2)} rad = ${deg}Ėš`, 10, 50);\n\ndescribe('The text \"0.79 rad = 45Ėš\".');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "radians", + "description": "radians value to convert to degrees.", + "type": "Number" + } + ], + "return": { + "description": "converted angle.", + "type": "Number" + } + } + ], + "return": { + "description": "converted angle.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "radians", + "file": "src/math/trigonometry.js", + "line": 370, + "itemtype": "method", + "description": "Converts an angle measurement in degrees to its corresponding value in\nradians. Degrees and radians are two ways of measuring the same thing.\nThere are 360 degrees in a circle and 2 Ɨ Ļ€ (about 6.28)\nradians in a circle. For example, 90Ā° = Ļ€ Ć· 2 (about 1.57)\nradians. This function doesn't take into account the current\nangleMode().", + "example": [ + "
    \n\nlet deg = 45;\nlet rad = radians(deg);\ntext(`${deg}Ėš = ${round(rad, 3)} rad`, 10, 50);\n\ndescribe('The text \"45Ėš = 0.785 rad\".');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "degrees", + "description": "degree value to convert to radians.", + "type": "Number" + } + ], + "return": { + "description": "converted angle.", + "type": "Number" + } + } + ], + "return": { + "description": "converted angle.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "angleMode", + "file": "src/math/trigonometry.js", + "line": 405, + "itemtype": "method", + "description": "

    Changes the way trigonometric functions interpret angle values. By default,\nthe mode is RADIANS.

    \n

    Calling angleMode() with no arguments returns current angle mode.

    \n", + "example": [ + "
    \n\nlet r = 40;\npush();\nrotate(PI / 6);\nline(0, 0, r, 0);\ntext('0.524 rad', r, 0);\npop();\n\nangleMode(DEGREES);\npush();\nrotate(60);\nline(0, 0, r, 0);\ntext('60Ėš', r, 0);\npop();\n\ndescribe('Two diagonal lines radiating from the top left corner of a square. The lines are oriented 30 degrees from the edges of the square and 30 degrees apart from each other.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "either RADIANS or DEGREES.", + "type": "Constant" + } + ] + }, + { + "params": [], + "return": { + "description": "mode either RADIANS or DEGREES", + "type": "Constant" + } + } + ], + "return": { + "description": "mode either RADIANS or DEGREES", + "type": "Constant" + }, + "class": "p5", + "static": false, + "module": "Math", + "submodule": "Trigonometry" + }, + { + "name": "textAlign", + "file": "src/typography/attributes.js", + "line": 80, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the way text is aligned when text() is called.

    \n

    By default, calling text('hi', 10, 20) places the bottom-left corner of\nthe text's bounding box at (10, 20).

    \n

    The first parameter, horizAlign, changes the way\ntext() interprets x-coordinates. By default, the\nx-coordinate sets the left edge of the bounding box. textAlign() accepts\nthe following values for horizAlign: LEFT, CENTER, or RIGHT.

    \n

    The second parameter, vertAlign, is optional. It changes the way\ntext() interprets y-coordinates. By default, the\ny-coordinate sets the bottom edge of the bounding box. textAlign()\naccepts the following values for vertAlign: TOP, BOTTOM, CENTER,\nor BASELINE.

    \n", + "example": [ + "
    \n\nstrokeWeight(0.5);\nline(50, 0, 50, 100);\n\ntextSize(16);\ntextAlign(RIGHT);\ntext('ABCD', 50, 30);\ntextAlign(CENTER);\ntext('EFGH', 50, 50);\ntextAlign(LEFT);\ntext('IJKL', 50, 70);\n\ndescribe('The letters ABCD displayed at top-left, EFGH at center, and IJKL at bottom-right. A vertical line divides the canvas in half.');\n\n
    \n\n
    \n\nstrokeWeight(0.5);\n\nline(0, 12, width, 12);\ntextAlign(CENTER, TOP);\ntext('TOP', 50, 12);\n\nline(0, 37, width, 37);\ntextAlign(CENTER, CENTER);\ntext('CENTER', 50, 37);\n\nline(0, 62, width, 62);\ntextAlign(CENTER, BASELINE);\ntext('BASELINE', 50, 62);\n\nline(0, 97, width, 97);\ntextAlign(CENTER, BOTTOM);\ntext('BOTTOM', 50, 97);\n\ndescribe('The words \"TOP\", \"CENTER\", \"BASELINE\", and \"BOTTOM\" each drawn relative to a horizontal line. Their positions demonstrate different vertical alignments.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "horizAlign", + "description": "horizontal alignment, either LEFT,\nCENTER, or RIGHT.", + "type": "Constant" + }, + { + "name": "vertAlign", + "description": "vertical alignment, either TOP,\nBOTTOM, CENTER, or BASELINE.", + "optional": 1, + "type": "Constant" + } + ] + }, + { + "params": [], + "return": { + "description": "", + "type": "Object" + } + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "textLeading", + "file": "src/typography/attributes.js", + "line": 114, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the spacing between lines of text when\ntext() is called. Spacing is measured in pixels.

    \n

    Calling textLeading() without an argument returns the current spacing.

    \n", + "example": [ + "
    \n\n// \"\\n\" starts a new line of text.\nlet lines = 'one\\ntwo';\n\ntext(lines, 10, 25);\n\ntextLeading(30);\ntext(lines, 70, 25);\n\ndescribe('The words \"one\" and \"two\" written on separate lines twice. The words on the left have less vertical spacing than the words on the right.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "leading", + "description": "spacing between lines of text in units of pixels.", + "type": "Number" + } + ] + }, + { + "params": [], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "textSize", + "file": "src/typography/attributes.js", + "line": 147, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the font size when\ntext() is called. Font size is measured in pixels.

    \n

    Calling textSize() without an arugment returns the current size.

    \n", + "example": [ + "
    \n\ntextSize(12);\ntext('Font Size 12', 10, 30);\ntextSize(14);\ntext('Font Size 14', 10, 60);\ntextSize(16);\ntext('Font Size 16', 10, 90);\n\ndescribe('The text \"Font Size 12\" drawn small, \"Font Size 14\" drawn medium, and \"Font Size 16\" drawn large.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "size", + "description": "size of the letters in units of pixels", + "type": "Number" + } + ] + }, + { + "params": [], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "textStyle", + "file": "src/typography/attributes.js", + "line": 187, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the style for system fonts when\ntext() is called. textStyle() accepts the\nfollowing values: NORMAL, ITALIC, BOLD or BOLDITALIC.

    \n

    textStyle() may be overridden by CSS styling. This function doesn't\naffect fonts loaded with loadFont().

    \n", + "example": [ + "
    \n\ntextSize(12);\ntextAlign(CENTER);\n\ntextStyle(NORMAL);\ntext('Normal', 50, 15);\ntextStyle(ITALIC);\ntext('Italic', 50, 40);\ntextStyle(BOLD);\ntext('Bold', 50, 65);\ntextStyle(BOLDITALIC);\ntext('Bold Italic', 50, 90);\n\ndescribe('The words \"Normal\" displayed normally, \"Italic\" in italic, \"Bold\" in bold, and \"Bold Italic\" in bold italics.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "style", + "description": "styling for text, either NORMAL,\nITALIC, BOLD or BOLDITALIC", + "type": "Constant" + } + ] + }, + { + "params": [], + "return": { + "description": "", + "type": "String" + } + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "textWidth", + "file": "src/typography/attributes.js", + "line": 235, + "itemtype": "method", + "description": "Returns the maximum width of a string of text drawn when\ntext() is called.", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n\n textSize(28);\n strokeWeight(0.5);\n let s = 'yoyo';\n let w = textWidth(s);\n text(s, 22, 55);\n line(22, 55, 22 + w, 55);\n\n describe('The word \"yoyo\" underlined.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n\n textSize(28);\n strokeWeight(0.5);\n // \"\\n\" starts a new line.\n let s = 'yo\\nyo';\n let w = textWidth(s);\n text(s, 22, 55);\n line(22, 55, 22 + w, 55);\n\n describe('The word \"yo\" written twice, one copy beneath the other. The words are divided by a horizontal line.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "string of text to measure.", + "type": "String" + } + ], + "return": { + "description": "width measured in units of pixels.", + "type": "Number" + } + } + ], + "return": { + "description": "width measured in units of pixels.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "textAscent", + "file": "src/typography/attributes.js", + "line": 305, + "itemtype": "method", + "description": "Returns the ascent of the current font at its current size. The ascent\nrepresents the distance, in pixels, of the tallest character above\nthe baseline.", + "example": [ + "
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n background(200);\n textFont(font);\n\n // Different for each font.\n let fontScale = 0.8;\n\n let baseY = 75;\n strokeWeight(0.5);\n\n // Draw small text.\n textSize(24);\n text('dp', 0, baseY);\n // Draw baseline and ascent.\n let a = textAscent() * fontScale;\n line(0, baseY, 23, baseY);\n line(23, baseY - a, 23, baseY);\n\n // Draw large text.\n textSize(48);\n text('dp', 45, baseY);\n // Draw baseline and ascent.\n a = textAscent() * fontScale;\n line(45, baseY, 91, baseY);\n line(91, baseY - a, 91, baseY);\n\n describe('The letters \"dp\" written twice in different sizes. Each version has a horizontal baseline. A vertical line extends upward from each baseline to the top of the \"d\".');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "ascent measured in units of pixels.", + "type": "Number" + } + } + ], + "return": { + "description": "ascent measured in units of pixels.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "textDescent", + "file": "src/typography/attributes.js", + "line": 357, + "itemtype": "method", + "description": "Returns the descent of the current font at its current size. The descent\nrepresents the distance, in pixels, of the character with the longest\ndescender below the baseline.", + "example": [ + "
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n background(200);\n textFont(font);\n\n // Different for each font.\n let fontScale = 0.9;\n\n let baseY = 75;\n strokeWeight(0.5);\n\n // Draw small text.\n textSize(24);\n text('dp', 0, baseY);\n // Draw baseline and descent.\n let d = textDescent() * fontScale;\n line(0, baseY, 23, baseY);\n line(23, baseY, 23, baseY + d);\n\n // Draw large text.\n textSize(48);\n text('dp', 45, baseY);\n // Draw baseline and descent.\n d = textDescent() * fontScale;\n line(45, baseY, 91, baseY);\n line(91, baseY, 91, baseY + d);\n\n describe('The letters \"dp\" written twice in different sizes. Each version has a horizontal baseline. A vertical line extends downward from each baseline to the bottom of the \"p\".');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "descent measured in units of pixels.", + "type": "Number" + } + } + ], + "return": { + "description": "descent measured in units of pixels.", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "textWrap", + "file": "src/typography/attributes.js", + "line": 414, + "itemtype": "method", + "description": "

    Sets the style for wrapping text when\ntext() is called. textWrap() accepts the\nfollowing values:

    \n

    WORD starts new lines of text at spaces. If a string of text doesn't\nhave spaces, it may overflow the text box and the canvas. This is the\ndefault style.

    \n

    CHAR starts new lines as needed to stay within the text box.

    \n

    textWrap() only works when the maximum width is set for a text box. For\nexample, calling text('Have a wonderful day', 0, 10, 100) sets the\nmaximum width to 100 pixels.

    \n

    Calling textWrap() without an argument returns the current style.

    \n", + "example": [ + "
    \n\ntextSize(20);\ntextWrap(WORD);\ntext('Have a wonderful day', 0, 10, 100);\n\n
    \n\n
    \n\ntextSize(20);\ntextWrap(CHAR);\ntext('Have a wonderful day', 0, 10, 100);\n\n
    \n\n
    \n\ntextSize(20);\ntextWrap(CHAR);\ntext('ē„ä½ ęœ‰ē¾Žå„½ēš„äø€å¤©', 0, 10, 100);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "style", + "description": "text wrapping style, either WORD or CHAR.", + "type": "Constant" + } + ], + "return": { + "description": "style", + "type": "String" + } + } + ], + "return": { + "description": "style", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Attributes" + }, + { + "name": "loadFont", + "file": "src/typography/loading_displaying.js", + "line": 129, + "itemtype": "method", + "description": "

    Loads a font and creates a p5.Font object.\nloadFont() can load fonts in either .otf or .ttf format. Loaded fonts can\nbe used to style text on the canvas and in HTML elements.

    \n

    The first parameter, path, is the path to a font file.\nPaths to local files should be relative. For example,\n'assets/inconsolata.otf'. The Inconsolata font used in the following\nexamples can be downloaded for free\nhere.\nPaths to remote files should be URLs. For example,\n'https://example.com/inconsolata.otf'. URLs may be blocked due to browser\nsecurity.

    \n

    The second parameter, successCallback, is optional. If a function is\npassed, it will be called once the font has loaded. The callback function\nmay use the new p5.Font object if needed.

    \n

    The third parameter, failureCallback, is also optional. If a function is\npassed, it will be called if the font fails to load. The callback function\nmay use the error\nEvent\nobject if needed.

    \n

    Fonts can take time to load. Calling loadFont() in\npreload() ensures fonts load before they're\nused in setup() or\ndraw().

    \n", + "example": [ + "
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n fill('deeppink');\n textFont(font);\n textSize(36);\n text('p5*js', 10, 50);\n\n describe('The text \"p5*js\" written in pink on a white background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n loadFont('assets/inconsolata.otf', font => {\n fill('deeppink');\n textFont(font);\n textSize(36);\n text('p5*js', 10, 50);\n\n describe('The text \"p5*js\" written in pink on a white background.');\n });\n}\n\n
    \n\n
    \n\nfunction setup() {\n loadFont('assets/inconsolata.otf', success, failure);\n}\n\nfunction success(font) {\n fill('deeppink');\n textFont(font);\n textSize(36);\n text('p5*js', 10, 50);\n\n describe('The text \"p5*js\" written in pink on a white background.');\n}\n\nfunction failure(event) {\n console.error('Oops!', event);\n}\n\n
    \n\n
    \n\nfunction preload() {\n loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n let p = createP('p5*js');\n p.style('color', 'deeppink');\n p.style('font-family', 'Inconsolata');\n p.style('font-size', '36px');\n p.position(10, 50);\n\n describe('The text \"p5*js\" written in pink on a white background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "path of the font to be loaded.", + "type": "String" + }, + { + "name": "successCallback", + "description": "function called with the\np5.Font object after it\nloads.", + "optional": 1, + "type": "Function" + }, + { + "name": "failureCallback", + "description": "function called with the error\nEvent\nobject if the font fails to load.", + "optional": 1, + "type": "Function" + } + ], + "return": { + "description": "p5.Font object.", + "type": "p5.Font" + } + } + ], + "return": { + "description": "p5.Font object.", + "type": "p5.Font" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Loading & Displaying" + }, + { + "name": "text", + "file": "src/typography/loading_displaying.js", + "line": 328, + "itemtype": "method", + "chainable": 1, + "description": "

    Draws text to the canvas.

    \n

    The first parameter, str, is the text to be drawn. The second and third\nparameters, x and y, set the coordinates of the text's bottom-left\ncorner. See textAlign() for other ways to\nalign text.

    \n

    The fourth and fifth parameters, maxWidth and maxHeight, are optional.\nThey set the dimensions of the invisible rectangle containing the text. By\ndefault, they set its maximum width and height. See\nrectMode() for other ways to define the\nrectangular text box. Text will wrap to fit within the text box. Text\noutside of the box won't be drawn.

    \n

    Text can be styled a few ways. Call the fill()\nfunction to set the text's fill color. Call\nstroke() and\nstrokeWeight() to set the text's outline.\nCall textSize() and\ntextFont() to set the text's size and font,\nrespectively.

    \n

    Note: WEBGL mode only supports fonts loaded with\nloadFont(). Calling\nstroke() has no effect in WEBGL mode.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n text('hi', 50, 50);\n\n describe('The text \"hi\" written in black in the middle of a gray square.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background('skyblue');\n textSize(100);\n text('šŸŒˆ', 0, 100);\n\n describe('A rainbow in a blue sky.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n textSize(32);\n fill(255);\n stroke(0);\n strokeWeight(4);\n text('hi', 50, 50);\n\n describe('The text \"hi\" written in white with a black outline.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background('black');\n textSize(22);\n fill('yellow');\n text('rainbows', 6, 20);\n fill('cornflowerblue');\n text('rainbows', 6, 45);\n fill('tomato');\n text('rainbows', 6, 70);\n fill('limegreen');\n text('rainbows', 6, 95);\n\n describe('The text \"rainbows\" written on several lines, each in a different color.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n let s = 'The quick brown fox jumps over the lazy dog.';\n text(s, 10, 10, 70, 80);\n\n describe('The sample text \"The quick brown fox...\" written in black across several lines.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n rectMode(CENTER);\n let s = 'The quick brown fox jumps over the lazy dog.';\n text(s, 50, 50, 70, 80);\n\n describe('The sample text \"The quick brown fox...\" written in black across several lines.');\n}\n\n
    \n\n
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n textFont(font);\n textSize(32);\n textAlign(CENTER, CENTER);\n}\n\nfunction draw() {\n background(0);\n rotateY(frameCount / 30);\n text('p5*js', 0, 0);\n\n describe('The text \"p5*js\" written in white and spinning in 3D.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "text to be displayed.", + "type": "String|Object|Array|Number|Boolean" + }, + { + "name": "x", + "description": "x-coordinate of the text box.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the text box.", + "type": "Number" + }, + { + "name": "maxWidth", + "description": "maximum width of the text box. See\nrectMode() for\nother options.", + "optional": 1, + "type": "Number" + }, + { + "name": "maxHeight", + "description": "maximum height of the text box. See\nrectMode() for\nother options.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Loading & Displaying" + }, + { + "name": "textFont", + "file": "src/typography/loading_displaying.js", + "line": 424, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the font used by the text() function.

    \n

    The first parameter, font, sets the font. textFont() recognizes either\na p5.Font object or a string with the name of a\nsystem font. For example, 'Courier New'.

    \n

    The second parameter, size, is optional. It sets the font size in pixels.\nThis has the same effect as calling textSize().

    \n

    Note: WEBGL mode only supports fonts loaded with\nloadFont().

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n textFont('Courier New');\n textSize(24);\n text('hi', 35, 55);\n\n describe('The text \"hi\" written in a black, monospace font on a gray background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background('black');\n fill('palegreen');\n textFont('Courier New', 10);\n text('You turn to the left and see a door. Do you enter?', 5, 5, 90, 90);\n text('>', 5, 70);\n\n describe('A text prompt from a game is written in a green, monospace font on a black background.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n background(200);\n textFont('Verdana');\n let currentFont = textFont();\n text(currentFont, 25, 50);\n\n describe('The text \"Verdana\" written in a black, sans-serif font on a gray background.');\n}\n\n
    \n\n
    \n\nlet fontRegular;\nlet fontItalic;\nlet fontBold;\n\nfunction preload() {\n fontRegular = loadFont('assets/Regular.otf');\n fontItalic = loadFont('assets/Italic.ttf');\n fontBold = loadFont('assets/Bold.ttf');\n}\n\nfunction setup() {\n background(200);\n textFont(fontRegular);\n text('I am Normal', 10, 30);\n textFont(fontItalic);\n text('I am Italic', 10, 50);\n textFont(fontBold);\n text('I am Bold', 10, 70);\n\n describe('The statements \"I am Normal\", \"I am Italic\", and \"I am Bold\" written in black on separate lines. The statements have normal, italic, and bold fonts, respectively.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "current font or p5 Object.", + "type": "Object" + } + }, + { + "params": [ + { + "name": "font", + "description": "font as a p5.Font object or a string.", + "type": "Object|String" + }, + { + "name": "size", + "description": "font size in pixels.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "return": { + "description": "current font or p5 Object.", + "type": "Object" + }, + "class": "p5", + "static": false, + "module": "Typography", + "submodule": "Loading & Displaying" + }, + { + "name": "append", + "file": "src/utilities/array_functions.js", + "line": 30, + "itemtype": "method", + "description": "Adds a value to the end of an array. Extends the length of\nthe array by one. Maps to Array.push().", + "example": [ + "
    \nfunction setup() {\n let myArray = ['Mango', 'Apple', 'Papaya'];\n print(myArray); // ['Mango', 'Apple', 'Papaya']\n\n append(myArray, 'Peach');\n print(myArray); // ['Mango', 'Apple', 'Papaya', 'Peach']\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "array", + "description": "Array to append", + "type": "Array" + }, + { + "name": "value", + "description": "to be added to the Array", + "type": "any" + } + ], + "return": { + "description": "the array that was appended to", + "type": "Array" + } + } + ], + "return": { + "description": "the array that was appended to", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "arrayCopy", + "file": "src/utilities/array_functions.js", + "line": 80, + "itemtype": "method", + "description": "

    Copies an array (or part of an array) to another array. The src array is\ncopied to the dst array, beginning at the position specified by\nsrcPosition and into the position specified by dstPosition. The number of\nelements to copy is determined by length. Note that copying values\noverwrites existing values in the destination array. To append values\ninstead of overwriting them, use concat().

    \n

    The simplified version with only two arguments, arrayCopy(src, dst),\ncopies an entire array to another of the same size. It is equivalent to\narrayCopy(src, 0, dst, 0, src.length).

    \n

    Using this function is far more efficient for copying array data than\niterating through a for() loop and copying each element individually.

    \n", + "example": [ + "
    \nlet src = ['A', 'B', 'C'];\nlet dst = [1, 2, 3];\nlet srcPosition = 1;\nlet dstPosition = 0;\nlet length = 2;\n\nprint(src); // ['A', 'B', 'C']\nprint(dst); // [ 1 , 2 , 3 ]\n\narrayCopy(src, srcPosition, dst, dstPosition, length);\nprint(dst); // ['B', 'C', 3]\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "src", + "description": "the source Array", + "type": "Array" + }, + { + "name": "srcPosition", + "description": "starting position in the source Array", + "type": "Integer" + }, + { + "name": "dst", + "description": "the destination Array", + "type": "Array" + }, + { + "name": "dstPosition", + "description": "starting position in the destination Array", + "type": "Integer" + }, + { + "name": "length", + "description": "number of Array elements to be copied", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "src", + "type": "Array" + }, + { + "name": "dst", + "type": "Array" + }, + { + "name": "length", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "concat", + "file": "src/utilities/array_functions.js", + "line": 139, + "itemtype": "method", + "description": "Concatenates two arrays, maps to Array.concat(). Does not modify the\ninput arrays.", + "example": [ + "
    \nfunction setup() {\n let arr1 = ['A', 'B', 'C'];\n let arr2 = [1, 2, 3];\n\n print(arr1); // ['A','B','C']\n print(arr2); // [1,2,3]\n\n let arr3 = concat(arr1, arr2);\n\n print(arr1); // ['A','B','C']\n print(arr2); // [1, 2, 3]\n print(arr3); // ['A','B','C', 1, 2, 3]\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "a", + "description": "first Array to concatenate", + "type": "Array" + }, + { + "name": "b", + "description": "second Array to concatenate", + "type": "Array" + } + ], + "return": { + "description": "concatenated array", + "type": "Array" + } + } + ], + "return": { + "description": "concatenated array", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "reverse", + "file": "src/utilities/array_functions.js", + "line": 159, + "itemtype": "method", + "description": "Reverses the order of an array, maps to Array.reverse()", + "example": [ + "
    \nfunction setup() {\n let myArray = ['A', 'B', 'C'];\n print(myArray); // ['A','B','C']\n\n reverse(myArray);\n print(myArray); // ['C','B','A']\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "list", + "description": "Array to reverse", + "type": "Array" + } + ], + "return": { + "description": "the reversed list", + "type": "Array" + } + } + ], + "return": { + "description": "the reversed list", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "shorten", + "file": "src/utilities/array_functions.js", + "line": 180, + "itemtype": "method", + "description": "Decreases an array by one element and returns the shortened array,\nmaps to Array.pop().", + "example": [ + "
    \nfunction setup() {\n let myArray = ['A', 'B', 'C'];\n print(myArray); // ['A', 'B', 'C']\n let newArray = shorten(myArray);\n print(myArray); // ['A','B','C']\n print(newArray); // ['A','B']\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "list", + "description": "Array to shorten", + "type": "Array" + } + ], + "return": { + "description": "shortened Array", + "type": "Array" + } + } + ], + "return": { + "description": "shortened Array", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "shuffle", + "file": "src/utilities/array_functions.js", + "line": 209, + "itemtype": "method", + "description": "Randomizes the order of the elements of an array. Implements\n\nFisher-Yates Shuffle Algorithm.", + "example": [ + "
    \nfunction setup() {\n let regularArr = ['ABC', 'def', createVector(), TAU, Math.E];\n print(regularArr);\n shuffle(regularArr, true); // force modifications to passed array\n print(regularArr);\n\n // By default shuffle() returns a shuffled cloned array:\n let newArr = shuffle(regularArr);\n print(regularArr);\n print(newArr);\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "array", + "description": "Array to shuffle", + "type": "Array" + }, + { + "name": "bool", + "description": "modify passed array", + "optional": 1, + "type": "Boolean" + } + ], + "return": { + "description": "shuffled Array", + "type": "Array" + } + } + ], + "return": { + "description": "shuffled Array", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "sort", + "file": "src/utilities/array_functions.js", + "line": 262, + "itemtype": "method", + "description": "Sorts an array of numbers from smallest to largest, or puts an array of\nwords in alphabetical order. The original array is not modified; a\nre-ordered array is returned. The count parameter states the number of\nelements to sort. For example, if there are 12 elements in an array and\ncount is set to 5, only the first 5 elements in the array will be sorted.", + "example": [ + "
    \nfunction setup() {\n let words = ['banana', 'apple', 'pear', 'lime'];\n print(words); // ['banana', 'apple', 'pear', 'lime']\n let count = 4; // length of array\n\n words = sort(words, count);\n print(words); // ['apple', 'banana', 'lime', 'pear']\n}\n
    \n
    \nfunction setup() {\n let numbers = [2, 6, 1, 5, 14, 9, 8, 12];\n print(numbers); // [2, 6, 1, 5, 14, 9, 8, 12]\n let count = 5; // Less than the length of the array\n\n numbers = sort(numbers, count);\n print(numbers); // [1,2,5,6,14,9,8,12]\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "list", + "description": "Array to sort", + "type": "Array" + }, + { + "name": "count", + "description": "number of elements to sort, starting from 0", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "the sorted list", + "type": "Array" + } + } + ], + "return": { + "description": "the sorted list", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "splice", + "file": "src/utilities/array_functions.js", + "line": 301, + "itemtype": "method", + "description": "Inserts a value or an array of values into an existing array. The first\nparameter specifies the initial array to be modified, and the second\nparameter defines the data to be inserted. The third parameter is an index\nvalue which specifies the array position from which to insert data.\n(Remember that array index numbering starts at zero, so the first position\nis 0, the second position is 1, and so on.)", + "example": [ + "
    \nfunction setup() {\n let myArray = [0, 1, 2, 3, 4];\n let insArray = ['A', 'B', 'C'];\n print(myArray); // [0, 1, 2, 3, 4]\n print(insArray); // ['A','B','C']\n\n splice(myArray, insArray, 3);\n print(myArray); // [0,1,2,'A','B','C',3,4]\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "list", + "description": "Array to splice into", + "type": "Array" + }, + { + "name": "value", + "description": "value to be spliced in", + "type": "any" + }, + { + "name": "position", + "description": "in the array from which to insert data", + "type": "Integer" + } + ], + "return": { + "description": "the list", + "type": "Array" + } + } + ], + "return": { + "description": "the list", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "subset", + "file": "src/utilities/array_functions.js", + "line": 336, + "itemtype": "method", + "description": "Extracts an array of elements from an existing array. The list parameter\ndefines the array from which the elements will be copied, and the start\nand count parameters specify which elements to extract. If no count is\ngiven, elements will be extracted from the start to the end of the array.\nWhen specifying the start, remember that the first array element is 0.\nThis function does not change the source array.", + "example": [ + "
    \nfunction setup() {\n let myArray = [1, 2, 3, 4, 5];\n print(myArray); // [1, 2, 3, 4, 5]\n\n let sub1 = subset(myArray, 0, 3);\n let sub2 = subset(myArray, 2, 2);\n print(sub1); // [1,2,3]\n print(sub2); // [3,4]\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "list", + "description": "Array to extract from", + "type": "Array" + }, + { + "name": "start", + "description": "position to begin", + "type": "Integer" + }, + { + "name": "count", + "description": "number of values to extract", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "Array of extracted elements", + "type": "Array" + } + } + ], + "return": { + "description": "Array of extracted elements", + "type": "Array" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Array Functions" + }, + { + "name": "float", + "file": "src/utilities/conversion.js", + "line": 35, + "itemtype": "method", + "description": "

    Converts a string to its floating point representation. The contents of a\nstring must resemble a number, or NaN (not a number) will be returned.\nFor example, float(\"1234.56\") evaluates to 1234.56, but float(\"giraffe\")\nwill return NaN.

    \n

    When an array of values is passed in, then an array of floats of the same\nlength is returned.

    \n", + "example": [ + "
    \nlet str = '20';\nlet diameter = float(str);\nellipse(width / 2, height / 2, diameter, diameter);\ndescribe('20-by-20 white ellipse in the center of the canvas');\n
    \n
    \nprint(float('10.31')); // 10.31\nprint(float('Infinity')); // Infinity\nprint(float('-Infinity')); // -Infinity\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "float string to parse", + "type": "String" + } + ], + "return": { + "description": "floating point representation of string", + "type": "Number" + } + } + ], + "return": { + "description": "floating point representation of string", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "int", + "file": "src/utilities/conversion.js", + "line": 70, + "itemtype": "method", + "description": "Converts a boolean, string, or float to its integer representation.\nWhen an array of values is passed in, then an int array of the same length\nis returned.", + "example": [ + "
    \nprint(int('10')); // 10\nprint(int(10.31)); // 10\nprint(int(-10)); // -10\nprint(int(true)); // 1\nprint(int(false)); // 0\nprint(int([false, true, '10.3', 9.8])); // [0, 1, 10, 9]\nprint(int(Infinity)); // Infinity\nprint(int('-Infinity')); // -Infinity\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "String|Boolean|Number" + }, + { + "name": "radix", + "description": "the radix to convert to (default: 10)", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "integer representation of value", + "type": "Number" + } + }, + { + "params": [ + { + "name": "ns", + "description": "values to parse", + "type": "Array" + }, + { + "name": "radix", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "integer representation of values", + "type": "Number[]" + } + } + ], + "return": { + "description": "integer representation of value", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "str", + "file": "src/utilities/conversion.js", + "line": 104, + "itemtype": "method", + "description": "Converts a boolean, string or number to its string representation.\nWhen an array of values is passed in, then an array of strings of the same\nlength is returned.", + "example": [ + "
    \nprint(str('10')); // \"10\"\nprint(str(10.31)); // \"10.31\"\nprint(str(-10)); // \"-10\"\nprint(str(true)); // \"true\"\nprint(str(false)); // \"false\"\nprint(str([true, '10.3', 9.8])); // [ \"true\", \"10.3\", \"9.8\" ]\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "String|Boolean|Number|Array" + } + ], + "return": { + "description": "string representation of value", + "type": "String" + } + } + ], + "return": { + "description": "string representation of value", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "boolean", + "file": "src/utilities/conversion.js", + "line": 132, + "itemtype": "method", + "description": "Converts a number or string to its boolean representation.\nFor a number, any non-zero value (positive or negative) evaluates to true,\nwhile zero evaluates to false. For a string, the value \"true\" evaluates to\ntrue, while any other value evaluates to false. When an array of number or\nstring values is passed in, then a array of booleans of the same length is\nreturned.", + "example": [ + "
    \nprint(boolean(0)); // false\nprint(boolean(1)); // true\nprint(boolean('true')); // true\nprint(boolean('abcd')); // false\nprint(boolean([0, 12, 'true'])); // [false, true, true]\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "String|Boolean|Number|Array" + } + ], + "return": { + "description": "boolean representation of value", + "type": "Boolean" + } + } + ], + "return": { + "description": "boolean representation of value", + "type": "Boolean" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "byte", + "file": "src/utilities/conversion.js", + "line": 171, + "itemtype": "method", + "description": "Converts a number, string representation of a number, or boolean to its byte\nrepresentation. A byte can be only a whole number between -128 and 127, so\nwhen a value outside of this range is converted, it wraps around to the\ncorresponding byte representation. When an array of number, string or boolean\nvalues is passed in, then an array of bytes the same length is returned.", + "example": [ + "
    \nprint(byte(127)); // 127\nprint(byte(128)); // -128\nprint(byte(23.4)); // 23\nprint(byte('23.4')); // 23\nprint(byte('hello')); // NaN\nprint(byte(true)); // 1\nprint(byte([0, 255, '100'])); // [0, -1, 100]\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "String|Boolean|Number" + } + ], + "return": { + "description": "byte representation of value", + "type": "Number" + } + }, + { + "params": [ + { + "name": "ns", + "description": "values to parse", + "type": "Array" + } + ], + "return": { + "description": "array of byte representation of values", + "type": "Number[]" + } + } + ], + "return": { + "description": "byte representation of value", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "char", + "file": "src/utilities/conversion.js", + "line": 204, + "itemtype": "method", + "description": "Converts a number or string to its corresponding single-character\nstring representation. If a string parameter is provided, it is first\nparsed as an integer and then translated into a single-character string.\nWhen an array of number or string values is passed in, then an array of\nsingle-character strings of the same length is returned.", + "example": [ + "
    \nprint(char(65)); // \"A\"\nprint(char('65')); // \"A\"\nprint(char([65, 66, 67])); // [ \"A\", \"B\", \"C\" ]\nprint(join(char([65, 66, 67]), '')); // \"ABC\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "String|Number" + } + ], + "return": { + "description": "string representation of value", + "type": "String" + } + }, + { + "params": [ + { + "name": "ns", + "description": "values to parse", + "type": "Array" + } + ], + "return": { + "description": "array of string representation of values", + "type": "String[]" + } + } + ], + "return": { + "description": "string representation of value", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "unchar", + "file": "src/utilities/conversion.js", + "line": 235, + "itemtype": "method", + "description": "Converts a single-character string to its corresponding integer\nrepresentation. When an array of single-character string values is passed\nin, then an array of integers of the same length is returned.", + "example": [ + "
    \nprint(unchar('A')); // 65\nprint(unchar(['A', 'B', 'C'])); // [ 65, 66, 67 ]\nprint(unchar(split('ABC', ''))); // [ 65, 66, 67 ]\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "String" + } + ], + "return": { + "description": "integer representation of value", + "type": "Number" + } + }, + { + "params": [ + { + "name": "ns", + "description": "values to parse", + "type": "Array" + } + ], + "return": { + "description": "integer representation of values", + "type": "Number[]" + } + } + ], + "return": { + "description": "integer representation of value", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "hex", + "file": "src/utilities/conversion.js", + "line": 269, + "itemtype": "method", + "description": "Converts a number to a string in its equivalent hexadecimal notation. If a\nsecond parameter is passed, it is used to set the number of characters to\ngenerate in the hexadecimal notation. When an array is passed in, an\narray of strings in hexadecimal notation of the same length is returned.", + "example": [ + "
    \nprint(hex(255)); // \"000000FF\"\nprint(hex(255, 6)); // \"0000FF\"\nprint(hex([0, 127, 255], 6)); // [ \"000000\", \"00007F\", \"0000FF\" ]\nprint(Infinity); // \"FFFFFFFF\"\nprint(-Infinity); // \"00000000\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "Number" + }, + { + "name": "digits", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "hexadecimal string representation of value", + "type": "String" + } + }, + { + "params": [ + { + "name": "ns", + "description": "array of values to parse", + "type": "Number[]" + }, + { + "name": "digits", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "hexadecimal string representation of values", + "type": "String[]" + } + } + ], + "return": { + "description": "hexadecimal string representation of value", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "unhex", + "file": "src/utilities/conversion.js", + "line": 314, + "itemtype": "method", + "description": "Converts a string representation of a hexadecimal number to its equivalent\ninteger value. When an array of strings in hexadecimal notation is passed\nin, an array of integers of the same length is returned.", + "example": [ + "
    \nprint(unhex('A')); // 10\nprint(unhex('FF')); // 255\nprint(unhex(['FF', 'AA', '00'])); // [ 255, 170, 0 ]\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "value to parse", + "type": "String" + } + ], + "return": { + "description": "integer representation of hexadecimal value", + "type": "Number" + } + }, + { + "params": [ + { + "name": "ns", + "description": "values to parse", + "type": "Array" + } + ], + "return": { + "description": "integer representations of hexadecimal value", + "type": "Number[]" + } + } + ], + "return": { + "description": "integer representation of hexadecimal value", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "Conversion" + }, + { + "name": "join", + "file": "src/utilities/string_functions.js", + "line": 34, + "itemtype": "method", + "description": "Combines an array of Strings into one String, each separated by the\ncharacter(s) used for the separator parameter. To join arrays of ints or\nfloats, it's necessary to first convert them to Strings using nf() or\nnfs().", + "example": [ + "
    \n\nlet array = ['Hello', 'world!'];\nlet separator = ' ';\nlet message = join(array, separator);\ntext(message, 5, 50);\ndescribe('ā€œHello world!ā€ displayed middle left of canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "list", + "description": "array of Strings to be joined", + "type": "Array" + }, + { + "name": "separator", + "description": "String to be placed between each item", + "type": "String" + } + ], + "return": { + "description": "joined String", + "type": "String" + } + } + ], + "return": { + "description": "joined String", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "match", + "file": "src/utilities/string_functions.js", + "line": 72, + "itemtype": "method", + "description": "

    This function is used to apply a regular expression to a piece of text,\nand return matching groups (elements found inside parentheses) as a\nString array. If there are no matches, a null value will be returned.\nIf no groups are specified in the regular expression, but the sequence\nmatches, an array of length 1 (with the matched text as the first element\nof the array) will be returned.

    \n

    To use the function, first check to see if the result is null. If the\nresult is null, then the sequence did not match at all. If the sequence\ndid match, an array is returned.

    \n

    If there are groups (specified by sets of parentheses) in the regular\nexpression, then the contents of each will be returned in the array.\nElement [0] of a regular expression match returns the entire matching\nstring, and the match groups start at element [1] (the first group is [1],\nthe second [2], and so on).

    \n", + "example": [ + "
    \n\nlet string = 'Hello p5js*!';\nlet regexp = 'p5js\\\\*';\nlet m = match(string, regexp);\ntext(m, 5, 50);\ndescribe('ā€œp5js*ā€ displayed middle left of canvas.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "the String to be searched", + "type": "String" + }, + { + "name": "regexp", + "description": "the regexp to be used for matching", + "type": "String" + } + ], + "return": { + "description": "Array of Strings found", + "type": "String[]" + } + } + ], + "return": { + "description": "Array of Strings found", + "type": "String[]" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "matchAll", + "file": "src/utilities/string_functions.js", + "line": 109, + "itemtype": "method", + "description": "

    This function is used to apply a regular expression to a piece of text,\nand return a list of matching groups (elements found inside parentheses)\nas a two-dimensional String array. If there are no matches, a null value\nwill be returned. If no groups are specified in the regular expression,\nbut the sequence matches, a two dimensional array is still returned, but\nthe second dimension is only of length one.

    \n

    To use the function, first check to see if the result is null. If the\nresult is null, then the sequence did not match at all. If the sequence\ndid match, a 2D array is returned.

    \n

    If there are groups (specified by sets of parentheses) in the regular\nexpression, then the contents of each will be returned in the array.\nAssuming a loop with counter variable i, element [i][0] of a regular\nexpression match returns the entire matching string, and the match groups\nstart at element [i][1] (the first group is [i][1], the second [i][2],\nand so on).

    \n", + "example": [ + "
    \n\nlet string = 'Hello p5js*! Hello world!';\nlet regexp = 'Hello';\nmatchAll(string, regexp);\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "the String to be searched", + "type": "String" + }, + { + "name": "regexp", + "description": "the regexp to be used for matching", + "type": "String" + } + ], + "return": { + "description": "2d Array of Strings found", + "type": "String[]" + } + } + ], + "return": { + "description": "2d Array of Strings found", + "type": "String[]" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "nf", + "file": "src/utilities/string_functions.js", + "line": 176, + "itemtype": "method", + "description": "

    Utility function for formatting numbers into strings. There are two\nversions: one for formatting floats, and one for formatting ints.

    \n

    The values for the digits, left, and right parameters should always\nbe positive integers.

    \n

    (NOTE): Be cautious when using left and right parameters as it prepends numbers of 0's if the parameter\nif greater than the current length of the number.

    \n

    For example if number is 123.2 and left parameter passed is 4 which is greater than length of 123\n(integer part) i.e 3 than result will be 0123.2. Same case for right parameter i.e. if right is 3 than\nthe result will be 123.200.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n let num1 = 321;\n let num2 = -1321;\n\n noStroke();\n fill(0);\n textSize(16);\n\n text(nf(num1, 4, 2), 10, 30);\n text(nf(num2, 4, 2), 10, 80);\n // Draw dividing line\n stroke(120);\n line(0, 50, width, 50);\n\n describe('ā€œ0321.00ā€ middle top, ā€œ-1321.00ā€ middle bottom canvas');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "the Number to format", + "type": "Number|String" + }, + { + "name": "left", + "description": "number of digits to the left of the\ndecimal point", + "optional": 1, + "type": "Integer|String" + }, + { + "name": "right", + "description": "number of digits to the right of the\ndecimal point", + "optional": 1, + "type": "Integer|String" + } + ], + "return": { + "description": "formatted String", + "type": "String" + } + }, + { + "params": [ + { + "name": "nums", + "description": "the Numbers to format", + "type": "Array" + }, + { + "name": "left", + "optional": 1, + "type": "Integer|String" + }, + { + "name": "right", + "optional": 1, + "type": "Integer|String" + } + ], + "return": { + "description": "formatted Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "formatted String", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "nfc", + "file": "src/utilities/string_functions.js", + "line": 257, + "itemtype": "method", + "description": "Utility function for formatting numbers into strings and placing\nappropriate commas to mark units of 1000. There are two versions: one\nfor formatting ints, and one for formatting an array of ints. The value\nfor the right parameter should always be a positive integer.", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n let num = 11253106.115;\n let numArr = [1, 1, 2];\n\n noStroke();\n fill(0);\n textSize(12);\n\n // Draw formatted numbers\n text(nfc(num, 4), 10, 30);\n text(nfc(numArr, 2), 10, 80);\n\n // Draw dividing line\n stroke(120);\n line(0, 50, width, 50);\n\n describe('ā€œ11,253,106.115ā€ top middle and ā€œ1.00,1.00,2.00ā€ displayed bottom mid');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "the Number to format", + "type": "Number|String" + }, + { + "name": "right", + "description": "number of digits to the right of the\ndecimal point", + "optional": 1, + "type": "Integer|String" + } + ], + "return": { + "description": "formatted String", + "type": "String" + } + }, + { + "params": [ + { + "name": "nums", + "description": "the Numbers to format", + "type": "Array" + }, + { + "name": "right", + "optional": 1, + "type": "Integer|String" + } + ], + "return": { + "description": "formatted Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "formatted String", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "nfp", + "file": "src/utilities/string_functions.js", + "line": 334, + "itemtype": "method", + "description": "Utility function for formatting numbers into strings. Similar to nf() but\nputs a \"+\" in front of positive numbers and a \"-\" in front of negative\nnumbers. There are two versions: one for formatting floats, and one for\nformatting ints. The values for left, and right parameters\nshould always be positive integers.", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n let num1 = 11253106.115;\n let num2 = -11253106.115;\n\n noStroke();\n fill(0);\n textSize(12);\n\n // Draw formatted numbers\n text(nfp(num1, 4, 2), 10, 30);\n text(nfp(num2, 4, 2), 10, 80);\n\n // Draw dividing line\n stroke(120);\n line(0, 50, width, 50);\n\n describe('ā€œ+11253106.11ā€ top middle and ā€œ-11253106.11ā€ displayed bottom middle');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "the Number to format", + "type": "Number" + }, + { + "name": "left", + "description": "number of digits to the left of the decimal\npoint", + "optional": 1, + "type": "Integer" + }, + { + "name": "right", + "description": "number of digits to the right of the\ndecimal point", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "formatted String", + "type": "String" + } + }, + { + "params": [ + { + "name": "nums", + "description": "the Numbers to format", + "type": "Number[]" + }, + { + "name": "left", + "optional": 1, + "type": "Integer" + }, + { + "name": "right", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "formatted Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "formatted String", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "nfs", + "file": "src/utilities/string_functions.js", + "line": 411, + "itemtype": "method", + "description": "

    Utility function for formatting numbers into strings. Similar to nf() but\nputs an additional \"_\" (space) in front of positive numbers just in case to align it with negative\nnumbers which includes \"-\" (minus) sign.

    \n

    The main usecase of nfs() can be seen when one wants to align the digits (place values) of a non-negative\nnumber with some negative number (See the example to get a clear picture).\nThere are two versions: one for formatting float, and one for formatting int.

    \n

    The values for the digits, left, and right parameters should always be positive integers.

    \n

    (IMP): The result on the canvas basically the expected alignment can vary based on the typeface you are using.

    \n

    (NOTE): Be cautious when using left and right parameters as it prepends numbers of 0's if the parameter\nif greater than the current length of the number.

    \n

    For example if number is 123.2 and left parameter passed is 4 which is greater than length of 123\n(integer part) i.e 3 than result will be 0123.2. Same case for right parameter i.e. if right is 3 than\nthe result will be 123.200.

    \n", + "example": [ + "
    \n\nfunction setup() {\n background(200);\n let num1 = 321;\n let num2 = -1321;\n\n noStroke();\n fill(0);\n textSize(16);\n\n // nfs() aligns num1 (positive number) with num2 (negative number) by\n // adding a blank space in front of the num1 (positive number)\n // [left = 4] in num1 add one 0 in front, to align the digits with num2\n // [right = 2] in num1 and num2 adds two 0's after both numbers\n // To see the differences check the example of nf() too.\n text(nfs(num1, 4, 2), 10, 30);\n text(nfs(num2, 4, 2), 10, 80);\n // Draw dividing line\n stroke(120);\n line(0, 50, width, 50);\n\n describe('ā€œ0321.00ā€ top middle and ā€œ-1321.00ā€ displayed bottom middle');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "the Number to format", + "type": "Number" + }, + { + "name": "left", + "description": "number of digits to the left of the decimal\npoint", + "optional": 1, + "type": "Integer" + }, + { + "name": "right", + "description": "number of digits to the right of the\ndecimal point", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "formatted String", + "type": "String" + } + }, + { + "params": [ + { + "name": "nums", + "description": "the Numbers to format", + "type": "Array" + }, + { + "name": "left", + "optional": 1, + "type": "Integer" + }, + { + "name": "right", + "optional": 1, + "type": "Integer" + } + ], + "return": { + "description": "formatted Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "formatted String", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "split", + "file": "src/utilities/string_functions.js", + "line": 451, + "itemtype": "method", + "description": "

    The split() function maps to String.split(), it breaks a String into\npieces using a character or string as the delimiter. The delim parameter\nspecifies the character or characters that mark the boundaries between\neach piece. A String[] array is returned that contains each of the pieces.

    \n

    The splitTokens() function works in a similar fashion, except that it\nsplits using a range of characters instead of a specific character or\nsequence.

    \n", + "example": [ + "
    \n\nlet names = 'Pat,Xio,Alex';\nlet splitString = split(names, ',');\ntext(splitString[0], 5, 30);\ntext(splitString[1], 5, 50);\ntext(splitString[2], 5, 70);\ndescribe('ā€œPatā€ top left, ā€œXioā€ mid left, and ā€œAlexā€ displayed bottom left');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "the String to be split", + "type": "String" + }, + { + "name": "delim", + "description": "the String used to separate the data", + "type": "String" + } + ], + "return": { + "description": "Array of Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "Array of Strings", + "type": "String[]" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "splitTokens", + "file": "src/utilities/string_functions.js", + "line": 482, + "itemtype": "method", + "description": "

    The splitTokens() function splits a String at one or many character\ndelimiters or \"tokens.\" The delim parameter specifies the character or\ncharacters to be used as a boundary.

    \n

    If no delim characters are specified, any whitespace character is used to\nsplit. Whitespace characters include tab (\\t), line feed (\\n), carriage\nreturn (\\r), form feed (\\f), and space.

    \n", + "example": [ + "
    \n\nfunction setup() {\n let myStr = 'Mango, Banana, Lime';\n let myStrArr = splitTokens(myStr, ',');\n\n print(myStrArr); // prints : [\"Mango\",\" Banana\",\" Lime\"]\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "the String to be split", + "type": "String" + }, + { + "name": "delim", + "description": "list of individual Strings that will be used as\nseparators", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "Array of Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "Array of Strings", + "type": "String[]" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "trim", + "file": "src/utilities/string_functions.js", + "line": 532, + "itemtype": "method", + "description": "Removes whitespace characters from the beginning and end of a String. In\naddition to standard whitespace characters such as space, carriage return,\nand tab, this function also removes the Unicode \"nbsp\" character.", + "example": [ + "
    \n\nlet string = trim(' No new lines\\n ');\ntext(string + ' here', 2, 50);\ndescribe('ā€œNo new lines hereā€ displayed center canvas');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "a String to be trimmed", + "type": "String" + } + ], + "return": { + "description": "a trimmed String", + "type": "String" + } + }, + { + "params": [ + { + "name": "strs", + "description": "an Array of Strings to be trimmed", + "type": "Array" + } + ], + "return": { + "description": "an Array of trimmed Strings", + "type": "String[]" + } + } + ], + "return": { + "description": "a trimmed String", + "type": "String" + }, + "class": "p5", + "static": false, + "module": "Data", + "submodule": "String Functions" + }, + { + "name": "day", + "file": "src/utilities/time_date.js", + "line": 25, + "itemtype": "method", + "description": "p5.js communicates with the clock on your computer. The day() function\nreturns the current day as a value from 1 - 31.", + "example": [ + "
    \n\nlet d = day();\ntext('Current day: \\n' + d, 5, 50);\ndescribe('Current day is displayed');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the current day", + "type": "Integer" + } + } + ], + "return": { + "description": "the current day", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Time & Date" + }, + { + "name": "hour", + "file": "src/utilities/time_date.js", + "line": 44, + "itemtype": "method", + "description": "p5.js communicates with the clock on your computer. The hour() function\nreturns the current hour as a value from 0 - 23.", + "example": [ + "
    \n\nlet h = hour();\ntext('Current hour:\\n' + h, 5, 50);\ndescribe('Current hour is displayed');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the current hour", + "type": "Integer" + } + } + ], + "return": { + "description": "the current hour", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Time & Date" + }, + { + "name": "minute", + "file": "src/utilities/time_date.js", + "line": 63, + "itemtype": "method", + "description": "p5.js communicates with the clock on your computer. The minute() function\nreturns the current minute as a value from 0 - 59.", + "example": [ + "
    \n\nlet m = minute();\ntext('Current minute: \\n' + m, 5, 50);\ndescribe('Current minute is displayed');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the current minute", + "type": "Integer" + } + } + ], + "return": { + "description": "the current minute", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Time & Date" + }, + { + "name": "millis", + "file": "src/utilities/time_date.js", + "line": 83, + "itemtype": "method", + "description": "Returns the number of milliseconds (thousandths of a second) since\nstarting the sketch (when setup() is called). This information is often\nused for timing events and animation sequences.", + "example": [ + "
    \n\nlet millisecond = millis();\ntext('Milliseconds \\nrunning: \\n' + millisecond, 5, 40);\ndescribe('number of milliseconds since sketch has started displayed');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the number of milliseconds since starting the sketch", + "type": "Number" + } + } + ], + "return": { + "description": "the number of milliseconds since starting the sketch", + "type": "Number" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Time & Date" + }, + { + "name": "month", + "file": "src/utilities/time_date.js", + "line": 107, + "itemtype": "method", + "description": "p5.js communicates with the clock on your computer. The month() function\nreturns the current month as a value from 1 - 12.", + "example": [ + "
    \n\nlet m = month();\ntext('Current month: \\n' + m, 5, 50);\ndescribe('Current month is displayed');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the current month", + "type": "Integer" + } + } + ], + "return": { + "description": "the current month", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Time & Date" + }, + { + "name": "second", + "file": "src/utilities/time_date.js", + "line": 127, + "itemtype": "method", + "description": "p5.js communicates with the clock on your computer. The second() function\nreturns the current second as a value from 0 - 59.", + "example": [ + "
    \n\nlet s = second();\ntext('Current second: \\n' + s, 5, 50);\ndescribe('Current second is displayed');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the current second", + "type": "Integer" + } + } + ], + "return": { + "description": "the current second", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Time & Date" + }, + { + "name": "year", + "file": "src/utilities/time_date.js", + "line": 146, + "itemtype": "method", + "description": "p5.js communicates with the clock on your computer. The year() function\nreturns the current year as an integer (2014, 2015, 2016, etc).", + "example": [ + "
    \n\nlet y = year();\ntext('Current year: \\n' + y, 5, 50);\ndescribe('Current year is displayed');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the current year", + "type": "Integer" + } + } + ], + "return": { + "description": "the current year", + "type": "Integer" + }, + "class": "p5", + "static": false, + "module": "IO", + "submodule": "Time & Date" + }, + { + "name": "beginGeometry", + "file": "src/webgl/3d_primitives.js", + "line": 85, + "itemtype": "method", + "description": "

    Starts creating a new p5.Geometry. Subsequent shapes drawn will be added\nto the geometry and then returned when\nendGeometry() is called. One can also use\nbuildGeometry() to pass a function that\ndraws shapes.

    \n

    If you need to draw complex shapes every frame which don't change over time,\ncombining them upfront with beginGeometry() and endGeometry() and then\ndrawing that will run faster than repeatedly drawing the individual pieces.

    \n", + "example": [ + "
    \n\nlet shapes;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n makeShapes();\n}\n\nfunction makeShapes() {\n beginGeometry();\n scale(0.18);\n\n push();\n translate(100, -50);\n scale(0.5);\n rotateX(PI/4);\n cone();\n pop();\n cone();\n\n beginShape();\n vertex(-20, -50);\n quadraticVertex(\n -40, -70,\n 0, -60\n );\n endShape();\n\n beginShape(TRIANGLE_STRIP);\n for (let y = 20; y <= 60; y += 10) {\n for (let x of [20, 60]) {\n vertex(x, y);\n }\n }\n endShape();\n\n beginShape();\n vertex(-100, -120);\n vertex(-120, -110);\n vertex(-105, -100);\n endShape();\n\n shapes = endGeometry();\n}\n\nfunction draw() {\n background(255);\n lights();\n orbitControl();\n model(shapes);\n}\n\n
    " + ], + "alt": "A series of different flat, curved, and 3D shapes floating in space.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "endGeometry", + "file": "src/webgl/3d_primitives.js", + "line": 98, + "itemtype": "method", + "description": "Finishes creating a new p5.Geometry that was\nstarted using beginGeometry(). One can also\nuse buildGeometry() to pass a function that\ndraws shapes.", + "example": [], + "overloads": [ + { + "params": [], + "return": { + "description": "The model that was built.", + "type": "p5.Geometry" + } + } + ], + "return": { + "description": "The model that was built.", + "type": "p5.Geometry" + }, + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "buildGeometry", + "file": "src/webgl/3d_primitives.js", + "line": 163, + "itemtype": "method", + "description": "

    Creates a new p5.Geometry that contains all\nthe shapes drawn in a provided callback function. The returned combined shape\ncan then be drawn all at once using model().

    \n

    If you need to draw complex shapes every frame which don't change over time,\ncombining them with buildGeometry() once and then drawing that will run\nfaster than repeatedly drawing the individual pieces.

    \n

    One can also draw shapes directly between\nbeginGeometry() and\nendGeometry() instead of using a callback\nfunction.

    \n", + "example": [ + "
    \n\nlet particles;\nlet button;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n button = createButton('New');\n button.mousePressed(makeParticles);\n makeParticles();\n}\n\nfunction makeParticles() {\n if (particles) freeGeometry(particles);\n\n particles = buildGeometry(() => {\n for (let i = 0; i < 60; i++) {\n push();\n translate(\n randomGaussian(0, 20),\n randomGaussian(0, 20),\n randomGaussian(0, 20)\n );\n sphere(5);\n pop();\n }\n });\n}\n\nfunction draw() {\n background(255);\n noStroke();\n lights();\n orbitControl();\n model(particles);\n}\n\n
    " + ], + "alt": "A cluster of spheres.", + "overloads": [ + { + "params": [ + { + "name": "callback", + "description": "A function that draws shapes.", + "type": "Function" + } + ], + "return": { + "description": "The model that was built from the callback function.", + "type": "p5.Geometry" + } + } + ], + "return": { + "description": "The model that was built from the callback function.", + "type": "p5.Geometry" + }, + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "freeGeometry", + "file": "src/webgl/3d_primitives.js", + "line": 179, + "itemtype": "method", + "description": "

    Clears the resources of a model to free up browser memory. A model whose\nresources have been cleared can still be drawn, but the first time it is\ndrawn again, it might take longer.

    \n

    This method works on models generated with\nbuildGeometry() as well as those loaded\nfrom loadModel().

    \n", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "geometry", + "description": "The geometry whose resources should be freed", + "type": "p5.Geometry" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "plane", + "file": "src/webgl/3d_primitives.js", + "line": 219, + "itemtype": "method", + "chainable": 1, + "description": "Draw a plane with given a width and height", + "example": [ + "
    \n\n// draw a plane\n// with width 50 and height 50\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('a white plane with black wireframe lines');\n}\n\nfunction draw() {\n background(200);\n plane(50, 50);\n}\n\n
    " + ], + "alt": "Nothing displayed on canvas\nRotating interior view of a box with sides that change color.\n3d red and green gradient.\nRotating interior view of a cylinder with sides that change color.\nRotating view of a cylinder with sides that change color.\n3d red and green gradient.\nrotating view of a multi-colored cylinder with concave sides.", + "overloads": [ + { + "params": [ + { + "name": "width", + "description": "width of the plane", + "optional": 1, + "type": "Number" + }, + { + "name": "height", + "description": "height of the plane", + "optional": 1, + "type": "Number" + }, + { + "name": "detailX", + "description": "Optional number of triangle\nsubdivisions in x-dimension", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "Optional number of triangle\nsubdivisions in y-dimension", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "box", + "file": "src/webgl/3d_primitives.js", + "line": 300, + "itemtype": "method", + "chainable": 1, + "description": "Draw a box with given width, height and depth", + "example": [ + "
    \n\n// draw a spinning box\n// with width, height and depth of 50\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n describe('a white box rotating in 3D space');\n}\n\nfunction draw() {\n background(200);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "width", + "description": "width of the box", + "optional": 1, + "type": "Number" + }, + { + "name": "height", + "description": "height of the box", + "optional": 1, + "type": "Number" + }, + { + "name": "depth", + "description": "depth of the box", + "optional": 1, + "type": "Number" + }, + { + "name": "detailX", + "description": "Optional number of triangle\nsubdivisions in x-dimension", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "Optional number of triangle\nsubdivisions in y-dimension", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "sphere", + "file": "src/webgl/3d_primitives.js", + "line": 464, + "itemtype": "method", + "chainable": 1, + "description": "

    Draw a sphere with given radius.

    \n

    DetailX and detailY determines the number of subdivisions in the x-dimension\nand the y-dimension of a sphere. More subdivisions make the sphere seem\nsmoother. The recommended maximum values are both 24. Using a value greater\nthan 24 may cause a warning or slow down the browser.

    \n", + "example": [ + "
    \n\n// draw a sphere with radius 40\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('a white sphere with black wireframe lines');\n}\n\nfunction draw() {\n background(205, 102, 94);\n sphere(40);\n}\n\n
    ", + "
    \n\nlet detailX;\n// slide to see how detailX works\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailX = createSlider(3, 24, 3);\n detailX.position(10, height + 5);\n detailX.style('width', '80px');\n describe(\n 'a white sphere with low detail on the x-axis, including a slider to adjust detailX'\n );\n}\n\nfunction draw() {\n background(205, 105, 94);\n rotateY(millis() / 1000);\n sphere(40, detailX.value(), 16);\n}\n\n
    ", + "
    \n\nlet detailY;\n// slide to see how detailY works\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailY = createSlider(3, 16, 3);\n detailY.position(10, height + 5);\n detailY.style('width', '80px');\n describe(\n 'a white sphere with low detail on the y-axis, including a slider to adjust detailY'\n );\n}\n\nfunction draw() {\n background(205, 105, 94);\n rotateY(millis() / 1000);\n sphere(40, 16, detailY.value());\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "radius", + "description": "radius of circle", + "optional": 1, + "type": "Number" + }, + { + "name": "detailX", + "description": "optional number of subdivisions in x-dimension", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "optional number of subdivisions in y-dimension", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "cylinder", + "file": "src/webgl/3d_primitives.js", + "line": 683, + "itemtype": "method", + "chainable": 1, + "description": "

    Draw a cylinder with given radius and height

    \n

    DetailX and detailY determines the number of subdivisions in the x-dimension\nand the y-dimension of a cylinder. More subdivisions make the cylinder seem smoother.\nThe recommended maximum value for detailX is 24. Using a value greater than 24\nmay cause a warning or slow down the browser.

    \n", + "example": [ + "
    \n\n// draw a spinning cylinder\n// with radius 20 and height 50\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('a rotating white cylinder');\n}\n\nfunction draw() {\n background(205, 105, 94);\n rotateX(frameCount * 0.01);\n rotateZ(frameCount * 0.01);\n cylinder(20, 50);\n}\n\n
    ", + "
    \n\n// slide to see how detailX works\nlet detailX;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailX = createSlider(3, 24, 3);\n detailX.position(10, height + 5);\n detailX.style('width', '80px');\n describe(\n 'a rotating white cylinder with limited X detail, with a slider that adjusts detailX'\n );\n}\n\nfunction draw() {\n background(205, 105, 94);\n rotateY(millis() / 1000);\n cylinder(20, 75, detailX.value(), 1);\n}\n\n
    ", + "
    \n\n// slide to see how detailY works\nlet detailY;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailY = createSlider(1, 16, 1);\n detailY.position(10, height + 5);\n detailY.style('width', '80px');\n describe(\n 'a rotating white cylinder with limited Y detail, with a slider that adjusts detailY'\n );\n}\n\nfunction draw() {\n background(205, 105, 94);\n rotateY(millis() / 1000);\n cylinder(20, 75, 16, detailY.value());\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "radius", + "description": "radius of the surface", + "optional": 1, + "type": "Number" + }, + { + "name": "height", + "description": "height of the cylinder", + "optional": 1, + "type": "Number" + }, + { + "name": "detailX", + "description": "number of subdivisions in x-dimension;\ndefault is 24", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "number of subdivisions in y-dimension;\ndefault is 1", + "optional": 1, + "type": "Integer" + }, + { + "name": "bottomCap", + "description": "whether to draw the bottom of the cylinder", + "optional": 1, + "type": "Boolean" + }, + { + "name": "topCap", + "description": "whether to draw the top of the cylinder", + "optional": 1, + "type": "Boolean" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "cone", + "file": "src/webgl/3d_primitives.js", + "line": 825, + "itemtype": "method", + "chainable": 1, + "description": "

    Draw a cone with given radius and height

    \n

    DetailX and detailY determine the number of subdivisions in the x-dimension and\nthe y-dimension of a cone. More subdivisions make the cone seem smoother. The\nrecommended maximum value for detailX is 24. Using a value greater than 24\nmay cause a warning or slow down the browser.

    \n", + "example": [ + "
    \n\n// draw a spinning cone\n// with radius 40 and height 70\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('a rotating white cone');\n}\n\nfunction draw() {\n background(200);\n rotateX(frameCount * 0.01);\n rotateZ(frameCount * 0.01);\n cone(40, 70);\n}\n\n
    ", + "
    \n\n// slide to see how detailx works\nlet detailX;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailX = createSlider(3, 16, 3);\n detailX.position(10, height + 5);\n detailX.style('width', '80px');\n describe(\n 'a rotating white cone with limited X detail, with a slider that adjusts detailX'\n );\n}\n\nfunction draw() {\n background(205, 102, 94);\n rotateY(millis() / 1000);\n cone(30, 65, detailX.value(), 16);\n}\n\n
    ", + "
    \n\n// slide to see how detailY works\nlet detailY;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailY = createSlider(3, 16, 3);\n detailY.position(10, height + 5);\n detailY.style('width', '80px');\n describe(\n 'a rotating white cone with limited Y detail, with a slider that adjusts detailY'\n );\n}\n\nfunction draw() {\n background(205, 102, 94);\n rotateY(millis() / 1000);\n cone(30, 65, 16, detailY.value());\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "radius", + "description": "radius of the bottom surface", + "optional": 1, + "type": "Number" + }, + { + "name": "height", + "description": "height of the cone", + "optional": 1, + "type": "Number" + }, + { + "name": "detailX", + "description": "number of segments,\nthe more segments the smoother geometry\ndefault is 24", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "number of segments,\nthe more segments the smoother geometry\ndefault is 1", + "optional": 1, + "type": "Integer" + }, + { + "name": "cap", + "description": "whether to draw the base of the cone", + "optional": 1, + "type": "Boolean" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "ellipsoid", + "file": "src/webgl/3d_primitives.js", + "line": 946, + "itemtype": "method", + "chainable": 1, + "description": "

    Draw an ellipsoid with given radius

    \n

    DetailX and detailY determine the number of subdivisions in the x-dimension and\nthe y-dimension of a cone. More subdivisions make the ellipsoid appear to be smoother.\nAvoid detail number above 150, it may crash the browser.

    \n", + "example": [ + "
    \n\n// draw an ellipsoid\n// with radius 30, 40 and 40.\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('a white 3d ellipsoid');\n}\n\nfunction draw() {\n background(205, 105, 94);\n ellipsoid(30, 40, 40);\n}\n\n
    ", + "
    \n\n// slide to see how detailX works\nlet detailX;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailX = createSlider(2, 24, 12);\n detailX.position(10, height + 5);\n detailX.style('width', '80px');\n describe(\n 'a rotating white ellipsoid with limited X detail, with a slider that adjusts detailX'\n );\n}\n\nfunction draw() {\n background(205, 105, 94);\n rotateY(millis() / 1000);\n ellipsoid(30, 40, 40, detailX.value(), 8);\n}\n\n
    ", + "
    \n\n// slide to see how detailY works\nlet detailY;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n detailY = createSlider(2, 24, 6);\n detailY.position(10, height + 5);\n detailY.style('width', '80px');\n describe(\n 'a rotating white ellipsoid with limited Y detail, with a slider that adjusts detailY'\n );\n}\n\nfunction draw() {\n background(205, 105, 9);\n rotateY(millis() / 1000);\n ellipsoid(30, 40, 40, 12, detailY.value());\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "radiusx", + "description": "x-radius of ellipsoid", + "optional": 1, + "type": "Number" + }, + { + "name": "radiusy", + "description": "y-radius of ellipsoid", + "optional": 1, + "type": "Number" + }, + { + "name": "radiusz", + "description": "z-radius of ellipsoid", + "optional": 1, + "type": "Number" + }, + { + "name": "detailX", + "description": "number of segments,\nthe more segments the smoother geometry\ndefault is 24. Avoid detail number above\n150, it may crash the browser.", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "number of segments,\nthe more segments the smoother geometry\ndefault is 16. Avoid detail number above\n150, it may crash the browser.", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "torus", + "file": "src/webgl/3d_primitives.js", + "line": 1095, + "itemtype": "method", + "chainable": 1, + "description": "

    Draw a torus with given radius and tube radius

    \n

    DetailX and detailY determine the number of subdivisions in the x-dimension and\nthe y-dimension of a torus. More subdivisions make the torus appear to be smoother.\nThe default and maximum values for detailX and detailY are 24 and 16, respectively.\nSetting them to relatively small values like 4 and 6 allows you to create new\nshapes other than a torus.

    \n", + "example": [ + "
    \n\n// draw a spinning torus\n// with ring radius 30 and tube radius 15\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n describe('a rotating white torus');\n}\n\nfunction draw() {\n background(205, 102, 94);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n torus(30, 15);\n}\n\n
    ", + "
    \n\n// slide to see how detailX works\nlet detailX;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n detailX = createSlider(3, 24, 3);\n detailX.position(10, height + 5);\n detailX.style('width', '80px');\n describe(\n 'a rotating white torus with limited X detail, with a slider that adjusts detailX'\n );\n}\n\nfunction draw() {\n background(205, 102, 94);\n rotateY(millis() / 1000);\n torus(30, 15, detailX.value(), 12);\n}\n\n
    ", + "
    \n\n// slide to see how detailY works\nlet detailY;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n detailY = createSlider(3, 16, 3);\n detailY.position(10, height + 5);\n detailY.style('width', '80px');\n describe(\n 'a rotating white torus with limited Y detail, with a slider that adjusts detailY'\n );\n}\n\nfunction draw() {\n background(205, 102, 94);\n rotateY(millis() / 1000);\n torus(30, 15, 16, detailY.value());\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "radius", + "description": "radius of the whole ring", + "optional": 1, + "type": "Number" + }, + { + "name": "tubeRadius", + "description": "radius of the tube", + "optional": 1, + "type": "Number" + }, + { + "name": "detailX", + "description": "number of segments in x-dimension,\nthe more segments the smoother geometry\ndefault is 24", + "optional": 1, + "type": "Integer" + }, + { + "name": "detailY", + "description": "number of segments in y-dimension,\nthe more segments the smoother geometry\ndefault is 16", + "optional": 1, + "type": "Integer" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "orbitControl", + "file": "src/webgl/interaction.js", + "line": 71, + "itemtype": "method", + "chainable": 1, + "description": "Allows movement around a 3D sketch using a mouse or trackpad or touch.\nLeft-clicking and dragging or swipe motion will rotate the camera position\nabout the center of the sketch, right-clicking and dragging or multi-swipe\nwill pan the camera position without rotation, and using the mouse wheel\n(scrolling) or pinch in/out will move the camera further or closer\nfrom the center of the sketch. This function can be called with parameters\ndictating sensitivity to mouse/touch movement along the X and Y axes.\nCalling this function without parameters is equivalent to calling\norbitControl(1,1). To reverse direction of movement in either axis,\nenter a negative number for sensitivity.", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n describe(\n 'Camera orbits around a box when mouse is hold-clicked & then moved.'\n );\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n}\nfunction draw() {\n background(200);\n\n // If you execute the line commented out instead of next line, the direction of rotation\n // will be the direction the mouse or touch pointer moves, not around the X or Y axis.\n orbitControl();\n // orbitControl(1, 1, 1, {freeRotation: true});\n\n rotateY(0.5);\n box(30, 50);\n}\n\n
    " + ], + "alt": "Camera orbits around a box when mouse is hold-clicked & then moved.", + "overloads": [ + { + "params": [ + { + "name": "sensitivityX", + "description": "sensitivity to mouse movement along X axis", + "optional": 1, + "type": "Number" + }, + { + "name": "sensitivityY", + "description": "sensitivity to mouse movement along Y axis", + "optional": 1, + "type": "Number" + }, + { + "name": "sensitivityZ", + "description": "sensitivity to scroll movement along Z axis", + "optional": 1, + "type": "Number" + }, + { + "name": "options", + "description": "An optional object that can contain additional settings,\ndisableTouchActions - Boolean, default value is true.\nSetting this to true makes mobile interactions smoother by preventing\naccidental interactions with the page while orbiting. But if you're already\ndoing it via css or want the default touch actions, consider setting it to false.\nfreeRotation - Boolean, default value is false.\nBy default, horizontal movement of the mouse or touch pointer rotates the camera\naround the y-axis, and vertical movement rotates the camera around the x-axis.\nBut if setting this option to true, the camera always rotates in the direction\nthe pointer is moving. For zoom and move, the behavior is the same regardless of\ntrue/false.", + "optional": 1, + "type": "Object" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Interaction" + }, + { + "name": "debugMode", + "file": "src/webgl/interaction.js", + "line": 564, + "itemtype": "method", + "description": "

    debugMode() helps visualize 3D space by adding a grid to indicate where the\nā€˜groundā€™ is in a sketch and an axes icon which indicates the +X, +Y, and +Z\ndirections. This function can be called without parameters to create a\ndefault grid and axes icon, or it can be called according to the examples\nabove to customize the size and position of the grid and/or axes icon. The\ngrid is drawn using the most recently set stroke color and weight. To\nspecify these parameters, add a call to stroke() and strokeWeight()\njust before the end of the draw() loop.

    \n

    By default, the grid will run through the origin (0,0,0) of the sketch\nalong the XZ plane\nand the axes icon will be offset from the origin. Both the grid and axes\nicon will be sized according to the current canvas size. Note that because the\ngrid runs parallel to the default camera view, it is often helpful to use\ndebugMode along with orbitControl to allow full view of the grid.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n normalMaterial();\n debugMode();\n describe(\n 'a 3D box is centered on a grid in a 3D sketch. an icon indicates the direction of each axis: a red line points +X, a green line +Y, and a blue line +Z. the grid and icon disappear when the spacebar is pressed.'\n );\n}\n\nfunction draw() {\n background(200);\n orbitControl();\n box(15, 30);\n // Press the spacebar to turn debugMode off!\n if (keyIsDown(32)) {\n noDebugMode();\n }\n}\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n normalMaterial();\n debugMode(GRID);\n describe('a 3D box is centered on a grid in a 3D sketch.');\n}\n\nfunction draw() {\n background(200);\n orbitControl();\n box(15, 30);\n}\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n normalMaterial();\n debugMode(AXES);\n describe(\n 'a 3D box is centered in a 3D sketch. an icon indicates the direction of each axis: a red line points +X, a green line +Y, and a blue line +Z.'\n );\n}\n\nfunction draw() {\n background(200);\n orbitControl();\n box(15, 30);\n}\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n normalMaterial();\n debugMode(GRID, 100, 10, 0, 0, 0);\n describe('a 3D box is centered on a grid in a 3D sketch');\n}\n\nfunction draw() {\n background(200);\n orbitControl();\n box(15, 30);\n}\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n normalMaterial();\n debugMode(100, 10, 0, 0, 0, 20, 0, -40, 0);\n describe(\n 'a 3D box is centered on a grid in a 3D sketch. an icon indicates the direction of each axis: a red line points +X, a green line +Y, and a blue line +Z.'\n );\n}\n\nfunction draw() {\n noStroke();\n background(200);\n orbitControl();\n box(15, 30);\n // set the stroke color and weight for the grid!\n stroke(255, 0, 150);\n strokeWeight(0.8);\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "mode", + "description": "either GRID or AXES", + "type": "Constant" + } + ] + }, + { + "params": [ + { + "name": "mode", + "type": "Constant" + }, + { + "name": "gridSize", + "description": "size of one side of the grid", + "optional": 1, + "type": "Number" + }, + { + "name": "gridDivisions", + "description": "number of divisions in the grid", + "optional": 1, + "type": "Number" + }, + { + "name": "xOff", + "description": "X axis offset from origin (0,0,0)", + "optional": 1, + "type": "Number" + }, + { + "name": "yOff", + "description": "Y axis offset from origin (0,0,0)", + "optional": 1, + "type": "Number" + }, + { + "name": "zOff", + "description": "Z axis offset from origin (0,0,0)", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "mode", + "type": "Constant" + }, + { + "name": "axesSize", + "description": "size of axes icon", + "optional": 1, + "type": "Number" + }, + { + "name": "xOff", + "optional": 1, + "type": "Number" + }, + { + "name": "yOff", + "optional": 1, + "type": "Number" + }, + { + "name": "zOff", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "gridSize", + "optional": 1, + "type": "Number" + }, + { + "name": "gridDivisions", + "optional": 1, + "type": "Number" + }, + { + "name": "gridXOff", + "optional": 1, + "type": "Number" + }, + { + "name": "gridYOff", + "optional": 1, + "type": "Number" + }, + { + "name": "gridZOff", + "optional": 1, + "type": "Number" + }, + { + "name": "axesSize", + "optional": 1, + "type": "Number" + }, + { + "name": "axesXOff", + "optional": 1, + "type": "Number" + }, + { + "name": "axesYOff", + "optional": 1, + "type": "Number" + }, + { + "name": "axesZOff", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Interaction" + }, + { + "name": "noDebugMode", + "file": "src/webgl/interaction.js", + "line": 636, + "itemtype": "method", + "description": "Turns off debugMode() in a 3D sketch.", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n normalMaterial();\n debugMode();\n describe(\n 'a 3D box is centered on a grid in a 3D sketch. an icon indicates the direction of each axis: a red line points +X, a green line +Y, and a blue line +Z. the grid and icon disappear when the spacebar is pressed.'\n );\n}\n\nfunction draw() {\n background(200);\n orbitControl();\n box(15, 30);\n // Press the spacebar to turn debugMode off!\n if (keyIsDown(32)) {\n noDebugMode();\n }\n}\n\n
    " + ], + "alt": "a 3D box is centered on a grid in a 3D sketch. an icon\nindicates the direction of each axis: a red line points +X,\na green line +Y, and a blue line +Z. the grid and icon disappear when the\nspacebar is pressed.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Interaction" + }, + { + "name": "ambientLight", + "file": "src/webgl/light.js", + "line": 118, + "itemtype": "method", + "chainable": 1, + "description": "

    Creates an ambient light with the given color.

    \n

    Ambient light does not come from a specific direction.\nObjects are evenly lit from all sides. Ambient lights are\nalmost always used in combination with other types of lights.

    \n

    Note: lights need to be called (whether directly or indirectly)\nwithin draw() to remain persistent in a looping program.\nPlacing them in setup() will cause them to only have an effect\nthe first time through the loop.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noStroke();\n describe('sphere with coral color under black light');\n}\nfunction draw() {\n background(100);\n ambientLight(0); // black light (no light)\n ambientMaterial(255, 127, 80); // coral material\n sphere(40);\n}\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noStroke();\n describe('sphere with coral color under white light');\n}\nfunction draw() {\n background(100);\n ambientLight(255); // white light\n ambientMaterial(255, 127, 80); // coral material\n sphere(40);\n}\n\n
    ", + "
    \n\nfunction setup() {\n createCanvas(100,100,WEBGL);\n camera(0,-100,300);\n}\nfunction draw() {\n background(230);\n ambientMaterial(237,34,93); //Pink Material\n ambientLight(mouseY);\n //As you move the mouse up to down it changes from no ambient light to full ambient light.\n rotateY(millis()/2000);\n box(100);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to\nthe current color range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value\nrelative to the current color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value\nrelative to the current color range", + "type": "Number" + }, + { + "name": "alpha", + "description": "alpha value relative to current\ncolor range (default is 0-255)", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "number specifying value between\nwhite and black", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "a color string", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "an array containing the red,green,blue &\nand alpha components of the color", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color", + "type": "p5.Color" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "specularColor", + "file": "src/webgl/light.js", + "line": 232, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the color of the specular highlight of a non-ambient light\n(i.e. all lights except ambientLight()).

    \n

    specularColor() affects only the lights which are created after\nit in the code.

    \n

    This function is used in combination with\nspecularMaterial().\nIf a geometry does not use specularMaterial(), this function\nwill have no effect.

    \n

    The default color is white (255, 255, 255), which is used if\nspecularColor() is not explicitly called.

    \n

    Note: specularColor is equivalent to the Processing function\nlightSpecular.

    \n", + "example": [ + "
    \n\nlet setRedSpecularColor = true;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noStroke();\n describe(\n 'Sphere with specular highlight. Clicking the mouse toggles the specular highlight color between red and the default white.'\n );\n}\n\nfunction draw() {\n background(0);\n\n ambientLight(60);\n\n // add a point light to showcase specular color\n // -- use mouse location to position the light\n let lightPosX = mouseX - width / 2;\n let lightPosY = mouseY - height / 2;\n // -- set the light's specular color\n if (setRedSpecularColor) {\n specularColor(255, 0, 0); // red specular highlight\n }\n // -- create the light\n pointLight(200, 200, 200, lightPosX, lightPosY, 50); // white light\n\n // use specular material with high shininess\n specularMaterial(150);\n shininess(50);\n\n sphere(30, 64, 64);\n}\n\nfunction mouseClicked() {\n setRedSpecularColor = !setRedSpecularColor;\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to\nthe current color range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value\nrelative to the current color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value\nrelative to the current color range", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "number specifying value between\nwhite and black", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "color as a CSS string", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "color as an array containing the\nred, green, and blue components", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color", + "type": "p5.Color" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "directionalLight", + "file": "src/webgl/light.js", + "line": 330, + "itemtype": "method", + "chainable": 1, + "description": "

    Creates a directional light with the given color and direction.

    \n

    Directional light comes from one direction.\nThe direction is specified as numbers inclusively between -1 and 1.\nFor example, setting the direction as (0, -1, 0) will cause the\ngeometry to be lit from below (since the light will be facing\ndirectly upwards). Similarly, setting the direction as (1, 0, 0)\nwill cause the geometry to be lit from the left (since the light\nwill be facing directly rightwards).

    \n

    Directional lights do not have a specific point of origin, and\ntherefore cannot be positioned closer or farther away from a geometry.

    \n

    A maximum of 5 directional lights can be active at once.

    \n

    Note: lights need to be called (whether directly or indirectly)\nwithin draw() to remain persistent in a looping program.\nPlacing them in setup() will cause them to only have an effect\nthe first time through the loop.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe(\n 'scene with sphere and directional light. The direction of the light is controlled with the mouse position.'\n );\n}\nfunction draw() {\n background(0);\n //move your mouse to change light direction\n let dirX = (mouseX / width - 0.5) * 2;\n let dirY = (mouseY / height - 0.5) * 2;\n directionalLight(250, 250, 250, -dirX, -dirY, -1);\n noStroke();\n sphere(40);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to the current\ncolor range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value relative to the\ncurrent color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value relative to the\ncurrent color range", + "type": "Number" + }, + { + "name": "x", + "description": "x component of direction (inclusive range of -1 to 1)", + "type": "Number" + }, + { + "name": "y", + "description": "y component of direction (inclusive range of -1 to 1)", + "type": "Number" + }, + { + "name": "z", + "description": "z component of direction (inclusive range of -1 to 1)", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "type": "Number" + }, + { + "name": "v2", + "type": "Number" + }, + { + "name": "v3", + "type": "Number" + }, + { + "name": "direction", + "description": "direction of light as a\np5.Vector", + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color,\nas an array, or as a CSS string", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "type": "p5.Color|Number[]|String" + }, + { + "name": "direction", + "type": "p5.Vector" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "pointLight", + "file": "src/webgl/light.js", + "line": 457, + "itemtype": "method", + "chainable": 1, + "description": "

    Creates a point light with the given color and position.

    \n

    A point light emits light from a single point in all directions.\nBecause the light is emitted from a specific point (position),\nit has a different effect when it is positioned farther vs. nearer\nan object.

    \n

    A maximum of 5 point lights can be active at once.

    \n

    Note: lights need to be called (whether directly or indirectly)\nwithin draw() to remain persistent in a looping program.\nPlacing them in setup() will cause them to only have an effect\nthe first time through the loop.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe(\n 'scene with sphere and point light. The position of the light is controlled with the mouse position.'\n );\n}\nfunction draw() {\n background(0);\n // move your mouse to change light position\n let locX = mouseX - width / 2;\n let locY = mouseY - height / 2;\n // to set the light position,\n // think of the world's coordinate as:\n // -width/2,-height/2 ----------- width/2,-height/2\n // | |\n // | 0,0 |\n // | |\n // -width/2,height/2 ----------- width/2,height/2\n pointLight(250, 250, 250, locX, locY, 50);\n noStroke();\n sphere(40);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to the current\ncolor range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value relative to the\ncurrent color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value relative to the\ncurrent color range", + "type": "Number" + }, + { + "name": "x", + "description": "x component of position", + "type": "Number" + }, + { + "name": "y", + "description": "y component of position", + "type": "Number" + }, + { + "name": "z", + "description": "z component of position", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "type": "Number" + }, + { + "name": "v2", + "type": "Number" + }, + { + "name": "v3", + "type": "Number" + }, + { + "name": "position", + "description": "of light as a p5.Vector", + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color,\nas an array, or as a CSS string", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "type": "p5.Color|Number[]|String" + }, + { + "name": "position", + "type": "p5.Vector" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "imageLight", + "file": "src/webgl/light.js", + "line": 595, + "itemtype": "method", + "description": "

    Creates an image light with the given image.

    \n

    The image light simulates light from all the directions.\nThis is done by using the image as a texture for an infinitely\nlarge sphere light. This sphere contains\nor encapsulates the whole scene/drawing.\nIt will have different effect for varying shininess of the\nobject in the drawing.\nUnder the hood it is mainly doing 2 types of calculations,\nthe first one is creating an irradiance map the\nenvironment map of the input image.\nThe second one is managing reflections based on the shininess\nor roughness of the material used in the scene.

    \n

    Note: The image's diffuse light will be affected by fill()\nand the specular reflections will be affected by specularMaterial()\nand shininess().

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/outdoor_image.jpg');\n}\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0 ,1, 0);\n perspective(PI/3, 1, 5, 500);\n}\nfunction draw() {\n background(220);\n\n push();\n camera(0, 0, 1, 0, 0, 0, 0, 1, 0);\n ortho(-1, 1, -1, 1, 0, 1);\n noLights();\n noStroke();\n texture(img);\n plane(2);\n pop();\n\n ambientLight(50);\n imageLight(img);\n specularMaterial(20);\n noStroke();\n rotateX(frameCount * 0.005);\n rotateY(frameCount * 0.005);\n box(50);\n}\n\n
    ", + "
    \n\nlet img;\nlet slider;\n\nfunction preload() {\n img = loadImage('assets/outdoor_spheremap.jpg');\n}\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n slider = createSlider(0, 400, 100, 1);\n slider.position(0, height);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0 ,1, 0);\n perspective(PI/3, 1, 5, 500);\n}\nfunction draw() {\n background(220);\n\n push();\n camera(0, 0, 1, 0, 0, 0, 0, 1, 0);\n ortho(-1, 1, -1, 1, 0, 1);\n noLights();\n noStroke();\n texture(img);\n plane(2);\n pop();\n\n ambientLight(50);\n imageLight(img);\n specularMaterial(20);\n shininess(slider.value());\n noStroke();\n sphere(30);\n}\n\n
    " + ], + "alt": "image light example\nlight with slider having a slider for varying roughness", + "overloads": [ + { + "params": [ + { + "name": "img", + "description": "image for the background", + "type": "p5.image" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "lights", + "file": "src/webgl/light.js", + "line": 637, + "itemtype": "method", + "chainable": 1, + "description": "

    Places an ambient and directional light in the scene.\nThe lights are set to ambientLight(128, 128, 128) and\ndirectionalLight(128, 128, 128, 0, 0, -1).

    \n

    Note: lights need to be called (whether directly or indirectly)\nwithin draw() to remain persistent in a looping program.\nPlacing them in setup() will cause them to only have an effect\nthe first time through the loop.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n describe('the light is partially ambient and partially directional');\n}\nfunction draw() {\n background(0);\n lights();\n rotateX(millis() / 1000);\n rotateY(millis() / 1000);\n rotateZ(millis() / 1000);\n box();\n}\n\n
    " + ], + "alt": "the light is partially ambient and partially directional", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "lightFalloff", + "file": "src/webgl/light.js", + "line": 702, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the falloff rate for pointLight()\nand spotLight().

    \n

    lightFalloff() affects only the lights which are created after it\nin the code.

    \n

    The constant, linear, an quadratic parameters are used to calculate falloff as follows:

    \n

    d = distance from light position to vertex position

    \n

    falloff = 1 / (CONSTANT + d * LINEAR + (d * d) * QUADRATIC)

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noStroke();\n describe(\n 'Two spheres with different falloff values show different intensity of light'\n );\n}\nfunction draw() {\n ortho();\n background(0);\n\n let locX = mouseX - width / 2;\n let locY = mouseY - height / 2;\n locX /= 2; // half scale\n\n lightFalloff(1, 0, 0);\n push();\n translate(-25, 0, 0);\n pointLight(250, 250, 250, locX - 25, locY, 50);\n sphere(20);\n pop();\n\n lightFalloff(0.97, 0.03, 0);\n push();\n translate(25, 0, 0);\n pointLight(250, 250, 250, locX + 25, locY, 50);\n sphere(20);\n pop();\n}\n\n
    " + ], + "alt": "Two spheres with different falloff values show different intensity of light", + "overloads": [ + { + "params": [ + { + "name": "constant", + "description": "CONSTANT value for determining falloff", + "type": "Number" + }, + { + "name": "linear", + "description": "LINEAR value for determining falloff", + "type": "Number" + }, + { + "name": "quadratic", + "description": "QUADRATIC value for determining falloff", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "spotLight", + "file": "src/webgl/light.js", + "line": 896, + "itemtype": "method", + "chainable": 1, + "description": "

    Creates a spot light with the given color, position,\nlight direction, angle, and concentration.

    \n

    Like a pointLight(), a spotLight()\nemits light from a specific point (position). It has a different effect\nwhen it is positioned farther vs. nearer an object.

    \n

    However, unlike a pointLight(), the light is emitted in one direction\nalong a conical shape. The shape of the cone can be controlled using\nthe angle and concentration parameters.

    \n

    The angle parameter is used to\ndetermine the radius of the cone. And the concentration\nparameter is used to focus the light towards the center of\nthe cone. Both parameters are optional, however if you want\nto specify concentration, you must also specify angle.\nThe minimum concentration value is 1.

    \n

    A maximum of 5 spot lights can be active at once.

    \n

    Note: lights need to be called (whether directly or indirectly)\nwithin draw() to remain persistent in a looping program.\nPlacing them in setup() will cause them to only have an effect\nthe first time through the loop.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe(\n 'scene with sphere and spot light. The position of the light is controlled with the mouse position.'\n );\n}\nfunction draw() {\n background(0);\n // move your mouse to change light position\n let locX = mouseX - width / 2;\n let locY = mouseY - height / 2;\n // to set the light position,\n // think of the world's coordinate as:\n // -width/2,-height/2 ----------- width/2,-height/2\n // | |\n // | 0,0 |\n // | |\n // -width/2,height/2 ----------- width/2,height/2\n ambientLight(50);\n spotLight(0, 250, 0, locX, locY, 100, 0, 0, -1, Math.PI / 16);\n noStroke();\n sphere(40);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to the current color range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value relative to the current color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value relative to the current color range", + "type": "Number" + }, + { + "name": "x", + "description": "x component of position", + "type": "Number" + }, + { + "name": "y", + "description": "y component of position", + "type": "Number" + }, + { + "name": "z", + "description": "z component of position", + "type": "Number" + }, + { + "name": "rx", + "description": "x component of light direction (inclusive range of -1 to 1)", + "type": "Number" + }, + { + "name": "ry", + "description": "y component of light direction (inclusive range of -1 to 1)", + "type": "Number" + }, + { + "name": "rz", + "description": "z component of light direction (inclusive range of -1 to 1)", + "type": "Number" + }, + { + "name": "angle", + "description": "angle of cone. Defaults to PI/3", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "description": "concentration of cone. Defaults to 100", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color,\nas an array, or as a CSS string", + "type": "p5.Color|Number[]|String" + }, + { + "name": "position", + "description": "position of light as a p5.Vector", + "type": "p5.Vector" + }, + { + "name": "direction", + "description": "direction of light as a p5.Vector", + "type": "p5.Vector" + }, + { + "name": "angle", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "type": "Number" + }, + { + "name": "v2", + "type": "Number" + }, + { + "name": "v3", + "type": "Number" + }, + { + "name": "position", + "type": "p5.Vector" + }, + { + "name": "direction", + "type": "p5.Vector" + }, + { + "name": "angle", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "type": "Number" + }, + { + "name": "direction", + "type": "p5.Vector" + }, + { + "name": "angle", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "type": "p5.Color|Number[]|String" + }, + { + "name": "position", + "type": "p5.Vector" + }, + { + "name": "rx", + "type": "Number" + }, + { + "name": "ry", + "type": "Number" + }, + { + "name": "rz", + "type": "Number" + }, + { + "name": "angle", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "type": "Number" + }, + { + "name": "v2", + "type": "Number" + }, + { + "name": "v3", + "type": "Number" + }, + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "type": "Number" + }, + { + "name": "direction", + "type": "p5.Vector" + }, + { + "name": "angle", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "type": "Number" + }, + { + "name": "v2", + "type": "Number" + }, + { + "name": "v3", + "type": "Number" + }, + { + "name": "position", + "type": "p5.Vector" + }, + { + "name": "rx", + "type": "Number" + }, + { + "name": "ry", + "type": "Number" + }, + { + "name": "rz", + "type": "Number" + }, + { + "name": "angle", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "type": "Number" + }, + { + "name": "rx", + "type": "Number" + }, + { + "name": "ry", + "type": "Number" + }, + { + "name": "rz", + "type": "Number" + }, + { + "name": "angle", + "optional": 1, + "type": "Number" + }, + { + "name": "concentration", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "noLights", + "file": "src/webgl/light.js", + "line": 1157, + "itemtype": "method", + "chainable": 1, + "description": "

    Removes all lights present in a sketch.

    \n

    All subsequent geometry is rendered without lighting (until a new\nlight is created with a call to one of the lighting functions\n(lights(),\nambientLight(),\ndirectionalLight(),\npointLight(),\nspotLight()).

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe(\n 'Three white spheres. Each appears as a different color due to lighting.'\n );\n}\nfunction draw() {\n background(200);\n noStroke();\n\n ambientLight(255, 0, 0);\n translate(-30, 0, 0);\n ambientMaterial(255);\n sphere(13);\n\n noLights();\n translate(30, 0, 0);\n ambientMaterial(255);\n sphere(13);\n\n ambientLight(0, 255, 0);\n translate(30, 0, 0);\n ambientMaterial(255);\n sphere(13);\n}\n\n
    " + ], + "alt": "Three white spheres. Each appears as a different\ncolor due to lighting.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Lights" + }, + { + "name": "loadModel", + "file": "src/webgl/loading.js", + "line": 127, + "itemtype": "method", + "description": "

    Load a 3d model from an OBJ or STL file.

    \n

    loadModel() should be placed inside of preload().\nThis allows the model to load fully before the rest of your code is run.

    \n

    One of the limitations of the OBJ and STL format is that it doesn't have a built-in\nsense of scale. This means that models exported from different programs might\nbe very different sizes. If your model isn't displaying, try calling\nloadModel() with the normalized parameter set to true. This will resize the\nmodel to a scale appropriate for p5. You can also make additional changes to\nthe final size of your model with the scale() function.

    \n

    Also, the support for colored STL files is not present. STL files with color will be\nrendered without color properties.

    \n

    Options can include:

    \n
    • path: Specifies the location or path of the 3D model file for loading.
    • normalize: Enables standardized size scaling during loading if set to true.
    • successCallback: Callback for post-loading actions with the 3D model object.
    • failureCallback: Handles errors if model loading fails, receiving an event error.
    • fileType: Defines the file extension of the model.
    • flipU: Flips the U texture coordinates of the model.
    • flipV: Flips the V texture coordinates of the model.
    ", + "example": [ + "
    \n\n//draw a spinning octahedron\nlet octahedron;\n\nfunction preload() {\n octahedron = loadModel('assets/octahedron.obj');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('Vertically rotating 3-d octahedron.');\n}\n\nfunction draw() {\n background(200);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n model(octahedron);\n}\n\n
    ", + "
    \n\n//draw a spinning teapot\nlet teapot;\n\nfunction preload() {\n // Load model with normalise parameter set to true\n teapot = loadModel('assets/teapot.obj', true);\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('Vertically rotating 3-d teapot with red, green and blue gradient.');\n}\n\nfunction draw() {\n background(200);\n scale(0.4); // Scaled to make model fit into canvas\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n normalMaterial(); // For effect\n model(teapot);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "Path of the model to be loaded", + "type": "String" + }, + { + "name": "normalize", + "description": "If true, scale the model to a\nstandardized size when loading", + "type": "Boolean" + }, + { + "name": "successCallback", + "description": "Function to be called\nonce the model is loaded. Will be passed\nthe 3D model object.", + "optional": 1 + }, + { + "name": "failureCallback", + "description": "called with event error if\nthe model fails to load.", + "optional": 1 + }, + { + "name": "fileType", + "description": "The file extension of the model\n(.stl, .obj).", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "the p5.Geometry object", + "type": "p5.Geometry" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "successCallback", + "optional": 1 + }, + { + "name": "failureCallback", + "optional": 1 + }, + { + "name": "fileType", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "the p5.Geometry object", + "type": "p5.Geometry" + } + }, + { + "params": [ + { + "name": "path", + "type": "String" + }, + { + "name": "options", + "optional": 1, + "type": "Object" + }, + { + "name": "options.successCallback", + "description": "", + "optional": 1 + }, + { + "name": "options.failureCallback", + "description": "", + "optional": 1 + }, + { + "name": "options.fileType", + "description": "", + "optional": 1, + "type": "String" + }, + { + "name": "options.normalize", + "description": "", + "optional": 1, + "type": "boolean" + }, + { + "name": "options.flipU", + "description": "", + "optional": 1, + "type": "boolean" + }, + { + "name": "options.flipV", + "description": "", + "optional": 1, + "type": "boolean" + } + ], + "return": { + "description": "the p5.Geometry object", + "type": "p5.Geometry" + } + } + ], + "return": { + "description": "the p5.Geometry object", + "type": "p5.Geometry" + }, + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "parseObj", + "file": "src/webgl/loading.js", + "line": 238, + "itemtype": "method", + "description": "

    Parse OBJ lines into model. For reference, this is what a simple model of a\nsquare might look like:

    \n

    v -0.5 -0.5 0.5\nv -0.5 -0.5 -0.5\nv -0.5 0.5 -0.5\nv -0.5 0.5 0.5

    \n

    f 4 3 2 1

    \n", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "parseSTL", + "file": "src/webgl/loading.js", + "line": 344, + "itemtype": "method", + "description": "

    STL files can be of two types, ASCII and Binary,

    \n

    We need to convert the arrayBuffer to an array of strings,\nto parse it as an ASCII file.

    \n", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "isBinary", + "file": "src/webgl/loading.js", + "line": 378, + "itemtype": "method", + "description": "

    This function checks if the file is in ASCII format or in Binary format

    \n

    It is done by searching keyword solid at the start of the file.

    \n

    An ASCII STL data must begin with solid as the first six bytes.\nHowever, ASCII STLs lacking the SPACE after the d are known to be\nplentiful. So, check the first 5 bytes for solid.

    \n

    Several encodings, such as UTF-8, precede the text with up to 5 bytes:\nhttps://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding\nSearch for solid to start anywhere after those prefixes.

    \n", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "matchDataViewAt", + "file": "src/webgl/loading.js", + "line": 395, + "itemtype": "method", + "description": "This function matches the query at the provided offset", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "parseBinarySTL", + "file": "src/webgl/loading.js", + "line": 410, + "itemtype": "method", + "description": "

    This function parses the Binary STL files.\nhttps://en.wikipedia.org/wiki/STL_%28file_format%29#Binary_STL

    \n

    Currently there is no support for the colors provided in STL files.

    \n", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "parseASCIISTL", + "file": "src/webgl/loading.js", + "line": 502, + "itemtype": "method", + "description": "ASCII STL file starts with solid 'nameOfFile'\nThen contain the normal of the face, starting with facet normal\nNext contain a keyword indicating the start of face vertex, outer loop\nNext comes the three vertex, starting with vertex x y z\nVertices ends with endloop\nFace ends with endfacet\nNext face starts with facet normal\nThe end of the file is indicated by endsolid", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "model", + "file": "src/webgl/loading.js", + "line": 668, + "itemtype": "method", + "description": "Render a 3d model to the screen.", + "example": [ + "
    \n\n//draw a spinning octahedron\nlet octahedron;\n\nfunction preload() {\n octahedron = loadModel('assets/octahedron.obj');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('Vertically rotating 3-d octahedron.');\n}\n\nfunction draw() {\n background(200);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n model(octahedron);\n}\n\n
    " + ], + "alt": "Vertically rotating 3-d octahedron.", + "overloads": [ + { + "params": [ + { + "name": "model", + "description": "Loaded 3d model to be rendered", + "type": "p5.Geometry" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Shape", + "submodule": "3D Models" + }, + { + "name": "loadShader", + "file": "src/webgl/material.js", + "line": 64, + "itemtype": "method", + "description": "

    Creates a new p5.Shader object\nfrom the provided vertex and fragment shader files.

    \n

    The shader files are loaded asynchronously in the\nbackground, so this method should be used in preload().

    \n

    Shaders can alter the positioning of shapes drawn with them.\nTo ensure consistency in rendering, it's recommended to use the vertex shader in the createShader example.

    \n

    Note, shaders can only be used in WEBGL mode.

    \n", + "example": [ + "
    \n\nlet mandel;\nfunction preload() {\n // load the shader definitions from files\n mandel = loadShader('assets/shader.vert', 'assets/shader.frag');\n}\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n // use the shader\n shader(mandel);\n noStroke();\n mandel.setUniform('p', [-0.74364388703, 0.13182590421]);\n describe('zooming Mandelbrot set. a colorful, infinitely detailed fractal.');\n}\n\nfunction draw() {\n mandel.setUniform('r', 1.5 * exp(-6.5 * (1 + sin(millis() / 2000))));\n quad(-1, -1, 1, -1, 1, 1, -1, 1);\n}\n\n
    " + ], + "alt": "zooming Mandelbrot set. a colorful, infinitely detailed fractal.", + "overloads": [ + { + "params": [ + { + "name": "vertFilename", + "description": "path to file containing vertex shader\nsource code", + "type": "String" + }, + { + "name": "fragFilename", + "description": "path to file containing fragment shader\nsource code", + "type": "String" + }, + { + "name": "callback", + "description": "callback to be executed after loadShader\ncompletes. On success, the p5.Shader object is passed as the first argument.", + "optional": 1, + "type": "function" + }, + { + "name": "errorCallback", + "description": "callback to be executed when an error\noccurs inside loadShader. On error, the error is passed as the first\nargument.", + "optional": 1, + "type": "function" + } + ], + "return": { + "description": "a shader object created from the provided\nvertex and fragment shader files.", + "type": "p5.Shader" + } + } + ], + "return": { + "description": "a shader object created from the provided\nvertex and fragment shader files.", + "type": "p5.Shader" + }, + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "createShader", + "file": "src/webgl/material.js", + "line": 197, + "itemtype": "method", + "description": "

    Creates a new p5.Shader object\nfrom the provided vertex and fragment shader code.

    \n

    Note, shaders can only be used in WEBGL mode.

    \n

    Shaders can alter the positioning of shapes drawn with them.\nTo ensure consistency in rendering, it's recommended to use the vertex shader shown in the example below.

    \n", + "example": [ + "
    \n\n\n// the vertex shader is called for each vertex\nlet vs = `\nprecision highp float;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nvarying vec2 vTexCoord;\n\nvoid main() {\n vTexCoord = aTexCoord;\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n }\n`;\n\n\n// the fragment shader is called for each pixel\nlet fs = `\n precision highp float;\n uniform vec2 p;\n uniform float r;\n const int I = 500;\n varying vec2 vTexCoord;\n void main() {\n vec2 c = p + gl_FragCoord.xy * r, z = c;\n float n = 0.0;\n for (int i = I; i > 0; i --) {\n if(z.x*z.x+z.y*z.y > 4.0) {\n n = float(i)/float(I);\n break;\n }\n z = vec2(z.x*z.x-z.y*z.y, 2.0*z.x*z.y) + c;\n }\n gl_FragColor = vec4(0.5-cos(n*17.0)/2.0,0.5-cos(n*13.0)/2.0,0.5-cos(n*23.0)/2.0,1.0);\n }`;\n\nlet mandel;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n\n // create and initialize the shader\n mandel = createShader(vs, fs);\n shader(mandel);\n noStroke();\n\n // 'p' is the center point of the Mandelbrot image\n mandel.setUniform('p', [-0.74364388703, 0.13182590421]);\n describe('zooming Mandelbrot set. a colorful, infinitely detailed fractal.');\n}\n\nfunction draw() {\n // 'r' is the size of the image in Mandelbrot-space\n mandel.setUniform('r', 1.5 * exp(-6.5 * (1 + sin(millis() / 2000))));\n plane(width, height);\n}\n\n
    " + ], + "alt": "zooming Mandelbrot set. a colorful, infinitely detailed fractal.", + "overloads": [ + { + "params": [ + { + "name": "vertSrc", + "description": "source code for the vertex shader", + "type": "String" + }, + { + "name": "fragSrc", + "description": "source code for the fragment shader", + "type": "String" + } + ], + "return": { + "description": "a shader object created from the provided\nvertex and fragment shaders.", + "type": "p5.Shader" + } + } + ], + "return": { + "description": "a shader object created from the provided\nvertex and fragment shaders.", + "type": "p5.Shader" + }, + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "createFilterShader", + "file": "src/webgl/material.js", + "line": 279, + "itemtype": "method", + "description": "

    Creates a new p5.Shader using only a fragment shader, as a convenience method for creating image effects.\nIt's like createShader() but with a default vertex shader included.

    \n

    createFilterShader() is intended to be used along with filter() for filtering the contents of a canvas.\nA filter shader will not be applied to any geometries.

    \n

    The fragment shader receives some uniforms:

    \n
    • sampler2D tex0, which contains the canvas contents as a texture
    • vec2 canvasSize, which is the p5 width and height of the canvas (not including pixel density)
    • vec2 texelSize, which is the size of a physical pixel including pixel density (1.0/(width*density), 1.0/(height*density))

    For more info about filters and shaders, see Adam Ferriss' repo of shader examples\nor the introduction to shaders page.

    \n", + "example": [ + "
    \n\nfunction setup() {\n let fragSrc = `precision highp float;\n void main() {\n gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n }`;\n\n createCanvas(100, 100, WEBGL);\n let s = createFilterShader(fragSrc);\n filter(s);\n describe('a yellow canvas');\n}\n\n
    \n\n
    \n\nlet img, s;\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n let fragSrc = `precision highp float;\n\n // x,y coordinates, given from the vertex shader\n varying vec2 vTexCoord;\n\n // the canvas contents, given from filter()\n uniform sampler2D tex0;\n // other useful information from the canvas\n uniform vec2 texelSize;\n uniform vec2 canvasSize;\n // a custom variable from this sketch\n uniform float darkness;\n\n void main() {\n // get the color at current pixel\n vec4 color = texture2D(tex0, vTexCoord);\n // set the output color\n color.b = 1.0;\n color *= darkness;\n gl_FragColor = vec4(color.rgb, 1.0);\n }`;\n\n createCanvas(100, 100, WEBGL);\n s = createFilterShader(fragSrc);\n}\nfunction draw() {\n image(img, -50, -50);\n s.setUniform('darkness', 0.5);\n filter(s);\n describe('a image of bricks tinted dark blue');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "fragSrc", + "description": "source code for the fragment shader", + "type": "String" + } + ], + "return": { + "description": "a shader object created from the provided\nfragment shader.", + "type": "p5.Shader" + } + } + ], + "return": { + "description": "a shader object created from the provided\nfragment shader.", + "type": "p5.Shader" + }, + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "shader", + "file": "src/webgl/material.js", + "line": 424, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the p5.Shader object to\nbe used to render subsequent shapes.

    \n

    Shaders can alter the positioning of shapes drawn with them.\nTo ensure consistency in rendering, it's recommended to use the vertex shader in the createShader example.

    \n

    Custom shaders can be created using the\ncreateShader() and\nloadShader() functions.

    \n

    Use resetShader() to\nrestore the default shaders.

    \n

    Additional Information:\nThe shader will be used for:

    \n
    • Fills when a texture is enabled if it includes a uniform sampler2D.
    • Fills when lights are enabled if it includes the attribute aNormal, or if it has any of the following uniforms: uUseLighting, uAmbientLightCount, uDirectionalLightCount, uPointLightCount, uAmbientColor, uDirectionalDiffuseColors, uDirectionalSpecularColors, uPointLightLocation, uPointLightDiffuseColors, uPointLightSpecularColors, uLightingDirection, or uSpecular.
    • Fills whenever there are no lights or textures.
    • Strokes if it includes the uniform uStrokeWeight.\nNote: This behavior is considered experimental, and changes are planned in future releases.

    Note, shaders can only be used in WEBGL mode.

    \n", + "example": [ + "
    \n\n// Click within the image to toggle\n// the shader used by the quad shape\n// Note: for an alternative approach to the same example,\n// involving changing uniforms please refer to:\n// https://p5js.org/reference/#/p5.Shader/setUniform\n\nlet redGreen;\nlet orangeBlue;\nlet showRedGreen = false;\n\nfunction preload() {\n // note that we are using two instances\n // of the same vertex and fragment shaders\n redGreen = loadShader('assets/shader.vert', 'assets/shader-gradient.frag');\n orangeBlue = loadShader('assets/shader.vert', 'assets/shader-gradient.frag');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n\n // initialize the colors for redGreen shader\n shader(redGreen);\n redGreen.setUniform('colorCenter', [1.0, 0.0, 0.0]);\n redGreen.setUniform('colorBackground', [0.0, 1.0, 0.0]);\n\n // initialize the colors for orangeBlue shader\n shader(orangeBlue);\n orangeBlue.setUniform('colorCenter', [1.0, 0.5, 0.0]);\n orangeBlue.setUniform('colorBackground', [0.226, 0.0, 0.615]);\n\n noStroke();\n\n describe(\n 'canvas toggles between a circular gradient of orange and blue vertically. and a circular gradient of red and green moving horizontally when mouse is clicked/pressed.'\n );\n}\n\nfunction draw() {\n // update the offset values for each shader,\n // moving orangeBlue in vertical and redGreen\n // in horizontal direction\n orangeBlue.setUniform('offset', [0, sin(millis() / 2000) + 1]);\n redGreen.setUniform('offset', [sin(millis() / 2000), 1]);\n\n if (showRedGreen === true) {\n shader(redGreen);\n } else {\n shader(orangeBlue);\n }\n quad(-1, -1, 1, -1, 1, 1, -1, 1);\n}\n\nfunction mouseClicked() {\n showRedGreen = !showRedGreen;\n}\n\n
    " + ], + "alt": "canvas toggles between a circular gradient of orange and blue vertically. and a circular gradient of red and green moving horizontally when mouse is clicked/pressed.", + "overloads": [ + { + "params": [ + { + "name": "s", + "description": "the p5.Shader object\nto use for rendering shapes.", + "type": "p5.Shader" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "resetShader", + "file": "src/webgl/material.js", + "line": 524, + "itemtype": "method", + "chainable": 1, + "description": "Restores the default shaders. Code that runs after resetShader()\nwill not be affected by the shader previously set by\nshader()", + "example": [ + "
    \n\n// This variable will hold our shader object\nlet shaderProgram;\n\n// This variable will hold our vertex shader source code\nlet vertSrc = `\n attribute vec3 aPosition;\n attribute vec2 aTexCoord;\n uniform mat4 uProjectionMatrix;\n uniform mat4 uModelViewMatrix;\n varying vec2 vTexCoord;\n\n void main() {\n vTexCoord = aTexCoord;\n vec4 position = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * position;\n }\n`;\n\n// This variable will hold our fragment shader source code\nlet fragSrc = `\n precision mediump float;\n\n varying vec2 vTexCoord;\n\n void main() {\n vec2 uv = vTexCoord;\n vec3 color = vec3(uv.x, uv.y, min(uv.x + uv.y, 1.0));\n gl_FragColor = vec4(color, 1.0);\n }\n`;\n\nfunction setup() {\n // Shaders require WEBGL mode to work\n createCanvas(100, 100, WEBGL);\n\n // Create our shader\n shaderProgram = createShader(vertSrc, fragSrc);\n\n describe(\n 'Two rotating cubes. The left one is painted using a custom (user-defined) shader, while the right one is painted using the default fill shader.'\n );\n}\n\nfunction draw() {\n // Clear the scene\n background(200);\n\n // Draw a box using our shader\n // shader() sets the active shader with our shader\n shader(shaderProgram);\n push();\n translate(-width / 4, 0, 0);\n rotateX(millis() * 0.00025);\n rotateY(millis() * 0.0005);\n box(width / 4);\n pop();\n\n // Draw a box using the default fill shader\n // resetShader() restores the default fill shader\n resetShader();\n fill(255, 0, 0);\n push();\n translate(width / 4, 0, 0);\n rotateX(millis() * 0.00025);\n rotateY(millis() * 0.0005);\n box(width / 4);\n pop();\n}\n\n
    " + ], + "alt": "Two rotating cubes. The left one is painted using a custom (user-defined) shader,\nwhile the right one is painted using the default fill shader.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "texture", + "file": "src/webgl/material.js", + "line": 659, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the texture that will be used to render subsequent shapes.

    \n

    A texture is like a \"skin\" that wraps around a 3D geometry. Currently\nsupported textures are images, video, and offscreen renders.

    \n

    To texture a geometry created with beginShape(),\nyou will need to specify uv coordinates in vertex().

    \n

    Note, texture() can only be used in WEBGL mode.

    \n

    You can view more materials in this\nexample.

    \n", + "example": [ + "
    \n\nlet img;\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('spinning cube with a texture from an image');\n}\n\nfunction draw() {\n background(0);\n rotateZ(frameCount * 0.01);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n //pass image as texture\n texture(img);\n box(width / 2);\n}\n\n
    ", + "
    \n\nlet pg;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n pg = createGraphics(200, 200);\n pg.textSize(75);\n describe('plane with a texture from an image created by createGraphics()');\n}\n\nfunction draw() {\n background(0);\n pg.background(255);\n pg.text('hello!', 0, 100);\n //pass image as texture\n texture(pg);\n rotateX(0.5);\n noStroke();\n plane(50);\n}\n\n
    ", + "
    \n\nlet vid;\nfunction preload() {\n vid = createVideo('assets/fingers.mov');\n vid.hide();\n}\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('rectangle with video as texture');\n}\n\nfunction draw() {\n background(0);\n //pass video frame as texture\n texture(vid);\n rect(-40, -40, 80, 80);\n}\n\nfunction mousePressed() {\n vid.loop();\n}\n\n
    ", + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('quad with a texture, mapped using normalized coordinates');\n}\n\nfunction draw() {\n background(0);\n texture(img);\n textureMode(NORMAL);\n beginShape();\n vertex(-40, -40, 0, 0);\n vertex(40, -40, 1, 0);\n vertex(40, 40, 1, 1);\n vertex(-40, 40, 0, 1);\n endShape();\n}\n\n
    " + ], + "alt": "spinning cube with a texture from an image\nplane with a texture from an image created by createGraphics()\nrectangle with video as texture\nquad with a texture, mapped using normalized coordinates", + "overloads": [ + { + "params": [ + { + "name": "tex", + "description": "image to use as texture", + "type": "p5.Image|p5.MediaElement|p5.Graphics|p5.Texture|p5.Framebuffer|p5.FramebufferTexture" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "textureMode", + "file": "src/webgl/material.js", + "line": 742, + "itemtype": "method", + "description": "

    Sets the coordinate space for texture mapping. The default mode is IMAGE\nwhich refers to the actual coordinates of the image.\nNORMAL refers to a normalized space of values ranging from 0 to 1.

    \n

    With IMAGE, if an image is 100Ɨ200 pixels, mapping the image onto the entire\nsize of a quad would require the points (0,0) (100, 0) (100,200) (0,200).\nThe same mapping in NORMAL is (0,0) (1,0) (1,1) (0,1).

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('quad with a texture, mapped using normalized coordinates');\n}\n\nfunction draw() {\n texture(img);\n textureMode(NORMAL);\n beginShape();\n vertex(-50, -50, 0, 0);\n vertex(50, -50, 1, 0);\n vertex(50, 50, 1, 1);\n vertex(-50, 50, 0, 1);\n endShape();\n}\n\n
    ", + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('quad with a texture, mapped using image coordinates');\n}\n\nfunction draw() {\n texture(img);\n textureMode(IMAGE);\n beginShape();\n vertex(-50, -50, 0, 0);\n vertex(50, -50, img.width, 0);\n vertex(50, 50, img.width, img.height);\n vertex(-50, 50, 0, img.height);\n endShape();\n}\n\n
    " + ], + "alt": "quad with a texture, mapped using normalized coordinates\nquad with a texture, mapped using image coordinates", + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "either IMAGE or NORMAL", + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "textureWrap", + "file": "src/webgl/material.js", + "line": 815, + "itemtype": "method", + "description": "

    Sets the global texture wrapping mode. This controls how textures behave\nwhen their uv's go outside of the 0 to 1 range. There are three options:\nCLAMP, REPEAT, and MIRROR.

    \n

    CLAMP causes the pixels at the edge of the texture to extend to the bounds.\nREPEAT causes the texture to tile repeatedly until reaching the bounds.\nMIRROR works similarly to REPEAT but it flips the texture with every new tile.

    \n

    REPEAT & MIRROR are only available if the texture\nis a power of two size (128, 256, 512, 1024, etc.).

    \n

    This method will affect all textures in your sketch until a subsequent\ntextureWrap() call is made.

    \n

    If only one argument is provided, it will be applied to both the\nhorizontal and vertical axes.

    \n", + "example": [ + "
    \n\nlet img;\nfunction preload() {\n img = loadImage('assets/rockies128.jpg');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n textureWrap(MIRROR);\n describe('an image of the rocky mountains repeated in mirrored tiles');\n}\n\nfunction draw() {\n background(0);\n\n let dX = mouseX;\n let dY = mouseY;\n\n let u = lerp(1.0, 2.0, dX);\n let v = lerp(1.0, 2.0, dY);\n\n scale(width / 2);\n\n texture(img);\n\n beginShape(TRIANGLES);\n vertex(-1, -1, 0, 0, 0);\n vertex(1, -1, 0, u, 0);\n vertex(1, 1, 0, u, v);\n\n vertex(1, 1, 0, u, v);\n vertex(-1, 1, 0, 0, v);\n vertex(-1, -1, 0, 0, 0);\n endShape();\n}\n\n
    " + ], + "alt": "an image of the rocky mountains repeated in mirrored tiles", + "overloads": [ + { + "params": [ + { + "name": "wrapX", + "description": "either CLAMP, REPEAT, or MIRROR", + "type": "Constant" + }, + { + "name": "wrapY", + "description": "either CLAMP, REPEAT, or MIRROR", + "optional": 1, + "type": "Constant" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "normalMaterial", + "file": "src/webgl/material.js", + "line": 856, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the current material as a normal material.

    \n

    A normal material is not affected by light. It is often used as\na placeholder material when debugging.

    \n

    Surfaces facing the X-axis become red, those facing the Y-axis\nbecome green, and those facing the Z-axis become blue.

    \n

    You can view more materials in this\nexample.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('Sphere with normal material');\n}\n\nfunction draw() {\n background(200);\n normalMaterial();\n sphere(40);\n}\n\n
    " + ], + "alt": "Sphere with normal material", + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "ambientMaterial", + "file": "src/webgl/material.js", + "line": 969, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the ambient color of the material.

    \n

    The ambientMaterial() color represents the components\nof the ambientLight() color that the object reflects.

    \n

    Consider an ambientMaterial() with the color yellow (255, 255, 0).\nIf the ambientLight() emits the color white (255, 255, 255), then the object\nwill appear yellow as it will reflect the red and green components\nof the light. If the ambientLight() emits the color red (255, 0, 0), then\nthe object will appear red as it will reflect the red component\nof the light. If the ambientLight() emits the color blue (0, 0, 255),\nthen the object will appear black, as there is no component of\nthe light that it can reflect.

    \n

    You can view more materials in this\nexample.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('sphere reflecting red, blue, and green light');\n}\nfunction draw() {\n background(0);\n noStroke();\n ambientLight(255);\n ambientMaterial(70, 130, 230);\n sphere(40);\n}\n\n
    ", + "
    \n\n// ambientLight is both red and blue (magenta),\n// so object only reflects it's red and blue components\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('box reflecting only red and blue light');\n}\nfunction draw() {\n background(70);\n ambientLight(255, 0, 255); // magenta light\n ambientMaterial(255); // white material\n box(30);\n}\n\n
    ", + "
    \n\n// ambientLight is green. Since object does not contain\n// green, it does not reflect any light\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('box reflecting no light');\n}\nfunction draw() {\n background(70);\n ambientLight(0, 255, 0); // green light\n ambientMaterial(255, 0, 255); // magenta material\n box(30);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to the current\ncolor range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value relative to the\ncurrent color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value relative to the\ncurrent color range", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "number specifying value between\nwhite and black", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color,\nas an array, or as a CSS string", + "type": "p5.Color|Number[]|String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "emissiveMaterial", + "file": "src/webgl/material.js", + "line": 1040, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the emissive color of the material.

    \n

    An emissive material will display the emissive color at\nfull strength regardless of lighting. This can give the\nappearance that the object is glowing.

    \n

    Note, \"emissive\" is a misnomer in the sense that the material\ndoes not actually emit light that will affect surrounding objects.

    \n

    You can view more materials in this\nexample.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('sphere with green emissive material');\n}\nfunction draw() {\n background(0);\n noStroke();\n ambientLight(0);\n emissiveMaterial(130, 230, 0);\n sphere(40);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to the current\ncolor range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value relative to the\ncurrent color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value relative to the\ncurrent color range", + "type": "Number" + }, + { + "name": "alpha", + "description": "alpha value relative to current color\nrange (default is 0-255)", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "number specifying value between\nwhite and black", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color,\nas an array, or as a CSS string", + "type": "p5.Color|Number[]|String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "specularMaterial", + "file": "src/webgl/material.js", + "line": 1126, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the specular color of the material.

    \n

    A specular material is reflective (shiny). The shininess can be\ncontrolled by the shininess() function.

    \n

    Like ambientMaterial(),\nthe specularMaterial() color is the color the object will reflect\nunder ambientLight().\nHowever unlike ambientMaterial(), for all other types of lights\n(directionalLight(),\npointLight(),\nspotLight()),\na specular material will reflect the color of the light source.\nThis is what gives it its \"shiny\" appearance.

    \n

    You can view more materials in this\nexample.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noStroke();\n describe('torus with specular material');\n}\n\nfunction draw() {\n background(0);\n\n ambientLight(60);\n\n // add point light to showcase specular material\n let locX = mouseX - width / 2;\n let locY = mouseY - height / 2;\n pointLight(255, 255, 255, locX, locY, 50);\n\n specularMaterial(250);\n shininess(50);\n torus(30, 10, 64, 64);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "gray", + "description": "number specifying value between white and black.", + "type": "Number" + }, + { + "name": "alpha", + "description": "alpha value relative to current color range\n(default is 0-255)", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "red or hue value relative to\nthe current color range", + "type": "Number" + }, + { + "name": "v2", + "description": "green or saturation value\nrelative to the current color range", + "type": "Number" + }, + { + "name": "v3", + "description": "blue or brightness value\nrelative to the current color range", + "type": "Number" + }, + { + "name": "alpha", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "color as a p5.Color,\nas an array, or as a CSS string", + "type": "p5.Color|Number[]|String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "shininess", + "file": "src/webgl/material.js", + "line": 1175, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the amount of gloss (\"shininess\") of a\nspecularMaterial().

    \n

    The default and minimum value is 1.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n describe('two spheres, one more shiny than the other');\n}\nfunction draw() {\n background(0);\n noStroke();\n let locX = mouseX - width / 2;\n let locY = mouseY - height / 2;\n ambientLight(60, 60, 60);\n pointLight(255, 255, 255, locX, locY, 50);\n specularMaterial(250);\n translate(-25, 0, 0);\n shininess(1);\n sphere(20);\n translate(50, 0, 0);\n shininess(20);\n sphere(20);\n}\n\n
    " + ], + "alt": "two spheres, one more shiny than the other", + "overloads": [ + { + "params": [ + { + "name": "shine", + "description": "degree of shininess", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "metalness", + "file": "src/webgl/material.js", + "line": 1271, + "itemtype": "method", + "description": "

    Sets the metalness property of a material used in 3D rendering.

    \n

    The metalness property controls the degree to which the material\nappears metallic. A higher metalness value makes the material look\nmore metallic, while a lower value makes it appear less metallic.

    \n

    The default and minimum value is 0, indicating a non-metallic appearance.

    \n

    Unlike other materials, metals exclusively rely on reflections, particularly\nthose produced by specular lights (mirrorLike lights). They don't incorporate\ndiffuse or ambient lighting. Metals use a fill color to influence the overall\ncolor of their reflections. Pick a fill color, and you can easily change the\nappearance of the metal surfaces. When no fill color is provided, it defaults\nto using white.

    \n", + "example": [ + "
    \n\nlet img;\nlet slider;\nlet slider2;\nfunction preload() {\n img = loadImage('assets/outdoor_spheremap.jpg');\n}\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n slider = createSlider(0, 300, 100, 1);\n let sliderLabel = createP('Metalness');\n sliderLabel.position(100, height - 25);\n slider2 = createSlider(0, 350, 100);\n slider2.position(0, height + 20);\n slider2Label = createP('Shininess');\n slider2Label.position(100, height);\n}\nfunction draw() {\n background(220);\n imageMode(CENTER);\n push();\n image(img, 0, 0, width, height);\n clearDepth();\n pop();\n imageLight(img);\n fill('gray');\n specularMaterial('gray');\n shininess(slider2.value());\n metalness(slider.value());\n noStroke();\n sphere(30);\n}\n\n
    ", + "
    \n\nlet slider;\nlet slider2;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n slider = createSlider(0, 200, 100);\n let sliderLabel = createP('Metalness');\n sliderLabel.position(100, height - 25);\n slider2 = createSlider(0, 200, 2);\n slider2.position(0, height + 25);\n let slider2Label = createP('Shininess');\n slider2Label.position(100, height);\n}\nfunction draw() {\n noStroke();\n background(100);\n fill(255, 215, 0);\n pointLight(255, 255, 255, 5000, 5000, 75);\n specularMaterial('gray');\n ambientLight(100);\n shininess(slider2.value());\n metalness(slider.value());\n rotateY(frameCount * 0.01);\n torus(20, 10);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "metallic", + "description": "The degree of metalness.", + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "camera", + "file": "src/webgl/p5.Camera.js", + "line": 113, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the position of the current camera in a 3D sketch.\nParameters for this function define the camera's position,\nthe center of the sketch (where the camera is pointing),\nand an up direction (the orientation of the camera).

    \n

    This function simulates the movements of the camera, allowing objects to be\nviewed from various angles. Remember, it does not move the objects themselves\nbut the camera instead. For example when the centerX value is positive,\nand the camera is rotating to the right side of the sketch,\nthe object will seem like it's moving to the left.

    \n

    See this example\nto view the position of your camera.

    \n

    If no parameters are given, the following default is used:\ncamera(0, 0, 800, 0, 0, 0, 0, 1, 0)

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n describe('a square moving closer and then away from the camera.');\n}\nfunction draw() {\n background(204);\n //move the camera away from the plane by a sin wave\n camera(0, 0, 20 + sin(frameCount * 0.01) * 10, 0, 0, 0, 0, 1, 0);\n plane(10, 10);\n}\n\n
    ", + "
    \n\n//move slider to see changes!\n//sliders control the first 6 parameters of camera()\nlet sliderGroup = [];\nlet X;\nlet Y;\nlet Z;\nlet centerX;\nlet centerY;\nlet centerZ;\nlet h = 20;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n //create sliders\n for (var i = 0; i < 6; i++) {\n if (i === 2) {\n sliderGroup[i] = createSlider(10, 400, 200);\n } else {\n sliderGroup[i] = createSlider(-400, 400, 0);\n }\n h = map(i, 0, 6, 5, 85);\n sliderGroup[i].position(10, height + h);\n sliderGroup[i].style('width', '80px');\n }\n describe(\n 'White square repeatedly grows to fill canvas and then shrinks. An interactive example of a red cube with 3 sliders for moving it across x, y, z axis and 3 sliders for shifting its center.'\n );\n}\n\nfunction draw() {\n background(60);\n // assigning sliders' value to each parameters\n X = sliderGroup[0].value();\n Y = sliderGroup[1].value();\n Z = sliderGroup[2].value();\n centerX = sliderGroup[3].value();\n centerY = sliderGroup[4].value();\n centerZ = sliderGroup[5].value();\n camera(X, Y, Z, centerX, centerY, centerZ, 0, 1, 0);\n stroke(255);\n fill(255, 102, 94);\n box(85);\n}\n\n
    " + ], + "alt": "White square repeatedly grows to fill canvas and then shrinks.\nAn interactive example of a red cube with 3 sliders for moving it across x, y,\nz axis and 3 sliders for shifting its center.", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "camera position value on x axis", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "camera position value on y axis", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "camera position value on z axis", + "optional": 1, + "type": "Number" + }, + { + "name": "centerX", + "description": "x coordinate representing center of the sketch", + "optional": 1, + "type": "Number" + }, + { + "name": "centerY", + "description": "y coordinate representing center of the sketch", + "optional": 1, + "type": "Number" + }, + { + "name": "centerZ", + "description": "z coordinate representing center of the sketch", + "optional": 1, + "type": "Number" + }, + { + "name": "upX", + "description": "x component of direction 'up' from camera", + "optional": 1, + "type": "Number" + }, + { + "name": "upY", + "description": "y component of direction 'up' from camera", + "optional": 1, + "type": "Number" + }, + { + "name": "upZ", + "description": "z component of direction 'up' from camera", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "perspective", + "file": "src/webgl/p5.Camera.js", + "line": 188, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets a perspective projection for the current camera in a 3D sketch.\nThis projection represents depth through foreshortening: objects\nthat are close to the camera appear their actual size while those\nthat are further away from the camera appear smaller.

    \n

    The parameters to this function define the viewing frustum\n(the truncated pyramid within which objects are seen by the camera) through\nvertical field of view, aspect ratio (usually width/height), and near and far\nclipping planes.

    \n

    If no parameters are given, the default values are used as:

    \n
    • fov : The default field of view for the camera is such that the full height of renderer is visible when it is positioned at a default distance of 800 units from the camera.
    • aspect : The default aspect ratio is the ratio of renderer's width to renderer's height.
    • near : The default value for the near clipping plane is 80, which is 0.1 times the default distance from the camera to its subject.
    • far : The default value for the far clipping plane is 8000, which is 10 times the default distance from the camera to its subject.

    If you prefer a fixed field of view, follow these steps:

    \n
    • Choose your desired field of view angle (fovy). This is how wide the camera can see.
    • To ensure that you can see the entire width across horizontally and height across vertically, place the camera a distance of (height / 2) / tan(fovy / 2) back from its subject.
    • Call perspective with the chosen field of view, canvas aspect ratio, and near/far values:\nperspective(fovy, width / height, cameraDistance / 10, cameraDistance * 10);
    ", + "example": [ + "
    \n\n//drag the mouse to look around!\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n perspective(PI / 3.0, width / height, 0.1, 500);\n describe(\n 'two colored 3D boxes move back and forth, rotating as mouse is dragged.'\n );\n}\nfunction draw() {\n background(200);\n orbitControl();\n normalMaterial();\n\n rotateX(-0.3);\n rotateY(-0.2);\n translate(0, 0, -50);\n\n push();\n translate(-15, 0, sin(frameCount / 30) * 65);\n box(30);\n pop();\n push();\n translate(15, 0, sin(frameCount / 30 + PI) * 65);\n box(30);\n pop();\n}\n\n
    " + ], + "alt": "two colored 3D boxes move back and forth, rotating as mouse is dragged.", + "overloads": [ + { + "params": [ + { + "name": "fovy", + "description": "camera frustum vertical field of view,\nfrom bottom to top of view, in angleMode units", + "optional": 1, + "type": "Number" + }, + { + "name": "aspect", + "description": "camera frustum aspect ratio", + "optional": 1, + "type": "Number" + }, + { + "name": "near", + "description": "frustum near plane length", + "optional": 1, + "type": "Number" + }, + { + "name": "far", + "description": "frustum far plane length", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "ortho", + "file": "src/webgl/p5.Camera.js", + "line": 252, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets an orthographic projection for the current camera in a 3D sketch\nand defines a box-shaped viewing frustum within which objects are seen.\nIn this projection, all objects with the same dimension appear the same\nsize, regardless of whether they are near or far from the camera.

    \n

    The parameters to this function specify the viewing frustum where\nleft and right are the minimum and maximum x values, top and bottom are\nthe minimum and maximum y values, and near and far are the minimum and\nmaximum z values.

    \n

    If no parameters are given, the following default is used:\northo(-width/2, width/2, -height/2, height/2, 0, max(width, height)).

    \n", + "example": [ + "
    \n\n//drag the mouse to look around!\n//there's no vanishing point\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n ortho(-width / 2, width / 2, height / 2, -height / 2, 0, 500);\n describe(\n 'two 3D boxes move back and forth along same plane, rotating as mouse is dragged.'\n );\n}\nfunction draw() {\n background(200);\n orbitControl();\n normalMaterial();\n\n rotateX(0.2);\n rotateY(-0.2);\n push();\n translate(-15, 0, sin(frameCount / 30) * 65);\n box(30);\n pop();\n push();\n translate(15, 0, sin(frameCount / 30 + PI) * 65);\n box(30);\n pop();\n}\n\n
    " + ], + "alt": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", + "overloads": [ + { + "params": [ + { + "name": "left", + "description": "camera frustum left plane", + "optional": 1, + "type": "Number" + }, + { + "name": "right", + "description": "camera frustum right plane", + "optional": 1, + "type": "Number" + }, + { + "name": "bottom", + "description": "camera frustum bottom plane", + "optional": 1, + "type": "Number" + }, + { + "name": "top", + "description": "camera frustum top plane", + "optional": 1, + "type": "Number" + }, + { + "name": "near", + "description": "camera frustum near plane", + "optional": 1, + "type": "Number" + }, + { + "name": "far", + "description": "camera frustum far plane", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "frustum", + "file": "src/webgl/p5.Camera.js", + "line": 320, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the frustum of the current camera as defined by\nthe parameters.

    \n

    A frustum is a geometric form: a pyramid with its top\ncut off. With the viewer's eye at the imaginary top of\nthe pyramid, the six planes of the frustum act as clipping\nplanes when rendering a 3D view. Thus, any form inside the\nclipping planes is visible; anything outside\nthose planes is not visible.

    \n

    Setting the frustum changes the perspective of the scene being rendered.\nThis can be achieved more simply in many cases by using\nperspective().

    \n

    If no parameters are given, the following default is used:\nfrustum(-width/20, width/20, height/20, -height/20, eyeZ/10, eyeZ*10),\nwhere eyeZ is equal to 800.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n setAttributes('antialias', true);\n camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n frustum(-0.1, 0.1, -0.1, 0.1, 0.1, 200);\n describe(\n 'two 3D boxes move back and forth along same plane, rotating as mouse is dragged.'\n );\n}\nfunction draw() {\n background(200);\n orbitControl();\n normalMaterial();\n\n rotateY(-0.2);\n rotateX(-0.3);\n push();\n translate(-15, 0, sin(frameCount / 30) * 25);\n box(30);\n pop();\n push();\n translate(15, 0, sin(frameCount / 30 + PI) * 25);\n box(30);\n pop();\n}\n\n
    " + ], + "alt": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", + "overloads": [ + { + "params": [ + { + "name": "left", + "description": "camera frustum left plane", + "optional": 1, + "type": "Number" + }, + { + "name": "right", + "description": "camera frustum right plane", + "optional": 1, + "type": "Number" + }, + { + "name": "bottom", + "description": "camera frustum bottom plane", + "optional": 1, + "type": "Number" + }, + { + "name": "top", + "description": "camera frustum top plane", + "optional": 1, + "type": "Number" + }, + { + "name": "near", + "description": "camera frustum near plane", + "optional": 1, + "type": "Number" + }, + { + "name": "far", + "description": "camera frustum far plane", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "createCamera", + "file": "src/webgl/p5.Camera.js", + "line": 387, + "itemtype": "method", + "description": "

    Creates a new p5.Camera object and sets it\nas the current (active) camera.

    \n

    The new camera is initialized with a default position\n(see camera())\nand a default perspective projection\n(see perspective()).\nIts properties can be controlled with the p5.Camera\nmethods.

    \n

    Note: Every 3D sketch starts with a default camera initialized.\nThis camera can be controlled with the global methods\ncamera(),\nperspective(), ortho(),\nand frustum() if it is the only camera\nin the scene.

    \n", + "example": [ + "
    \n// Creates a camera object and animates it around a box.\nlet camera;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n background(0);\n camera = createCamera();\n camera.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n camera.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n describe('An example that creates a camera and moves it around the box.');\n}\n\nfunction draw() {\n background(0);\n // The camera will automatically\n // rotate to look at [0, 0, 0].\n camera.lookAt(0, 0, 0);\n\n // The camera will move on the\n // x axis.\n camera.setPosition(sin(frameCount / 60) * 200, 0, 100);\n box(20);\n\n // A 'ground' box to give the viewer\n // a better idea of where the camera\n // is looking.\n translate(0, 50, 0);\n rotateX(HALF_PI);\n box(150, 150, 20);\n}\n
    " + ], + "alt": "An example that creates a camera and moves it around the box.", + "overloads": [ + { + "params": [], + "return": { + "description": "The newly created camera object.", + "type": "p5.Camera" + } + } + ], + "return": { + "description": "The newly created camera object.", + "type": "p5.Camera" + }, + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "setCamera", + "file": "src/webgl/p5.Camera.js", + "line": 2282, + "itemtype": "method", + "description": "Sets the current (active) camera of a 3D sketch.\nAllows for switching between multiple cameras.", + "example": [ + "
    \n\nlet cam1, cam2;\nlet currentCamera;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n\n cam1 = createCamera();\n cam1.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam1.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n cam2 = createCamera();\n cam2.setPosition(30, 0, 50);\n cam2.lookAt(0, 0, 0);\n cam2.ortho(-50, 50, -50, 50, 0, 200);\n\n // set variable for previously active camera:\n currentCamera = 1;\n\n describe(\n 'Canvas switches between two camera views, each showing a series of spinning 3D boxes.'\n );\n}\n\nfunction draw() {\n background(200);\n\n // every 100 frames, switch between the two cameras\n if (frameCount % 100 === 0) {\n if (currentCamera === 1) {\n setCamera(cam1);\n currentCamera = 0;\n } else {\n setCamera(cam2);\n currentCamera = 1;\n }\n }\n\n // camera 1:\n cam1.lookAt(0, 0, 0);\n cam1.setPosition(sin(frameCount / 60) * 200, 0, 100);\n\n drawBoxes();\n}\n\nfunction drawBoxes() {\n rotateX(frameCount * 0.01);\n translate(-100, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n}\n\n
    " + ], + "alt": "Canvas switches between two camera views, each showing a series of spinning\n3D boxes.", + "overloads": [ + { + "params": [ + { + "name": "cam", + "description": "p5.Camera object", + "type": "p5.Camera" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "flipU", + "file": "src/webgl/p5.Geometry.js", + "line": 205, + "itemtype": "method", + "description": "Flips the U texture coordinates of the model.", + "example": [ + "
    \n\nlet img;\nlet model1;\nlet model2;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n createCanvas(150, 150, WEBGL);\n background(200);\n\n model1 = createShape(50, 50);\n model2 = createShape(50, 50);\n model2.flipU();\n}\n\nfunction draw() {\n background(0);\n\n // original\n push();\n translate(-40, 0, 0);\n texture(img);\n noStroke();\n plane(50);\n model(model1);\n pop();\n\n // flipped\n push();\n translate(40, 0, 0);\n texture(img);\n noStroke();\n plane(50);\n model(model2);\n pop();\n}\n\nfunction createShape(w, h) {\n return buildGeometry(() => {\n textureMode(NORMAL);\n beginShape();\n vertex(-w / 2, -h / 2, 0, 0);\n vertex(w / 2, -h / 2, 1, 0);\n vertex(w / 2, h / 2, 1, 1);\n vertex(-w / 2, h / 2, 0, 1);\n endShape(CLOSE);\n });\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "p5.Geometry" + } + } + ], + "return": { + "description": "", + "type": "p5.Geometry" + }, + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "flipV", + "file": "src/webgl/p5.Geometry.js", + "line": 277, + "itemtype": "method", + "description": "Flips the V texture coordinates of the model.", + "example": [ + "
    \n\nlet img;\nlet model1;\nlet model2;\n\nfunction preload() {\n img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n createCanvas(150, 150, WEBGL);\n background(200);\n\n model1 = createShape(50, 50);\n model2 = createShape(50, 50);\n model2.flipV();\n}\n\nfunction draw() {\n background(0);\n\n // original\n push();\n translate(-40, 0, 0);\n texture(img);\n noStroke();\n plane(50);\n model(model1);\n pop();\n\n // flipped\n push();\n translate(40, 0, 0);\n texture(img);\n noStroke();\n plane(50);\n model(model2);\n pop();\n}\n\nfunction createShape(w, h) {\n return buildGeometry(() => {\n textureMode(NORMAL);\n beginShape();\n vertex(-w / 2, -h / 2, 0, 0);\n vertex(w / 2, -h / 2, 1, 0);\n vertex(w / 2, h / 2, 1, 1);\n vertex(-w / 2, h / 2, 0, 1);\n endShape(CLOSE);\n });\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "p5.Geometry" + } + } + ], + "return": { + "description": "", + "type": "p5.Geometry" + }, + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "setAttributes", + "file": "src/webgl/p5.RendererGL.js", + "line": 261, + "itemtype": "method", + "description": "

    Set attributes for the WebGL Drawing context.\nThis is a way of adjusting how the WebGL\nrenderer works to fine-tune the display and performance.

    \n

    Note that this will reinitialize the drawing context\nif called after the WebGL canvas is made.

    \n

    If an object is passed as the parameter, all attributes\nnot declared in the object will be set to defaults.

    \n

    The available attributes are:\n
    \nalpha - indicates if the canvas contains an alpha buffer\ndefault is true

    \n

    depth - indicates whether the drawing buffer has a depth buffer\nof at least 16 bits - default is true

    \n

    stencil - indicates whether the drawing buffer has a stencil buffer\nof at least 8 bits

    \n

    antialias - indicates whether or not to perform anti-aliasing\ndefault is false (true in Safari)

    \n

    premultipliedAlpha - indicates that the page compositor will assume\nthe drawing buffer contains colors with pre-multiplied alpha\ndefault is true

    \n

    preserveDrawingBuffer - if true the buffers will not be cleared and\nand will preserve their values until cleared or overwritten by author\n(note that p5 clears automatically on draw loop)\ndefault is true

    \n

    perPixelLighting - if true, per-pixel lighting will be used in the\nlighting shader otherwise per-vertex lighting is used.\ndefault is true.

    \n

    version - either 1 or 2, to specify which WebGL version to ask for. By\ndefault, WebGL 2 will be requested. If WebGL2 is not available, it will\nfall back to WebGL 1. You can check what version is used with by looking at\nthe global webglVersion property.

    \n", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(255);\n push();\n rotateZ(frameCount * 0.02);\n rotateX(frameCount * 0.02);\n rotateY(frameCount * 0.02);\n fill(0, 0, 0);\n box(50);\n pop();\n}\n\n
    \n
    \nNow with the antialias attribute set to true.\n
    \n
    \n\nfunction setup() {\n setAttributes('antialias', true);\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(255);\n push();\n rotateZ(frameCount * 0.02);\n rotateX(frameCount * 0.02);\n rotateY(frameCount * 0.02);\n fill(0, 0, 0);\n box(50);\n pop();\n}\n\n
    \n\n
    \n\n// press the mouse button to disable perPixelLighting\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n noStroke();\n fill(255);\n}\n\nlet lights = [\n { c: '#f00', t: 1.12, p: 1.91, r: 0.2 },\n { c: '#0f0', t: 1.21, p: 1.31, r: 0.2 },\n { c: '#00f', t: 1.37, p: 1.57, r: 0.2 },\n { c: '#ff0', t: 1.12, p: 1.91, r: 0.7 },\n { c: '#0ff', t: 1.21, p: 1.31, r: 0.7 },\n { c: '#f0f', t: 1.37, p: 1.57, r: 0.7 }\n];\n\nfunction draw() {\n let t = millis() / 1000 + 1000;\n background(0);\n directionalLight(color('#222'), 1, 1, 1);\n\n for (let i = 0; i < lights.length; i++) {\n let light = lights[i];\n pointLight(\n color(light.c),\n p5.Vector.fromAngles(t * light.t, t * light.p, width * light.r)\n );\n }\n\n specularMaterial(255);\n sphere(width * 0.1);\n\n rotateX(t * 0.77);\n rotateY(t * 0.83);\n rotateZ(t * 0.91);\n torus(width * 0.3, width * 0.07, 24, 10);\n}\n\nfunction mousePressed() {\n setAttributes('perPixelLighting', false);\n noStroke();\n fill(255);\n}\nfunction mouseReleased() {\n setAttributes('perPixelLighting', true);\n noStroke();\n fill(255);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "Name of attribute", + "type": "String" + }, + { + "name": "value", + "description": "New value of named attribute", + "type": "Boolean" + } + ] + }, + { + "params": [ + { + "name": "obj", + "description": "object with key-value pairs", + "type": "Object" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "update", + "file": "src/webgl/p5.Texture.js", + "line": 201, + "itemtype": "method", + "description": "Checks if the source data for this texture has changed (if it's\neasy to do so) and reuploads the texture if necessary. If it's not\npossible or to expensive to do a calculation to determine wheter or\nnot the data has occurred, this method simply re-uploads the texture.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "bindTexture", + "file": "src/webgl/p5.Texture.js", + "line": 300, + "itemtype": "method", + "description": "Binds the texture to the appropriate GL target.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "unbindTexture", + "file": "src/webgl/p5.Texture.js", + "line": 313, + "itemtype": "method", + "description": "Unbinds the texture from the appropriate GL target.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "setInterpolation", + "file": "src/webgl/p5.Texture.js", + "line": 338, + "itemtype": "method", + "description": "Sets how a texture is be interpolated when upscaled or downscaled.\nNearest filtering uses nearest neighbor scaling when interpolating\nLinear filtering uses WebGL's linear scaling when interpolating", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "downScale", + "description": "Specifies the texture filtering when\ntextures are shrunk. Options are LINEAR or NEAREST", + "type": "String" + }, + { + "name": "upScale", + "description": "Specifies the texture filtering when\ntextures are magnified. Options are LINEAR or NEAREST", + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "setWrapMode", + "file": "src/webgl/p5.Texture.js", + "line": 368, + "itemtype": "method", + "description": "Sets the texture wrapping mode. This controls how textures behave\nwhen their uv's go outside of the 0 - 1 range. There are three options:\nCLAMP, REPEAT, and MIRROR. REPEAT & MIRROR are only available if the texture\nis a power of two size (128, 256, 512, 1024, etc.).", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "wrapX", + "description": "Controls the horizontal texture wrapping behavior", + "type": "String" + }, + { + "name": "wrapY", + "description": "Controls the vertical texture wrapping behavior", + "type": "String" + } + ] + } + ], + "class": "p5", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "toString", + "file": "src/color/p5.Color.js", + "line": 394, + "itemtype": "method", + "description": "Returns the color formatted as a string. Doing so can be useful for\ndebugging, or for using p5.js with other libraries.", + "example": [ + "
    \n\ncreateCanvas(200, 100);\nstroke(255);\nconst myColor = color(100, 100, 250);\nfill(myColor);\nrotate(HALF_PI);\ntext(myColor.toString(), 0, -5);\ntext(myColor.toString('#rrggbb'), 0, -30);\ntext(myColor.toString('rgba%'), 0, -55);\ndescribe('Three text representation of a color written sideways.');\n\n
    \n\n
    \n\nconst myColor = color(100, 130, 250);\ntext(myColor.toString('#rrggbb'), 25, 25);\ndescribe('A hexadecimal representation of a color.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "format", + "description": "how the color string will be formatted.\nLeaving this empty formats the string as rgba(r, g, b, a).\n'#rgb' '#rgba' '#rrggbb' and '#rrggbbaa' format as hexadecimal color codes.\n'rgb' 'hsb' and 'hsl' return the color formatted in the specified color mode.\n'rgba' 'hsba' and 'hsla' are the same as above but with alpha channels.\n'rgb%' 'hsb%' 'hsl%' 'rgba%' 'hsba%' and 'hsla%' format as percentages.", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "the formatted string.", + "type": "String" + } + } + ], + "return": { + "description": "the formatted string.", + "type": "String" + }, + "class": "p5.Color", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "setRed", + "file": "src/color/p5.Color.js", + "line": 585, + "itemtype": "method", + "description": "Sets the red component of a color. The range depends on the\ncolorMode(). In the default RGB mode it's\nbetween 0 and 255.", + "example": [ + "
    \n\nlet backgroundColor;\n\nfunction setup() {\n backgroundColor = color(100, 50, 150);\n}\n\nfunction draw() {\n backgroundColor.setRed(128 + 128 * sin(millis() / 1000));\n background(backgroundColor);\n describe('A canvas with a gradually changing background color.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "red", + "description": "the new red value.", + "type": "Number" + } + ] + } + ], + "class": "p5.Color", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "setGreen", + "file": "src/color/p5.Color.js", + "line": 614, + "itemtype": "method", + "description": "Sets the green component of a color. The range depends on the\ncolorMode(). In the default RGB mode it's\nbetween 0 and 255.", + "example": [ + "
    \n\nlet backgroundColor;\n\nfunction setup() {\n backgroundColor = color(100, 50, 150);\n}\n\nfunction draw() {\n backgroundColor.setGreen(128 + 128 * sin(millis() / 1000));\n background(backgroundColor);\n describe('A canvas with a gradually changing background color.');\n}\n\n
    \n*" + ], + "overloads": [ + { + "params": [ + { + "name": "green", + "description": "the new green value.", + "type": "Number" + } + ] + } + ], + "class": "p5.Color", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "setBlue", + "file": "src/color/p5.Color.js", + "line": 643, + "itemtype": "method", + "description": "Sets the blue component of a color. The range depends on the\ncolorMode(). In the default RGB mode it's\nbetween 0 and 255.", + "example": [ + "
    \n\nlet backgroundColor;\n\nfunction setup() {\n backgroundColor = color(100, 50, 150);\n}\n\nfunction draw() {\n backgroundColor.setBlue(128 + 128 * sin(millis() / 1000));\n background(backgroundColor);\n describe('A canvas with a gradually changing background color.');\n}\n\n
    \n*" + ], + "overloads": [ + { + "params": [ + { + "name": "blue", + "description": "the new blue value.", + "type": "Number" + } + ] + } + ], + "class": "p5.Color", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "setAlpha", + "file": "src/color/p5.Color.js", + "line": 672, + "itemtype": "method", + "description": "Sets the alpha (transparency) value of a color. The range depends on the\ncolorMode(). In the default RGB mode it's\nbetween 0 and 255.", + "example": [ + "
    \n\nfunction draw() {\n clear();\n background(200);\n const squareColor = color(100, 50, 100);\n squareColor.setAlpha(128 + 128 * sin(millis() / 1000));\n fill(squareColor);\n rect(13, 13, width - 26, height - 26);\n describe(\n 'A purple square with gradually changing opacity drawn on a gray background.'\n );\n}\n\n
    \n*" + ], + "overloads": [ + { + "params": [ + { + "name": "alpha", + "description": "the new alpha value.", + "type": "Number" + } + ] + } + ], + "class": "p5.Color", + "static": false, + "module": "Color", + "submodule": "Creating & Reading" + }, + { + "name": "reset", + "file": "src/core/p5.Graphics.js", + "line": 117, + "itemtype": "method", + "description": "Resets certain values such as those modified by functions in the Transform category\nand in the Lights category that are not automatically reset\nwith graphics buffer objects. Calling this in draw() will copy the behavior\nof the standard canvas.", + "example": [ + "
    \nlet pg;\nfunction setup() {\n createCanvas(100, 100);\n background(0);\n pg = createGraphics(50, 100);\n pg.fill(0);\n frameRate(5);\n}\n\nfunction draw() {\n image(pg, width / 2, 0);\n pg.background(255);\n // p5.Graphics object behave a bit differently in some cases\n // The normal canvas on the left resets the translate\n // with every loop through draw()\n // the graphics object on the right doesn't automatically reset\n // so translate() is additive and it moves down the screen\n rect(0, 0, width / 2, 5);\n pg.rect(0, 0, width / 2, 5);\n translate(0, 5, 0);\n pg.translate(0, 5, 0);\n}\nfunction mouseClicked() {\n // if you click you will see that\n // reset() resets the translate back to the initial state\n // of the Graphics object\n pg.reset();\n}\n
    " + ], + "alt": "A white line on a black background stays still on the top-left half.\nA black line animates from top to bottom on a white background on the right half.\nWhen clicked, the black line starts back over at the top.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Graphics", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "remove", + "file": "src/core/p5.Graphics.js", + "line": 176, + "itemtype": "method", + "description": "Removes a Graphics object from the page and frees any resources\nassociated with it.", + "example": [ + "
    \nlet bg;\nfunction setup() {\n bg = createCanvas(100, 100);\n bg.background(0);\n image(bg, 0, 0);\n bg.remove();\n}\n
    \n\n
    \nlet bg;\nfunction setup() {\n pixelDensity(1);\n createCanvas(100, 100);\n stroke(255);\n fill(0);\n\n // create and draw the background image\n bg = createGraphics(100, 100);\n bg.background(200);\n bg.ellipse(50, 50, 80, 80);\n}\nfunction draw() {\n let t = millis() / 1000;\n // draw the background\n if (bg) {\n image(bg, frameCount % 100, 0);\n image(bg, frameCount % 100 - 100, 0);\n }\n // draw the foreground\n let p = p5.Vector.fromAngle(t, 35).add(50, 50);\n ellipse(p.x, p.y, 30);\n}\nfunction mouseClicked() {\n // remove the background\n if (bg) {\n bg.remove();\n bg = null;\n }\n}\n
    " + ], + "alt": "no image\na multi-colored circle moving back and forth over a scrolling background.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Graphics", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "createFramebuffer", + "file": "src/core/p5.Graphics.js", + "line": 198, + "itemtype": "method", + "description": "

    Creates and returns a new p5.Framebuffer\ninside a p5.Graphics WebGL context.

    \n

    This takes the same parameters as the global\ncreateFramebuffer function.

    \n", + "example": [], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "p5.Framebuffer" + } + } + ], + "return": { + "description": "", + "type": "p5.Framebuffer" + }, + "class": "p5.Graphics", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "resize", + "file": "src/core/p5.Renderer.js", + "line": 122, + "itemtype": "method", + "description": "Resize our canvas element.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Renderer", + "static": false, + "module": "Rendering", + "submodule": "Rendering" + }, + { + "name": "size", + "file": "src/data/p5.TypedDict.js", + "line": 116, + "itemtype": "method", + "description": "Returns the number of key-value pairs currently stored in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict(1, 10);\n myDictionary.create(2, 20);\n myDictionary.create(3, 30);\n print(myDictionary.size()); // logs 3 to the console\n}\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the number of key-value pairs in the Dictionary", + "type": "Integer" + } + } + ], + "return": { + "description": "the number of key-value pairs in the Dictionary", + "type": "Integer" + }, + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "hasKey", + "file": "src/data/p5.TypedDict.js", + "line": 137, + "itemtype": "method", + "description": "Returns true if the given key exists in the Dictionary,\notherwise returns false.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n print(myDictionary.hasKey('p5')); // logs true to console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "that you want to look up", + "type": "Number|String" + } + ], + "return": { + "description": "whether that key exists in Dictionary", + "type": "Boolean" + } + } + ], + "return": { + "description": "whether that key exists in Dictionary", + "type": "Boolean" + }, + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "get", + "file": "src/data/p5.TypedDict.js", + "line": 158, + "itemtype": "method", + "description": "Returns the value stored at the given key.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n let myValue = myDictionary.get('p5');\n print(myValue === 'js'); // logs true to console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "the", + "description": "key you want to access", + "type": "Number|String" + } + ], + "return": { + "description": "the value stored at that key", + "type": "Number|String" + } + } + ], + "return": { + "description": "the value stored at that key", + "type": "Number|String" + }, + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "set", + "file": "src/data/p5.TypedDict.js", + "line": 184, + "itemtype": "method", + "description": "Updates the value associated with the given key in case it already exists\nin the Dictionary. Otherwise a new key-value pair is added.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n myDictionary.set('p5', 'JS');\n myDictionary.print(); // logs \"key: p5 - value: JS\" to console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "type": "Number|String" + }, + { + "name": "value", + "type": "Number|String" + } + ] + } + ], + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "create", + "file": "src/data/p5.TypedDict.js", + "line": 223, + "itemtype": "method", + "description": "Creates a new key-value pair in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n myDictionary.create('happy', 'coding');\n myDictionary.print();\n // above logs \"key: p5 - value: js, key: happy - value: coding\" to console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "type": "Number|String" + }, + { + "name": "value", + "type": "Number|String" + } + ] + }, + { + "params": [ + { + "name": "obj", + "description": "key/value pair", + "type": "Object" + } + ] + } + ], + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "clear", + "file": "src/data/p5.TypedDict.js", + "line": 251, + "itemtype": "method", + "description": "Removes all previously stored key-value pairs from the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n print(myDictionary.hasKey('p5')); // prints 'true'\n myDictionary.clear();\n print(myDictionary.hasKey('p5')); // prints 'false'\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "remove", + "file": "src/data/p5.TypedDict.js", + "line": 274, + "itemtype": "method", + "description": "Removes the key-value pair stored at the given key from the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n myDictionary.create('happy', 'coding');\n myDictionary.print();\n // above logs \"key: p5 - value: js, key: happy - value: coding\" to console\n myDictionary.remove('p5');\n myDictionary.print();\n // above logs \"key: happy value: coding\" to console\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "for the pair to remove", + "type": "Number|String" + } + ] + } + ], + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "print", + "file": "src/data/p5.TypedDict.js", + "line": 297, + "itemtype": "method", + "description": "Logs the set of items currently stored in the Dictionary to the console.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createStringDict('p5', 'js');\n myDictionary.create('happy', 'coding');\n myDictionary.print();\n // above logs \"key: p5 - value: js, key: happy - value: coding\" to console\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "saveTable", + "file": "src/data/p5.TypedDict.js", + "line": 328, + "itemtype": "method", + "description": "Converts the Dictionary into a CSV file for local download.", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n text('click here to save', 10, 10, 70, 80);\n}\n\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n createStringDict({\n john: 1940,\n paul: 1942,\n george: 1943,\n ringo: 1940\n }).saveTable('beatles');\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "saveJSON", + "file": "src/data/p5.TypedDict.js", + "line": 364, + "itemtype": "method", + "description": "Converts the Dictionary into a JSON file for local download.", + "example": [ + "
    \n\nfunction setup() {\n createCanvas(100, 100);\n background(200);\n text('click here to save', 10, 10, 70, 80);\n}\n\nfunction mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n createStringDict({\n john: 1940,\n paul: 1942,\n george: 1943,\n ringo: 1940\n }).saveJSON('beatles');\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.TypedDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "add", + "file": "src/data/p5.TypedDict.js", + "line": 432, + "itemtype": "method", + "description": "Add the given number to the value currently stored at the given key.\nThe sum then replaces the value previously stored in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict(2, 5);\n myDictionary.add(2, 2);\n print(myDictionary.get(2)); // logs 7 to console.\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "Key", + "description": "for the value you wish to add to", + "type": "Number" + }, + { + "name": "Number", + "description": "to add to the value", + "type": "Number" + } + ] + } + ], + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "sub", + "file": "src/data/p5.TypedDict.js", + "line": 457, + "itemtype": "method", + "description": "Subtract the given number from the value currently stored at the given key.\nThe difference then replaces the value previously stored in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict(2, 5);\n myDictionary.sub(2, 2);\n print(myDictionary.get(2)); // logs 3 to console.\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "Key", + "description": "for the value you wish to subtract from", + "type": "Number" + }, + { + "name": "Number", + "description": "to subtract from the value", + "type": "Number" + } + ] + } + ], + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "mult", + "file": "src/data/p5.TypedDict.js", + "line": 478, + "itemtype": "method", + "description": "Multiply the given number with the value currently stored at the given key.\nThe product then replaces the value previously stored in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict(2, 4);\n myDictionary.mult(2, 2);\n print(myDictionary.get(2)); // logs 8 to console.\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "Key", + "description": "for value you wish to multiply", + "type": "Number" + }, + { + "name": "Amount", + "description": "to multiply the value by", + "type": "Number" + } + ] + } + ], + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "div", + "file": "src/data/p5.TypedDict.js", + "line": 503, + "itemtype": "method", + "description": "Divide the given number with the value currently stored at the given key.\nThe quotient then replaces the value previously stored in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict(2, 8);\n myDictionary.div(2, 2);\n print(myDictionary.get(2)); // logs 4 to console.\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "Key", + "description": "for value you wish to divide", + "type": "Number" + }, + { + "name": "Amount", + "description": "to divide the value by", + "type": "Number" + } + ] + } + ], + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "minValue", + "file": "src/data/p5.TypedDict.js", + "line": 548, + "itemtype": "method", + "description": "Return the lowest number currently stored in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 });\n let lowestValue = myDictionary.minValue(); // value is -10\n print(lowestValue);\n}\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "maxValue", + "file": "src/data/p5.TypedDict.js", + "line": 566, + "itemtype": "method", + "description": "Return the highest number currently stored in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 });\n let highestValue = myDictionary.maxValue(); // value is 3\n print(highestValue);\n}\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "minKey", + "file": "src/data/p5.TypedDict.js", + "line": 605, + "itemtype": "method", + "description": "Return the lowest key currently used in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 });\n let lowestKey = myDictionary.minKey(); // value is 1.2\n print(lowestKey);\n}\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "maxKey", + "file": "src/data/p5.TypedDict.js", + "line": 623, + "itemtype": "method", + "description": "Return the highest key currently used in the Dictionary.", + "example": [ + "
    \n\nfunction setup() {\n let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 });\n let highestKey = myDictionary.maxKey(); // value is 4\n print(highestKey);\n}\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5.NumberDict", + "static": false, + "module": "Data", + "submodule": "Dictionary" + }, + { + "name": "play", + "file": "src/dom/dom.js", + "line": 3755, + "itemtype": "method", + "chainable": 1, + "description": "Play audio or video from a media element.", + "example": [ + "
    \n\nlet beat;\n\nfunction setup() {\n background(200);\n\n textAlign(CENTER);\n text('Click to play', 50, 50);\n\n // Create a p5.MediaElement using createAudio().\n beat = createAudio('assets/beat.mp3');\n\n describe('The text \"Click to play\" written in black on a gray background. A beat plays when the user clicks the square.');\n}\n\n// Play the beat when the user\n// presses the mouse.\nfunction mousePressed() {\n beat.play();\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "stop", + "file": "src/dom/dom.js", + "line": 3832, + "itemtype": "method", + "chainable": 1, + "description": "Stops a media element and sets its current time to zero. Calling\nmedia.play() will restart playing audio/video from the beginning.", + "example": [ + "
    \n\nlet beat;\nlet isStopped = true;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n beat = createAudio('assets/beat.mp3');\n\n describe('The text \"Click to start\" written in black on a gray background. The beat starts or stops when the user presses the mouse.');\n}\n\nfunction draw() {\n background(200);\n\n textAlign(CENTER);\n if (isStopped === true) {\n text('Click to start', 50, 50);\n } else {\n text('Click to stop', 50, 50);\n }\n}\n\n// Adjust playback when the user\n// presses the mouse.\nfunction mousePressed() {\n if (isStopped === true) {\n // If the beat is stopped,\n // play it.\n beat.play();\n isStopped = false;\n } else {\n // If the beat is playing,\n // stop it.\n beat.stop();\n isStopped = true;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "pause", + "file": "src/dom/dom.js", + "line": 3887, + "itemtype": "method", + "chainable": 1, + "description": "Pauses a media element. Calling media.play() will resume playing\naudio/video from the moment it paused.", + "example": [ + "
    \n\nlet beat;\nlet isPaused = true;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n beat = createAudio('assets/beat.mp3');\n\n describe('The text \"Click to play\" written in black on a gray background. The beat plays or pauses when the user clicks the square.');\n}\n\nfunction draw() {\n background(200);\n\n // Display different instructions\n // based on playback.\n textAlign(CENTER);\n if (isPaused === true) {\n text('Click to play', 50, 50);\n } else {\n text('Click to pause', 50, 50);\n }\n}\n\n// Adjust playback when the user\n// presses the mouse.\nfunction mousePressed() {\n if (isPaused === true) {\n // If the beat is paused,\n // play it.\n beat.play();\n isPaused = false;\n } else {\n // If the beat is playing,\n // pause it.\n beat.pause();\n isPaused = true;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "loop", + "file": "src/dom/dom.js", + "line": 3942, + "itemtype": "method", + "chainable": 1, + "description": "Play the audio/video repeatedly in a loop.", + "example": [ + "
    \n\nlet beat;\nlet isLooping = false;\n\nfunction setup() {\n background(200);\n\n // Create a p5.MediaElement using createAudio().\n beat = createAudio('assets/beat.mp3');\n\n describe('The text \"Click to loop\" written in black on a gray background. A beat plays repeatedly in a loop when the user clicks. The beat stops when the user clicks again.');\n}\n\nfunction draw() {\n background(200);\n\n // Display different instructions\n // based on playback.\n textAlign(CENTER);\n if (isLooping === true) {\n text('Click to stop', 50, 50);\n } else {\n text('Click to loop', 50, 50);\n }\n}\n\n// Adjust playback when the user\n// presses the mouse.\nfunction mousePressed() {\n if (isLooping === true) {\n // If the beat is looping,\n // stop it.\n beat.stop();\n isLooping = false;\n } else {\n // If the beat is stopped,\n // loop it.\n beat.loop();\n isLooping = true;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "noLoop", + "file": "src/dom/dom.js", + "line": 3998, + "itemtype": "method", + "chainable": 1, + "description": "Stops the audio/video from playing in a loop. It will stop when it\nreaches the end.", + "example": [ + "
    \n\nlet beat;\nlet isPlaying = false;\n\nfunction setup() {\n background(200);\n\n // Create a p5.MediaElement using createAudio().\n beat = createAudio('assets/beat.mp3');\n\n describe('The text \"Click to play\" written in black on a gray background. A beat plays when the user clicks. The beat stops when the user clicks again.');\n}\n\nfunction draw() {\n background(200);\n\n // Display different instructions\n // based on playback.\n textAlign(CENTER);\n if (isPlaying === true) {\n text('Click to stop', 50, 50);\n } else {\n text('Click to play', 50, 50);\n }\n}\n\n// Adjust playback when the user\n// presses the mouse.\nfunction mousePressed() {\n if (isPlaying === true) {\n // If the beat is playing,\n // stop it.\n beat.stop();\n isPlaying = false;\n } else {\n // If the beat is stopped,\n // play it.\n beat.play();\n isPlaying = true;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "autoplay", + "file": "src/dom/dom.js", + "line": 4071, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets the audio/video to play once it's loaded.

    \n

    The parameter, shouldAutoplay, is optional. Calling\nmedia.autoplay() without an argument causes the media to play\nautomatically. If true is passed, as in media.autoplay(true), the\nmedia will automatically play. If false is passed, as in\nmedia.autoPlay(false), it won't play automatically.

    \n", + "example": [ + "
    \n\nfunction setup() {\n noCanvas();\n\n // Load a video and play it automatically.\n let video = createVideo('assets/fingers.mov', () => {\n video.autoplay();\n video.size(100, 100);\n });\n\n describe('A video of fingers walking on a treadmill.');\n}\n\n
    \n\n
    \n\nfunction setup() {\n noCanvas();\n\n // Load a video, but don't play it automatically.\n let video = createVideo('assets/fingers.mov', () => {\n video.autoplay(false);\n video.size(100, 100);\n });\n\n // Play the video when the user clicks on it.\n video.mousePressed(() => {\n video.play();\n });\n\n describe('An image of fingers on a treadmill. They start walking when the user double-clicks on them.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "shouldAutoplay", + "description": "whether the element should autoplay.", + "optional": 1, + "type": "Boolean" + } + ] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "volume", + "file": "src/dom/dom.js", + "line": 4145, + "itemtype": "method", + "description": "

    Manages the audio/video volume.

    \n

    Calling media.volume() without an argument returns the current volume\nas a number in the range 0 (off) to 1 (maximum).

    \n

    The parameter, val, is optional. It's a number that sets the volume\nfrom 0 (off) to 1 (maximum). For example, calling media.volume(0.5)\nsets the volume to half of its maximum.

    \n", + "example": [ + "
    \n\nlet dragon;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n dragon = createAudio('assets/lucky_dragons.mp3');\n // Show the default media controls.\n dragon.showControls();\n\n describe('The text \"Volume: V\" on a gray square with media controls beneath it. The number \"V\" oscillates between 0 and 1 as the music plays.');\n}\n\nfunction draw() {\n background(200);\n\n // Produce a number between 0 and 1.\n let n = 0.5 * sin(frameCount * 0.01) + 0.5;\n // Use n to set the volume.\n dragon.volume(n);\n\n // Get the current volume\n // and display it.\n let v = dragon.volume();\n // Round v to 1 decimal place\n // for display.\n v = round(v, 1);\n textAlign(CENTER);\n text(`Volume: ${v}`, 50, 50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "current volume.", + "type": "Number" + } + } + ], + "return": { + "description": "current volume.", + "type": "Number" + }, + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "speed", + "file": "src/dom/dom.js", + "line": 4205, + "itemtype": "method", + "chainable": 1, + "description": "

    Manages the audio/video playback speed. Calling media.speed() returns\nthe current speed as a number.

    \n

    The parameter, val, is optional. It's a number that sets the playback\nspeed. 1 plays the media at normal speed, 0.5 plays it at half speed, 2\nplays it at double speed, and so on. -1 plays the media at normal speed\nin reverse.

    \n

    Note: Not all browsers support backward playback. Even if they do,\nplayback might not be smooth.

    \n", + "example": [ + "
    \n\nlet dragon;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n dragon = createAudio('assets/lucky_dragons.mp3');\n\n // Show the default media controls.\n dragon.showControls();\n\n describe('The text \"Speed: S\" on a gray square with media controls beneath it. The number \"S\" oscillates between 0 and 1 as the music plays.');\n}\n\nfunction draw() {\n background(200);\n\n // Produce a number between 0 and 2.\n let n = sin(frameCount * 0.01) + 1;\n // Use n to set the playback speed.\n dragon.speed(n);\n\n // Get the current speed\n // and display it.\n let s = dragon.speed();\n // Round s to 1 decimal place\n // for display.\n s = round(s, 1);\n textAlign(CENTER);\n text(`Speed: ${s}`, 50, 50);\n}\n" + ], + "overloads": [ + { + "params": [], + "return": { + "description": "current playback speed.", + "type": "Number" + } + }, + { + "params": [ + { + "name": "speed", + "description": "speed multiplier for playback.", + "type": "Number" + } + ] + } + ], + "return": { + "description": "current playback speed.", + "type": "Number" + }, + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "time", + "file": "src/dom/dom.js", + "line": 4290, + "itemtype": "method", + "chainable": 1, + "description": "

    Manages the media element's playback time. Calling media.time()\nreturns the number of seconds the audio/video has played. Time resets to\n0 when the looping media restarts.

    \n

    The parameter, time, is optional. It's a number that specifies the\ntime, in seconds, to jump to when playback begins.

    \n", + "example": [ + "
    \n\nlet dragon;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n dragon = createAudio('assets/lucky_dragons.mp3');\n // Show the default media controls.\n dragon.showControls();\n\n describe('The text \"S seconds\" on a gray square with media controls beneath it. The number \"S\" increases as the song plays.');\n}\n\nfunction draw() {\n background(200);\n\n // Display the current time.\n let s = dragon.time();\n // Round s to 1 decimal place\n // for display.\n s = round(s, 1);\n textAlign(CENTER);\n text(`${s} seconds`, 50, 50);\n}\n\n
    \n\n
    \n\nlet dragon;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n dragon = createAudio('assets/lucky_dragons.mp3');\n // Show the default media controls.\n dragon.showControls();\n\n // Jump to 2 seconds\n // to start.\n dragon.time(2);\n\n describe('The text \"S seconds\" on a gray square with media controls beneath it. The number \"S\" increases as the song plays.');\n}\n\nfunction draw() {\n background(200);\n\n // Display the current time.\n let s = dragon.time();\n // Round s to 1 decimal place\n // for display.\n s = round(s, 1);\n textAlign(CENTER);\n text(`${s} seconds`, 50, 50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "current time (in seconds).", + "type": "Number" + } + }, + { + "params": [ + { + "name": "time", + "description": "time to jump to (in seconds).", + "type": "Number" + } + ] + } + ], + "return": { + "description": "current time (in seconds).", + "type": "Number" + }, + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "duration", + "file": "src/dom/dom.js", + "line": 4336, + "itemtype": "method", + "description": "Returns the audio/video's duration in seconds.", + "example": [ + "
    \n\nlet dragon;\n\nfunction setup() {\n background(200);\n\n // Create a p5.MediaElement using createAudio().\n dragon = createAudio('assets/lucky_dragons.mp3');\n // Show the default media controls.\n dragon.showControls();\n\n describe('The text \"S seconds left\" on a gray square with media controls beneath it. The number \"S\" decreases as the song plays.');\n}\n\nfunction draw() {\n background(200);\n\n // Calculate the time remaining.\n let s = dragon.duration() - dragon.time();\n // Round s to 1 decimal place\n // for display.\n s = round(s, 1);\n\n // Display the time remaining.\n textAlign(CENTER);\n text(`${s} seconds left`, 50, 50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "duration (in seconds).", + "type": "Number" + } + } + ], + "return": { + "description": "duration (in seconds).", + "type": "Number" + }, + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "onended", + "file": "src/dom/dom.js", + "line": 4496, + "itemtype": "method", + "chainable": 1, + "description": "

    Calls a function when the audio/video reaches the end of its playback\nThe function won't be called if the media is looping.

    \n

    The p5.MediaElement is passed as an argument to the callback function.

    \n", + "example": [ + "
    \n\nlet beat;\nlet isPlaying = false;\nlet isDone = false;\n\nfunction setup() {\n\n // Create a p5.MediaElement using createAudio().\n beat = createAudio('assets/beat.mp3');\n\n // Set isDone to false when\n // the beat finishes.\n beat.onended(() => {\n isDone = true;\n });\n\n describe('The text \"Click to play\" written in black on a gray square. A beat plays when the user clicks. The text \"Done!\" appears when the beat finishes playing.');\n}\n\nfunction draw() {\n background(200);\n\n // Display different messages\n // based on playback.\n textAlign(CENTER);\n if (isDone === true) {\n text('Done!', 50, 50);\n } else if (isPlaying === false) {\n text('Click to play', 50, 50);\n } else {\n text('Playing...', 50, 50);\n }\n}\n\n// Play the beat when the\n// user presses the mouse.\nfunction mousePressed() {\n if (isPlaying === false) {\n isPlaying = true;\n beat.play();\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "callback", + "description": "function to call when playback ends.\nThe p5.MediaElement is passed as\nthe argument.", + "type": "Function" + } + ] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "connect", + "file": "src/dom/dom.js", + "line": 4514, + "itemtype": "method", + "description": "

    Send the audio output of this element to a specified audioNode or\np5.sound object. If no element is provided, connects to p5's main\noutput. That connection is established when this method is first called.\nAll connections are removed by the .disconnect() method.

    \n

    This method is meant to be used with the p5.sound.js addon library.

    \n", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "audioNode", + "description": "AudioNode from the Web Audio API,\nor an object from the p5.sound library", + "type": "AudioNode|Object" + } + ] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "disconnect", + "file": "src/dom/dom.js", + "line": 4556, + "itemtype": "method", + "description": "Disconnect all Web Audio routing, including to main output.\nThis is useful if you want to re-route the output through\naudio effects, for example.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "showControls", + "file": "src/dom/dom.js", + "line": 4591, + "itemtype": "method", + "description": "Show the default\nHTMLMediaElement\ncontrols. These vary between web browser.", + "example": [ + "
    \n\nfunction setup() {\n background('cornflowerblue');\n\n textAlign(CENTER);\n textSize(50);\n text('šŸ‰', 50, 50);\n\n // Create a p5.MediaElement using createAudio().\n let dragon = createAudio('assets/lucky_dragons.mp3');\n // Show the default media controls.\n dragon.showControls();\n\n describe('A dragon emoji, šŸ‰, drawn in the center of a blue square. A song plays in the background. Audio controls are displayed beneath the canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "hideControls", + "file": "src/dom/dom.js", + "line": 4643, + "itemtype": "method", + "description": "Hide the default\nHTMLMediaElement\ncontrols.", + "example": [ + "
    \n\nlet dragon;\nlet isHidden = false;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n dragon = createAudio('assets/lucky_dragons.mp3');\n // Show the default media controls.\n dragon.showControls();\n\n describe('The text \"Double-click to hide controls\" written in the middle of a gray square. A song plays in the background. Audio controls are displayed beneath the canvas. The controls appear/disappear when the user double-clicks the square.');\n}\n\nfunction draw() {\n background(200);\n\n // Display a different message when\n // controls are hidden or shown.\n textAlign(CENTER);\n if (isHidden === true) {\n text('Double-click to show controls', 10, 20, 80, 80);\n } else {\n text('Double-click to hide controls', 10, 20, 80, 80);\n }\n}\n\n// Show/hide controls based on a double-click.\nfunction doubleClicked() {\n if (isHidden === true) {\n dragon.showControls();\n isHidden = false;\n } else {\n dragon.hideControls();\n isHidden = true;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "addCue", + "file": "src/dom/dom.js", + "line": 4693, + "itemtype": "method", + "description": "

    Schedules a function to call when the audio/video reaches a specific time\nduring its playback.

    \n

    The first parameter, time, is the time, in seconds, when the function\nshould run. This value is passed to callback as its first argument.

    \n

    The second parameter, callback, is the function to call at the specified\ncue time.

    \n

    The third parameter, value, is optional and can be any type of value.\nvalue is passed to callback.

    \n

    Calling media.addCue() returns an ID as a string. This is useful for\nremoving the cue later.

    \n", + "example": [ + "
    \n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n let beat = createAudio('assets/beat.mp3');\n // Play the beat in a loop.\n beat.loop();\n\n // Schedule a few events.\n beat.addCue(0, changeBackground, 'red');\n beat.addCue(2, changeBackground, 'deeppink');\n beat.addCue(4, changeBackground, 'orchid');\n beat.addCue(6, changeBackground, 'lavender');\n\n describe('A red square with a beat playing in the background. Its color changes every 2 seconds while the audio plays.');\n}\n\nfunction changeBackground(c) {\n background(c);\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "time", + "description": "cue time to run the callback function.", + "type": "Number" + }, + { + "name": "callback", + "description": "function to call at the cue time.", + "type": "Function" + }, + { + "name": "value", + "description": "object to pass as the argument to\ncallback.", + "optional": 1, + "type": "Object" + } + ], + "return": { + "description": "id ID of this cue,\nuseful for media.removeCue(id).", + "type": "Number" + } + } + ], + "return": { + "description": "id ID of this cue,\nuseful for media.removeCue(id).", + "type": "Number" + }, + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "removeCue", + "file": "src/dom/dom.js", + "line": 4756, + "itemtype": "method", + "description": "Remove a callback based on its ID.", + "example": [ + "
    \n\nlet lavenderID;\nlet isRemoved = false;\n\nfunction setup() {\n // Create a p5.MediaElement using createAudio().\n let beat = createAudio('assets/beat.mp3');\n // Play the beat in a loop.\n beat.loop();\n\n // Schedule a few events.\n beat.addCue(0, changeBackground, 'red');\n beat.addCue(2, changeBackground, 'deeppink');\n beat.addCue(4, changeBackground, 'orchid');\n\n // Record the ID of the \"lavender\" callback.\n lavenderID = beat.addCue(6, changeBackground, 'lavender');\n\n describe('The text \"Double-click to remove lavender.\" written on a red square. The color changes every 2 seconds while the audio plays. The lavender option is removed when the user double-clicks the square.');\n}\n\nfunction draw() {\n if (isRemoved === false) {\n text('Double-click to remove lavender.', 10, 10, 80, 80);\n } else {\n text('No more lavender.', 10, 10, 80, 80);\n }\n}\n\nfunction changeBackground(c) {\n background(c);\n}\n\n// Remove the lavender color-change cue\n// when the user double-clicks.\nfunction doubleClicked() {\n if (isRemoved === false) {\n beat.removeCue(lavenderID);\n isRemoved = true;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "id", + "description": "ID of the cue, created by media.addCue().", + "type": "Number" + } + ] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "clearCues", + "file": "src/dom/dom.js", + "line": 4818, + "itemtype": "method", + "description": "Removes all functions scheduled with media.addCue().", + "example": [ + "
    \n\nlet isChanging = true;\n\nfunction setup() {\n background(200);\n\n // Create a p5.MediaElement using createAudio().\n let beat = createAudio('assets/beat.mp3');\n // Play the beat in a loop.\n beat.loop();\n\n // Schedule a few events.\n beat.addCue(0, changeBackground, 'red');\n beat.addCue(2, changeBackground, 'deeppink');\n beat.addCue(4, changeBackground, 'orchid');\n beat.addCue(6, changeBackground, 'lavender');\n\n describe('The text \"Double-click to stop changing.\" written on a square. The color changes every 2 seconds while the audio plays. The color stops changing when the user double-clicks the square.');\n}\n\nfunction draw() {\n if (isChanging === true) {\n text('Double-click to stop changing.', 10, 10, 80, 80);\n } else {\n text('No more changes.', 10, 10, 80, 80);\n }\n}\n\nfunction changeBackground(c) {\n background(c);\n}\n\n// Remove cued functions and stop\n// changing colors when the user\n// double-clicks.\nfunction doubleClicked() {\n if (isChanging === true) {\n beat.clearCues();\n isChanging = false;\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.MediaElement", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "pixelDensity", + "file": "src/image/p5.Image.js", + "line": 116, + "itemtype": "method", + "description": "

    Gets or sets the pixel density for high pixel density displays. By default,\nthe density will be set to 1.

    \n

    Call this method with no arguments to get the default density, or pass\nin a number to set the density. If a non-positive number is provided,\nit defaults to 1.

    \n", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "density", + "description": "A scaling factor for the number of pixels per\nside", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "The current density if called without arguments, or the instance for chaining if setting density.", + "type": "Number" + } + } + ], + "return": { + "description": "The current density if called without arguments, or the instance for chaining if setting density.", + "type": "Number" + }, + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "loadPixels", + "file": "src/image/p5.Image.js", + "line": 228, + "itemtype": "method", + "description": "Loads the current value of each pixel in the\np5.Image object into the img.pixels array.\nThis method must be called before reading or modifying pixel values.", + "example": [ + "
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let x = 0; x < img.width; x += 1) {\n for (let y = 0; y < img.height; y += 1) {\n img.set(x, y, 0);\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    \n\n
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nlet numPixels = 4 * img.width * img.height;\nfor (let i = 0; i < numPixels; i += 4) {\n // Red.\n img.pixels[i] = 0;\n // Green.\n img.pixels[i + 1] = 0;\n // Blue.\n img.pixels[i + 2] = 0;\n // Alpha.\n img.pixels[i + 3] = 255;\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "updatePixels", + "file": "src/image/p5.Image.js", + "line": 298, + "itemtype": "method", + "description": "

    Updates the canvas with the RGBA values in the\nimg.pixels array.

    \n

    img.updatePixels() only needs to be called after changing values in\nthe img.pixels array. Such changes can be\nmade directly after calling\nimg.loadPixels() or by calling\nimg.set().

    \n

    The optional parameters x, y, width, and height define a\nsubsection of the p5.Image object to update.\nDoing so can improve performance in some cases.

    \n

    If the p5.Image object was loaded from a GIF,\nthen calling img.updatePixels() will update the pixels in current\nframe.

    \n", + "example": [ + "
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let x = 0; x < img.width; x += 1) {\n for (let y = 0; y < img.height; y += 1) {\n img.set(x, y, 0);\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    \n\n
    \n\nlet img = createImage(66, 66);\nimg.loadPixels();\nlet numPixels = 4 * img.width * img.height;\nfor (let i = 0; i < numPixels; i += 4) {\n // Red.\n img.pixels[i] = 0;\n // Green.\n img.pixels[i + 1] = 0;\n // Blue.\n img.pixels[i + 2] = 0;\n // Alpha.\n img.pixels[i + 3] = 255;\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A black square drawn in the middle of a gray square.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the upper-left corner\nof the subsection to update.", + "type": "Integer" + }, + { + "name": "y", + "description": "y-coordinate of the upper-left corner\nof the subsection to update.", + "type": "Integer" + }, + { + "name": "w", + "description": "width of the subsection to update.", + "type": "Integer" + }, + { + "name": "h", + "description": "height of the subsection to update.", + "type": "Integer" + } + ] + }, + { + "params": [] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "get", + "file": "src/image/p5.Image.js", + "line": 396, + "itemtype": "method", + "description": "

    Gets a pixel or a region of pixels from a\np5.Image object.

    \n

    img.get() is easy to use but it's not as fast as\nimg.pixels. Use\nimg.pixels to read many pixel values.

    \n

    The version of img.get() with no parameters returns the entire image.

    \n

    The version of img.get() with two parameters interprets them as\ncoordinates. It returns an array with the [R, G, B, A] values of the\npixel at the given point.

    \n

    The version of img.get() with four parameters interprets them as\ncoordinates and dimensions. It returns a subsection of the canvas as a\np5.Image object. The first two parameters are\nthe coordinates for the upper-left corner of the subsection. The last two\nparameters are the width and height of the subsection.

    \n

    Use img.get() to work directly with\np5.Image objects.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let img2 = get();\n image(img2, width / 2, 0);\n\n describe('Two identical mountain landscapes shown side-by-side.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let c = img.get(50, 90);\n fill(c);\n noStroke();\n square(25, 25, 50);\n\n describe('A mountain landscape with an olive green square in its center.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n let img2 = img.get(0, 0, img.width / 2, img.height / 2);\n image(img2, width / 2, height / 2);\n\n describe('A mountain landscape drawn on top of another mountain landscape.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "w", + "description": "width of the subsection to be returned.", + "type": "Number" + }, + { + "name": "h", + "description": "height of the subsection to be returned.", + "type": "Number" + } + ], + "return": { + "description": "subsection as a p5.Image object.", + "type": "p5.Image" + } + }, + { + "params": [], + "return": { + "description": "whole p5.Image", + "type": "p5.Image" + } + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + } + ], + "return": { + "description": "color of the pixel at (x, y) in array format [R, G, B, A].", + "type": "Number[]" + } + } + ], + "return": { + "description": "subsection as a p5.Image object.", + "type": "p5.Image" + }, + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "set", + "file": "src/image/p5.Image.js", + "line": 490, + "itemtype": "method", + "description": "

    Sets the color of one or more pixels within a\np5.Image object.

    \n

    img.set() is easy to use but it's not as fast as\nimg.pixels. Use\nimg.pixels to set many pixel values.

    \n

    img.set() interprets the first two parameters as x- and y-coordinates. It\ninterprets the last parameter as a grayscale value, a [R, G, B, A] pixel\narray, a p5.Color object, or another\np5.Image object.

    \n

    img.updatePixels() must be called\nafter using img.set() for changes to appear.

    \n", + "example": [ + "
    \n\nlet img = createImage(100, 100);\nimg.set(30, 20, 0);\nimg.set(85, 20, 0);\nimg.set(85, 75, 0);\nimg.set(30, 75, 0);\nimg.updatePixels();\nimage(img, 0, 0);\n\ndescribe('Four black dots arranged in a square drawn on a gray background.');\n\n
    \n\n
    \n\nlet img = createImage(100, 100);\nlet black = color(0);\nimg.set(30, 20, black);\nimg.set(85, 20, black);\nimg.set(85, 75, black);\nimg.set(30, 75, black);\nimg.updatePixels();\nimage(img, 0, 0);\n\ndescribe('Four black dots arranged in a square drawn on a gray background.');\n\n
    \n\n
    \n\nlet img = createImage(66, 66);\nfor (let x = 0; x < img.width; x += 1) {\n for (let y = 0; y < img.height; y += 1) {\n let c = map(x, 0, img.width, 0, 255);\n img.set(x, y, c);\n }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n\ndescribe('A square with a horiztonal color gradient from black to white drawn on a gray background.');\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n let img2 = createImage(100, 100);\n img2.set(0, 0, img);\n image(img2, 0, 0);\n\n describe('An image of a mountain landscape.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the pixel.", + "type": "Number" + }, + { + "name": "a", + "description": "grayscale value | pixel array |\np5.Color object |\np5.Image to copy.", + "type": "Number|Number[]|Object" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "resize", + "file": "src/image/p5.Image.js", + "line": 559, + "itemtype": "method", + "description": "Resizes the p5.Image object to a given width\nand height. The image's original aspect ratio can be kept by passing 0\nfor either width or height. For example, calling img.resize(50, 0)\non an image that was 500 Ɨ 300 pixels will resize it to\n50 Ɨ 30 pixels.", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n img.resize(50, 100);\n image(img, 0, 0);\n\n describe('Two images of a mountain landscape. One copy of the image is squeezed horizontally.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n img.resize(0, 30);\n image(img, 0, 0);\n\n describe('Two images of a mountain landscape. The small copy of the image covers the top-left corner of the larger image.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n image(img, 0, 0);\n img.resize(60, 0);\n image(img, 0, 0);\n\n describe('Two images of a mountain landscape. The small copy of the image covers the top-left corner of the larger image.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "width", + "description": "resized image width.", + "type": "Number" + }, + { + "name": "height", + "description": "resized image height.", + "type": "Number" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "copy", + "file": "src/image/p5.Image.js", + "line": 707, + "itemtype": "method", + "description": "Copies pixels from a source p5.Image\nto this one. Calling img.copy() will scale pixels from the source\nregion if it isn't the same size as the destination region.", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n img.copy(7, 22, 10, 10, 35, 25, 50, 50);\n image(img, 0, 0);\n // Outline copied region.\n stroke(255);\n noFill();\n square(7, 22, 10);\n\n describe('An image of a mountain landscape. A square region is outlined in white. A larger square contains a pixelated view of the outlined region.');\n}\n\n
    \n\n
    \n\nlet mountains;\nlet bricks;\n\nfunction preload() {\n mountains = loadImage('assets/rockies.jpg');\n bricks = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n let x = bricks.width / 2;\n let y = bricks.height / 2;\n mountains.copy(bricks, 0, 0, x, y, 0, 0, x, y);\n image(mountains, 0, 0);\n\n describe('An image of a brick wall drawn at the top-left of an image of a mountain landscape.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "source image.", + "type": "p5.Image|p5.Element" + }, + { + "name": "sx", + "description": "x-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sy", + "description": "y-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sw", + "description": "source image width.", + "type": "Integer" + }, + { + "name": "sh", + "description": "source image height.", + "type": "Integer" + }, + { + "name": "dx", + "description": "x-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dy", + "description": "y-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dw", + "description": "destination image width.", + "type": "Integer" + }, + { + "name": "dh", + "description": "destination image height.", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "sx", + "type": "Integer" + }, + { + "name": "sy", + "type": "Integer" + }, + { + "name": "sw", + "type": "Integer" + }, + { + "name": "sh", + "type": "Integer" + }, + { + "name": "dx", + "type": "Integer" + }, + { + "name": "dy", + "type": "Integer" + }, + { + "name": "dw", + "type": "Integer" + }, + { + "name": "dh", + "type": "Integer" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "mask", + "file": "src/image/p5.Image.js", + "line": 740, + "itemtype": "method", + "description": "Masks part of an image from displaying by loading another\nimage and using its alpha channel as an alpha channel for\nthis image. Masks are cumulative, once applied to an image\nobject, they cannot be removed.", + "example": [ + "
    \n\nlet photo;\nlet maskImage;\n\nfunction preload() {\n photo = loadImage('assets/rockies.jpg');\n maskImage = loadImage('assets/mask2.png');\n}\n\nfunction setup() {\n photo.mask(maskImage);\n image(photo, 0, 0);\n\n describe('An image of a mountain landscape. The right side of the image has a faded patch of white.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "source image.", + "type": "p5.Image" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "filter", + "file": "src/image/p5.Image.js", + "line": 966, + "itemtype": "method", + "description": "

    Applies an image filter to the p5.Image object.\nThe preset options are:

    \n

    INVERT\nInverts the colors in the image. No parameter is used.

    \n

    GRAY\nConverts the image to grayscale. No parameter is used.

    \n

    THRESHOLD\nConverts the image to black and white. Pixels with a grayscale value\nabove a given threshold are converted to white. The rest are converted to\nblack. The threshold must be between 0.0 (black) and 1.0 (white). If no\nvalue is specified, 0.5 is used.

    \n

    OPAQUE\nSets the alpha channel to be entirely opaque. No parameter is used.

    \n

    POSTERIZE\nLimits the number of colors in the image. Each color channel is limited to\nthe number of colors specified. Values between 2 and 255 are valid, but\nresults are most noticeable with lower values. The default value is 4.

    \n

    BLUR\nBlurs the image. The level of blurring is specified by a blur radius. Larger\nvalues increase the blur. The default value is 4. A gaussian blur is used\nin P2D mode. A box blur is used in WEBGL mode.

    \n

    ERODE\nReduces the light areas. No parameter is used.

    \n

    DILATE\nIncreases the light areas. No parameter is used.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(INVERT);\n image(img, 0, 0);\n\n describe('A blue brick wall.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(GRAY);\n image(img, 0, 0);\n\n describe('A brick wall drawn in grayscale.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(THRESHOLD);\n image(img, 0, 0);\n\n describe('A brick wall drawn in black and white.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(OPAQUE);\n image(img, 0, 0);\n\n describe('A red brick wall.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(POSTERIZE, 3);\n image(img, 0, 0);\n\n describe('An image of a red brick wall drawn with a limited color palette.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(BLUR, 3);\n image(img, 0, 0);\n\n describe('A blurry image of a red brick wall.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(DILATE);\n image(img, 0, 0);\n\n describe('A red brick wall with bright lines between each brick.');\n}\n\n
    \n\n
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n img.filter(ERODE);\n image(img, 0, 0);\n\n describe('A red brick wall with faint lines between each brick.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filterType", + "description": "either THRESHOLD, GRAY, OPAQUE, INVERT,\nPOSTERIZE, ERODE, DILATE or BLUR.", + "type": "Constant" + }, + { + "name": "filterParam", + "description": "parameter unique to each filter.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "blend", + "file": "src/image/p5.Image.js", + "line": 1068, + "itemtype": "method", + "description": "Copies a region of pixels from another\np5.Image object into this one. The blendMode\nparameter blends the images' colors to create different effects.", + "example": [ + "
    \n\nlet mountains;\nlet bricks;\n\nfunction preload() {\n mountains = loadImage('assets/rockies.jpg');\n bricks = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n mountains.blend(bricks, 0, 0, 33, 100, 67, 0, 33, 100, ADD);\n image(mountains, 0, 0);\n image(bricks, 0, 0);\n\n describe('A wall of bricks in front of a mountain landscape. The same wall of bricks appears faded on the right of the image.');\n}\n\n
    \n\n
    \n\nlet mountains;\nlet bricks;\n\nfunction preload() {\n mountains = loadImage('assets/rockies.jpg');\n bricks = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n mountains.blend(bricks, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);\n image(mountains, 0, 0);\n image(bricks, 0, 0);\n\n describe('A wall of bricks in front of a mountain landscape. The same wall of bricks appears transparent on the right of the image.');\n}\n\n
    \n\n
    \n\nlet mountains;\nlet bricks;\n\nfunction preload() {\n mountains = loadImage('assets/rockies.jpg');\n bricks = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n mountains.blend(bricks, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);\n image(mountains, 0, 0);\n image(bricks, 0, 0);\n\n describe('A wall of bricks in front of a mountain landscape. The same wall of bricks appears washed out on the right of the image.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "source image", + "type": "p5.Image" + }, + { + "name": "sx", + "description": "x-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sy", + "description": "y-coordinate of the source's upper-left corner.", + "type": "Integer" + }, + { + "name": "sw", + "description": "source image width.", + "type": "Integer" + }, + { + "name": "sh", + "description": "source image height.", + "type": "Integer" + }, + { + "name": "dx", + "description": "x-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dy", + "description": "y-coordinate of the destination's upper-left corner.", + "type": "Integer" + }, + { + "name": "dw", + "description": "destination image width.", + "type": "Integer" + }, + { + "name": "dh", + "description": "destination image height.", + "type": "Integer" + }, + { + "name": "blendMode", + "description": "

    the blend mode. either\nBLEND, DARKEST, LIGHTEST, DIFFERENCE,\nMULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\nSOFT_LIGHT, DODGE, BURN, ADD or NORMAL.

    \n

    Available blend modes are: normal | multiply | screen | overlay |\ndarken | lighten | color-dodge | color-burn | hard-light |\nsoft-light | difference | exclusion | hue | saturation |\ncolor | luminosity

    \n

    http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/

    \n", + "type": "Constant" + } + ] + }, + { + "params": [ + { + "name": "sx", + "type": "Integer" + }, + { + "name": "sy", + "type": "Integer" + }, + { + "name": "sw", + "type": "Integer" + }, + { + "name": "sh", + "type": "Integer" + }, + { + "name": "dx", + "type": "Integer" + }, + { + "name": "dy", + "type": "Integer" + }, + { + "name": "dw", + "type": "Integer" + }, + { + "name": "dh", + "type": "Integer" + }, + { + "name": "blendMode", + "type": "Constant" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "save", + "file": "src/image/p5.Image.js", + "line": 1145, + "itemtype": "method", + "description": "

    Saves the p5.Image object to a file.\nThe browser will either save the file immediately or prompt the user\nwith a dialogue window.

    \n

    By default, calling img.save() will save the image as untitled.png.

    \n

    Calling img.save() with one argument, as in img.save('photo.png'),\nwill set the image's filename and type together.

    \n

    Calling img.save() with two arguments, as in\nimage.save('photo', 'png'), will set the image's filename and type\nseparately.

    \n

    The image will only be downloaded as an animated GIF if the\np5.Image object was loaded from a GIF file.\nSee saveGif() to create new GIFs.

    \n", + "example": [ + "
    \n\nlet img;\n\nfunction preload() {\n img = loadImage('assets/rockies.jpg');\n}\n\nfunction draw() {\n image(img, 0, 0);\n\n describe('An image of a mountain landscape.');\n}\n\nfunction keyPressed() {\n if (key === 's') {\n img.save();\n } else if (key === 'j') {\n img.save('rockies.jpg');\n } else if (key === 'p') {\n img.save('rockies', 'png');\n }\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "filename", + "description": "filename. Defaults to 'untitled'.", + "type": "String" + }, + { + "name": "extension", + "description": "file extension, either 'png' or 'jpg'.\nDefaults to 'png'.", + "optional": 1, + "type": "String" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "reset", + "file": "src/image/p5.Image.js", + "line": 1179, + "itemtype": "method", + "description": "Restarts an animated GIF at its first frame.", + "example": [ + "
    \n\nlet gif;\n\nfunction preload() {\n gif = loadImage('assets/arnott-wallace-wink-loop-once.gif');\n}\n\nfunction draw() {\n background(255);\n image(gif, 0, 0);\n\n describe('A cartoon face winks once and then freezes. Clicking resets the face and makes it wink again.');\n}\n\nfunction mousePressed() {\n gif.reset();\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "getCurrentFrame", + "file": "src/image/p5.Image.js", + "line": 1215, + "itemtype": "method", + "description": "Gets the index of the current frame in an animated GIF.", + "example": [ + "
    \n\nlet gif;\n\nfunction preload() {\n gif = loadImage('assets/arnott-wallace-eye-loop-forever.gif');\n}\n\nfunction draw() {\n let index = gif.getCurrentFrame();\n image(gif, 0, 0);\n text(index, 10, 90);\n\n describe('A cartoon eye repeatedly looks around, then outwards. A number displayed in the bottom-left corner increases from 0 to 124, then repeats.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "index of the GIF's current frame.", + "type": "Number" + } + } + ], + "return": { + "description": "index of the GIF's current frame.", + "type": "Number" + }, + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "setFrame", + "file": "src/image/p5.Image.js", + "line": 1253, + "itemtype": "method", + "description": "Sets the current frame in an animated GIF.", + "example": [ + "
    \n\nlet gif;\nlet frameSlider;\n\nfunction preload() {\n gif = loadImage('assets/arnott-wallace-eye-loop-forever.gif');\n}\n\nfunction setup() {\n let maxFrame = gif.numFrames() - 1;\n frameSlider = createSlider(0, maxFrame);\n frameSlider.position(10, 80);\n frameSlider.size(80);\n}\n\nfunction draw() {\n let index = frameSlider.value();\n gif.setFrame(index);\n image(gif, 0, 0);\n\n describe('A cartoon eye looks around when a slider is moved.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "index", + "description": "index of the frame to display.", + "type": "Number" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "numFrames", + "file": "src/image/p5.Image.js", + "line": 1294, + "itemtype": "method", + "description": "Returns the number of frames in an animated GIF.", + "example": [ + "
    \n\nlet gif;\n\nfunction preload() {\n gif = loadImage('assets/arnott-wallace-eye-loop-forever.gif');\n}\n\nfunction draw() {\n image(gif, 0, 0);\n let total = gif.numFrames();\n let index = gif.getCurrentFrame();\n text(`${index} / ${total}`, 30, 90);\n\n describe('A cartoon eye looks around. The text \"n / 125\" is shown at the bottom of the canvas.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "number of frames in the GIF.", + "type": "Number" + } + } + ], + "return": { + "description": "number of frames in the GIF.", + "type": "Number" + }, + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "play", + "file": "src/image/p5.Image.js", + "line": 1330, + "itemtype": "method", + "description": "Plays an animated GIF that was paused with\nimg.pause().", + "example": [ + "
    \n\nlet gif;\n\nfunction preload() {\n gif = loadImage('assets/nancy-liang-wind-loop-forever.gif');\n}\n\nfunction draw() {\n background(255);\n image(gif, 0, 0);\n\n describe('A drawing of a child with hair blowing in the wind. The animation freezes when clicked and resumes when released.');\n}\n\nfunction mousePressed() {\n gif.pause();\n}\n\nfunction mouseReleased() {\n gif.play();\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "pause", + "file": "src/image/p5.Image.js", + "line": 1366, + "itemtype": "method", + "description": "Pauses an animated GIF. The GIF can be resumed by calling\nimg.play().", + "example": [ + "
    \n\nlet gif;\n\nfunction preload() {\n gif = loadImage('assets/nancy-liang-wind-loop-forever.gif');\n}\n\nfunction draw() {\n background(255);\n image(gif, 0, 0);\n\n describe('A drawing of a child with hair blowing in the wind. The animation freezes when clicked and resumes when released.');\n}\n\nfunction mousePressed() {\n gif.pause();\n}\n\nfunction mouseReleased() {\n gif.play();\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "delay", + "file": "src/image/p5.Image.js", + "line": 1429, + "itemtype": "method", + "description": "

    Changes the delay between frames in an animated GIF.

    \n

    The second parameter, index, is optional. If provided, only the frame\nat index will have its delay modified. All other frames will keep\ntheir default delay.

    \n", + "example": [ + "
    \n\nlet gifFast;\nlet gifSlow;\n\nfunction preload() {\n gifFast = loadImage('assets/arnott-wallace-eye-loop-forever.gif');\n gifSlow = loadImage('assets/arnott-wallace-eye-loop-forever.gif');\n}\n\nfunction setup() {\n gifFast.resize(50, 50);\n gifSlow.resize(50, 50);\n gifFast.delay(10);\n gifSlow.delay(100);\n}\n\nfunction draw() {\n image(gifFast, 0, 0);\n image(gifSlow, 50, 0);\n\n describe('Two animated eyes looking around. The eye on the left moves faster than the eye on the right.');\n}\n\n
    \n\n
    \n\nlet gif;\n\nfunction preload() {\n gif = loadImage('assets/arnott-wallace-eye-loop-forever.gif');\n}\n\nfunction setup() {\n gif.delay(3000, 67);\n}\n\nfunction draw() {\n image(gif, 0, 0);\n\n describe('An animated eye looking around. It pauses for three seconds while it looks down.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "d", + "description": "delay in milliseconds between switching frames.", + "type": "Number" + }, + { + "name": "index", + "description": "index of the frame that will have its delay modified.", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5.Image", + "static": false, + "module": "Image", + "submodule": "Image" + }, + { + "name": "getParent", + "file": "src/io/p5.XML.js", + "line": 94, + "itemtype": "method", + "description": "Gets a copy of the element's parent. Returns the parent as another\np5.XML object.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let children = xml.getChildren('animal');\n let parent = children[1].getParent();\n print(parent.getName());\n}\n\n// Sketch prints:\n// mammals\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "element parent", + "type": "p5.XML" + } + } + ], + "return": { + "description": "element parent", + "type": "p5.XML" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "getName", + "file": "src/io/p5.XML.js", + "line": 128, + "itemtype": "method", + "description": "Gets the element's full name, which is returned as a String.", + "example": [ + "<animal\n
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n print(xml.getName());\n}\n\n// Sketch prints:\n// mammals\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "the name of the node", + "type": "String" + } + } + ], + "return": { + "description": "the name of the node", + "type": "String" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "setName", + "file": "src/io/p5.XML.js", + "line": 165, + "itemtype": "method", + "description": "Sets the element's name, which is specified as a String.", + "example": [ + "<animal\n
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n print(xml.getName());\n xml.setName('fish');\n print(xml.getName());\n}\n\n// Sketch prints:\n// mammals\n// fish\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "the", + "description": "new name of the node", + "type": "String" + } + ] + } + ], + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "hasChildren", + "file": "src/io/p5.XML.js", + "line": 208, + "itemtype": "method", + "description": "Checks whether or not the element has any children, and returns the result\nas a boolean.", + "example": [ + "<animal\n
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n print(xml.hasChildren());\n}\n\n// Sketch prints:\n// true\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "boolean" + } + } + ], + "return": { + "description": "", + "type": "boolean" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "listChildren", + "file": "src/io/p5.XML.js", + "line": 244, + "itemtype": "method", + "description": "Get the names of all of the element's children, and returns the names as an\narray of Strings. This is the same as looping through and calling getName()\non each child element individually.", + "example": [ + "<animal\n
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n print(xml.listChildren());\n}\n\n// Sketch prints:\n// [\"animal\", \"animal\", \"animal\"]\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "names of the children of the element", + "type": "String[]" + } + } + ], + "return": { + "description": "names of the children of the element", + "type": "String[]" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "getChildren", + "file": "src/io/p5.XML.js", + "line": 291, + "itemtype": "method", + "description": "Returns all of the element's children as an array of p5.XML objects. When\nthe name parameter is specified, then it will return all children that match\nthat name.", + "example": [ + "<animal\n
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let animals = xml.getChildren('animal');\n\n for (let i = 0; i < animals.length; i++) {\n print(animals[i].getContent());\n }\n}\n\n// Sketch prints:\n// \"Goat\"\n// \"Leopard\"\n// \"Zebra\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "element name", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "children of the element", + "type": "p5.XML[]" + } + } + ], + "return": { + "description": "children of the element", + "type": "p5.XML[]" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "getChild", + "file": "src/io/p5.XML.js", + "line": 350, + "itemtype": "method", + "description": "Returns the first of the element's children that matches the name parameter\nor the child of the given index.It returns undefined if no matching\nchild is found.", + "example": [ + "<animal\n
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.getContent());\n}\n\n// Sketch prints:\n// \"Goat\"\n
    \n
    \nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let secondChild = xml.getChild(1);\n print(secondChild.getContent());\n}\n\n// Sketch prints:\n// \"Leopard\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "element name or index", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "p5.XML" + } + } + ], + "return": { + "description": "", + "type": "p5.XML" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "addChild", + "file": "src/io/p5.XML.js", + "line": 403, + "itemtype": "method", + "description": "Appends a new child to the element. The child can be specified with\neither a String, which will be used as the new tag's name, or as a\nreference to an existing p5.XML object.\nA reference to the newly created child is returned as an p5.XML object.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let child = new p5.XML();\n child.setName('animal');\n child.setAttribute('id', '3');\n child.setAttribute('species', 'Ornithorhynchus anatinus');\n child.setContent('Platypus');\n xml.addChild(child);\n\n let animals = xml.getChildren('animal');\n print(animals[animals.length - 1].getContent());\n}\n\n// Sketch prints:\n// \"Goat\"\n// \"Leopard\"\n// \"Zebra\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "node", + "description": "a p5.XML Object which will be the child to be added", + "type": "p5.XML" + } + ] + } + ], + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "removeChild", + "file": "src/io/p5.XML.js", + "line": 465, + "itemtype": "method", + "description": "Removes the element specified by name or index.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n xml.removeChild('animal');\n let children = xml.getChildren();\n for (let i = 0; i < children.length; i++) {\n print(children[i].getContent());\n }\n}\n\n// Sketch prints:\n// \"Leopard\"\n// \"Zebra\"\n
    \n
    \nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n xml.removeChild(1);\n let children = xml.getChildren();\n for (let i = 0; i < children.length; i++) {\n print(children[i].getContent());\n }\n}\n\n// Sketch prints:\n// \"Goat\"\n// \"Zebra\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "element name or index", + "type": "String|Integer" + } + ] + } + ], + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "getAttributeCount", + "file": "src/io/p5.XML.js", + "line": 513, + "itemtype": "method", + "description": "Counts the specified element's number of attributes, returned as an Number.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.getAttributeCount());\n}\n\n// Sketch prints:\n// 2\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "Integer" + } + } + ], + "return": { + "description": "", + "type": "Integer" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "listAttributes", + "file": "src/io/p5.XML.js", + "line": 549, + "itemtype": "method", + "description": "Gets all of the specified element's attributes, and returns them as an\narray of Strings.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.listAttributes());\n}\n\n// Sketch prints:\n// [\"id\", \"species\"]\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "an array of strings containing the names of attributes", + "type": "String[]" + } + } + ], + "return": { + "description": "an array of strings containing the names of attributes", + "type": "String[]" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "hasAttribute", + "file": "src/io/p5.XML.js", + "line": 593, + "itemtype": "method", + "description": "Checks whether or not an element has the specified attribute.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.hasAttribute('species'));\n print(firstChild.hasAttribute('color'));\n}\n\n// Sketch prints:\n// true\n// false\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "the", + "description": "attribute to be checked", + "type": "String" + } + ], + "return": { + "description": "true if attribute found else false", + "type": "boolean" + } + } + ], + "return": { + "description": "true if attribute found else false", + "type": "boolean" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "getNum", + "file": "src/io/p5.XML.js", + "line": 639, + "itemtype": "method", + "description": "Returns an attribute value of the element as an Number. If the defaultValue\nparameter is specified and the attribute doesn't exist, then defaultValue\nis returned. If no defaultValue is specified and the attribute doesn't\nexist, the value 0 is returned.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.getNum('id'));\n}\n\n// Sketch prints:\n// 0\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "the non-null full name of the attribute", + "type": "String" + }, + { + "name": "defaultValue", + "description": "the default value of the attribute", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "getString", + "file": "src/io/p5.XML.js", + "line": 685, + "itemtype": "method", + "description": "Returns an attribute value of the element as an String. If the defaultValue\nparameter is specified and the attribute doesn't exist, then defaultValue\nis returned. If no defaultValue is specified and the attribute doesn't\nexist, null is returned.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.getString('species'));\n}\n\n// Sketch prints:\n// \"Capra hircus\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "the non-null full name of the attribute", + "type": "String" + }, + { + "name": "defaultValue", + "description": "the default value of the attribute", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "", + "type": "String" + } + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "setAttribute", + "file": "src/io/p5.XML.js", + "line": 731, + "itemtype": "method", + "description": "Sets the content of an element's attribute. The first parameter specifies\nthe attribute name, while the second specifies the new content.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.getString('species'));\n firstChild.setAttribute('species', 'Jamides zebra');\n print(firstChild.getString('species'));\n}\n\n// Sketch prints:\n// \"Capra hircus\"\n// \"Jamides zebra\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "name", + "description": "the full name of the attribute", + "type": "String" + }, + { + "name": "value", + "description": "the value of the attribute", + "type": "Number|String|Boolean" + } + ] + } + ], + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "getContent", + "file": "src/io/p5.XML.js", + "line": 768, + "itemtype": "method", + "description": "Returns the content of an element. If there is no such content,\ndefaultValue is returned if specified, otherwise null is returned.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.getContent());\n}\n\n// Sketch prints:\n// \"Goat\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "defaultValue", + "description": "value returned if no content is found", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "String" + } + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "setContent", + "file": "src/io/p5.XML.js", + "line": 809, + "itemtype": "method", + "description": "Sets the element's content.", + "example": [ + "
    \n// The following short XML file called \"mammals.xml\" is parsed\n// in the code below.\n//\n// \n// <mammals>\n// <animal id=\"0\" species=\"Capra hircus\">Goat</animal>\n// <animal id=\"1\" species=\"Panthera pardus\">Leopard</animal>\n// <animal id=\"2\" species=\"Equus zebra\">Zebra</animal>\n// </mammals>\n\nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n let firstChild = xml.getChild('animal');\n print(firstChild.getContent());\n firstChild.setContent('Mountain Goat');\n print(firstChild.getContent());\n}\n\n// Sketch prints:\n// \"Goat\"\n// \"Mountain Goat\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "text", + "description": "the new content", + "type": "String" + } + ] + } + ], + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "serialize", + "file": "src/io/p5.XML.js", + "line": 840, + "itemtype": "method", + "description": "Serializes the element into a string. This function is useful for preparing\nthe content to be sent over a http request or saved to file.", + "example": [ + "
    \nlet xml;\n\nfunction preload() {\n xml = loadXML('assets/mammals.xml');\n}\n\nfunction setup() {\n print(xml.serialize());\n}\n\n// Sketch prints:\n// \n// Goat\n// Leopard\n// Zebra\n// \n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "Serialized string of the element", + "type": "String" + } + } + ], + "return": { + "description": "Serialized string of the element", + "type": "String" + }, + "class": "p5.XML", + "static": false, + "module": "IO", + "submodule": "Input" + }, + { + "name": "toString", + "file": "src/math/p5.Vector.js", + "line": 132, + "itemtype": "method", + "description": "Returns a string representation of a vector. This method is useful for\nprinting vectors to the console while debugging.", + "example": [ + "
    \n\nfunction setup() {\n let v = createVector(20, 30);\n // Prints 'p5.Vector Object : [20, 30, 0]'.\n print(v.toString());\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "string representation of the vector.", + "type": "String" + } + } + ], + "return": { + "description": "string representation of the vector.", + "type": "String" + }, + "class": "p5.Vector", + "static": false, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "set", + "file": "src/math/p5.Vector.js", + "line": 176, + "itemtype": "method", + "chainable": 1, + "description": "Sets the x, y, and z components of the vector using separate numbers,\na p5.Vector object, or an array of numbers.\nCalling set() with no arguments sets the vector's components to 0.", + "example": [ + "
    \n\nstrokeWeight(5);\n\n// Top left.\nlet pos = createVector(25, 25);\npoint(pos);\n\n// Top right.\npos.set(75, 25);\npoint(pos);\n\n// Bottom right.\nlet p2 = createVector(75, 75);\npos.set(p2);\npoint(pos);\n\n// Bottom left.\nlet arr = [25, 75];\npos.set(arr);\npoint(pos);\n\ndescribe('Four black dots arranged in a square on a gray background.');\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "y component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z component of the vector.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "vector to set.", + "type": "p5.Vector|Number[]" + } + ] + } + ], + "class": "p5.Vector", + "static": false, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "copy", + "file": "src/math/p5.Vector.js", + "line": 2491, + "itemtype": "method", + "description": "Returns a copy of the p5.Vector object.", + "example": [ + "
    \n\nlet pos = createVector(50, 50);\nlet pc = pos.copy();\n\nstrokeWeight(5);\npoint(pc);\n\ndescribe('A black point drawn in the middle of a gray square.');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "copy of the p5.Vector object.", + "type": "p5.Vector" + } + }, + { + "params": [ + { + "name": "v", + "description": "the p5.Vector to create a copy of", + "type": "p5.Vector" + } + ], + "return": { + "description": "the copy of the p5.Vector object", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "copy of the p5.Vector object.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "add", + "file": "src/math/p5.Vector.js", + "line": 2504, + "itemtype": "method", + "chainable": 1, + "description": "

    Adds to a vector's x, y, and z components using separate numbers,\nanother p5.Vector object, or an array of numbers.\nCalling add() with no arguments has no effect.

    \n

    The static version of add(), as in p5.Vector.add(v2, v1), returns a new\np5.Vector object and doesn't change the\noriginals.

    \n", + "example": [ + "
    \n\nstrokeWeight(5);\n\n// Top left.\nlet pos = createVector(25, 25);\npoint(pos);\n\n// Top right.\npos.add(50, 0);\npoint(pos);\n\n// Bottom right.\nlet p2 = createVector(0, 50);\npos.add(p2);\npoint(pos);\n\n// Bottom left.\nlet arr = [-50, 0];\npos.add(arr);\npoint(pos);\n\ndescribe('Four black dots arranged in a square on a gray background.');\n\n
    \n\n
    \n\n// Top left.\nlet p1 = createVector(25, 25);\n\n// Center.\nlet p2 = createVector(50, 50);\n\n// Bottom right.\nlet p3 = p5.Vector.add(p1, p2);\n\nstrokeWeight(5);\npoint(p1);\npoint(p2);\npoint(p3);\n\ndescribe('Three black dots in a diagonal line from top left to bottom right.');\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let origin = createVector(0, 0);\n let v1 = createVector(50, 50);\n drawArrow(origin, v1, 'red');\n\n let v2 = createVector(-30, 20);\n drawArrow(v1, v2, 'blue');\n\n let v3 = p5.Vector.add(v1, v2);\n drawArrow(origin, v3, 'purple');\n\n describe('Three arrows drawn on a gray square. A red arrow extends from the top left corner to the center. A blue arrow extends from the tip of the red arrow. A purple arrow extends from the origin to the tip of the blue arrow.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component of the vector to be added.", + "type": "Number" + }, + { + "name": "y", + "description": "y component of the vector to be added.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z component of the vector to be added.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "The vector to add", + "type": "p5.Vector|Number[]" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "A p5.Vector to add", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "A p5.Vector to add", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "vector to receive the result.", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "resulting p5.Vector.", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "resulting p5.Vector.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "rem", + "file": "src/math/p5.Vector.js", + "line": 2532, + "itemtype": "method", + "chainable": 1, + "description": "

    Performs modulo (remainder) division with a vector's x, y, and z\ncomponents using separate numbers, another\np5.Vector object, or an array of numbers.

    \n

    The static version of rem() as in p5.Vector.rem(v2, v1), returns a new\np5.Vector object and doesn't change the\noriginals.

    \n", + "example": [ + "
    \n\nlet v = createVector(3, 4, 5);\nv.rem(2, 3, 4);\n// Prints 'p5.Vector Object : [1, 1, 1]'.\nprint(v.toString());\n\n
    \n\n
    \n\nlet v1 = createVector(3, 4, 5);\nlet v2 = createVector(2, 3, 4);\nv1.rem(v2);\n\n// Prints 'p5.Vector Object : [1, 1, 1]'.\nprint(v1.toString());\n\n
    \n\n
    \n\nlet v = createVector(3, 4, 5);\nlet arr = [2, 3, 4];\nv.rem(arr);\n\n// Prints 'p5.Vector Object : [1, 1, 1]'.\nprint(v.toString());\n\n
    \n\n
    \n\nlet v1 = createVector(3, 4, 5);\nlet v2 = createVector(2, 3, 4);\nlet v3 = p5.Vector.rem(v1, v2);\n\n// Prints 'p5.Vector Object : [1, 1, 1]'.\nprint(v3.toString());\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component of divisor vector.", + "type": "Number" + }, + { + "name": "y", + "description": "y component of divisor vector.", + "type": "Number" + }, + { + "name": "z", + "description": "z component of divisor vector.", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "divisor vector.", + "type": "p5.Vector|Number[]" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "The dividend p5.Vector", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "The divisor p5.Vector", + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v1", + "type": "p5.Vector" + }, + { + "name": "v2", + "type": "p5.Vector" + } + ], + "return": { + "description": "The resulting p5.Vector", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "The resulting p5.Vector", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "sub", + "file": "src/math/p5.Vector.js", + "line": 2552, + "itemtype": "method", + "chainable": 1, + "description": "

    Subtracts from a vector's x, y, and z components using separate\nnumbers, another p5.Vector object, or an array of\nnumbers. Calling sub() with no arguments has no effect.

    \n

    The static version of sub(), as in p5.Vector.sub(v2, v1), returns a new\np5.Vector object and doesn't change the\noriginals.

    \n", + "example": [ + "
    \n\nstrokeWeight(5);\n\n// Bottom right.\nlet pos = createVector(75, 75);\npoint(pos);\n\n// Top right.\npos.sub(0, 50);\npoint(pos);\n\n// Top left.\nlet p2 = createVector(50, 0);\npos.sub(p2);\npoint(pos);\n\n// Bottom left.\nlet arr = [0, -50];\npos.sub(arr);\npoint(pos);\n\ndescribe('Four black dots arranged in a square on a gray background.');\n\n
    \n\n
    \n\n// Bottom right.\nlet p1 = createVector(75, 75);\n\n// Center.\nlet p2 = createVector(50, 50);\n\n// Top left.\nlet p3 = p5.Vector.sub(p1, p2);\n\nstrokeWeight(5);\npoint(p1);\npoint(p2);\npoint(p3);\n\ndescribe('Three black dots in a diagonal line from top left to bottom right.');\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let origin = createVector(0, 0);\n let v1 = createVector(50, 50);\n drawArrow(origin, v1, 'red');\n\n let v2 = createVector(20, 70);\n drawArrow(origin, v2, 'blue');\n\n let v3 = p5.Vector.sub(v2, v1);\n drawArrow(v1, v3, 'purple');\n\n describe('Three arrows drawn on a gray square. A red and a blue arrow extend from the top left. A purple arrow extends from the tip of the red arrow to the tip of the blue arrow.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component of the vector to subtract.", + "type": "Number" + }, + { + "name": "y", + "description": "y component of the vector to subtract.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z component of the vector to subtract.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "the vector to subtract", + "type": "p5.Vector|Number[]" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "A p5.Vector to subtract from", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "A p5.Vector to subtract", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "vector to receive the result.", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "The resulting p5.Vector", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "The resulting p5.Vector", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "mult", + "file": "src/math/p5.Vector.js", + "line": 2600, + "itemtype": "method", + "chainable": 1, + "description": "

    Multiplies a vector's x, y, and z components by the same number,\nseparate numbers, the components of another\np5.Vector object, or an array of numbers. Calling\nmult() with no arguments has no effect.

    \n

    The static version of mult(), as in p5.Vector.mult(v, 2), returns a new\np5.Vector object and doesn't change the\noriginals.

    \n", + "example": [ + "
    \n\nstrokeWeight(5);\n\nlet p = createVector(25, 25);\npoint(p);\n\np.mult(2);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(25, 25);\npoint(p);\n\np.mult(2, 3);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(25, 25);\npoint(p);\n\nlet arr = [2, 3];\np.mult(arr);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(25, 25);\npoint(p);\n\nlet p2 = createVector(2, 3);\np.mult(p2);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(25, 25);\npoint(p);\n\nlet p2 = createVector(2, 3);\nlet p3 = p5.Vector.mult(p, p2);\npoint(p3);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let origin = createVector(0, 0);\n let v1 = createVector(25, 25);\n drawArrow(origin, v1, 'red');\n\n let v2 = p5.Vector.mult(v1, 2);\n drawArrow(origin, v2, 'blue');\n\n describe('Two arrows extending from the top left corner. The blue arrow is twice the length of the red arrow.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "The number to multiply with the vector", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x", + "description": "number to multiply with the x component of the vector.", + "type": "Number" + }, + { + "name": "y", + "description": "number to multiply with the y component of the vector.", + "type": "Number" + }, + { + "name": "z", + "description": "number to multiply with the z component of the vector.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "arr", + "description": "array to multiply with the components of the vector.", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "v", + "description": "vector to multiply with the components of the original vector.", + "type": "p5.Vector" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "resulting new p5.Vector.", + "type": "p5.Vector" + } + }, + { + "params": [ + { + "name": "v", + "type": "p5.Vector" + }, + { + "name": "n", + "type": "Number" + }, + { + "name": "target", + "description": "vector to receive the result.", + "optional": 1, + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v0", + "type": "p5.Vector" + }, + { + "name": "v1", + "type": "p5.Vector" + }, + { + "name": "target", + "optional": 1, + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v0", + "type": "p5.Vector" + }, + { + "name": "arr", + "type": "Number[]" + }, + { + "name": "target", + "optional": 1, + "type": "p5.Vector" + } + ] + } + ], + "return": { + "description": "resulting new p5.Vector.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "div", + "file": "src/math/p5.Vector.js", + "line": 2674, + "itemtype": "method", + "chainable": 1, + "description": "

    Divides a vector's x, y, and z components by the same number,\nseparate numbers, the components of another\np5.Vector object, or an array of numbers. Calling\ndiv() with no arguments has no effect.

    \n

    The static version of div(), as in p5.Vector.div(v, 2), returns a new\np5.Vector object and doesn't change the\noriginals.

    \n", + "example": [ + "
    \n\nstrokeWeight(5);\n\nlet p = createVector(50, 50);\npoint(p);\n\np.div(2);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(50, 75);\npoint(p);\n\np.div(2, 3);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(50, 75);\npoint(p);\n\nlet arr = [2, 3];\np.div(arr);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(50, 75);\npoint(p);\n\nlet p2 = createVector(2, 3);\np.div(p2);\npoint(p);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nstrokeWeight(5);\n\nlet p = createVector(50, 75);\npoint(p);\n\nlet p2 = createVector(2, 3);\nlet p3 = p5.Vector.div(p, p2);\npoint(p3);\n\ndescribe('Two black dots drawn on a gray square. One dot is in the top left corner and the other is in the bottom center.');\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let origin = createVector(0, 0);\n let v1 = createVector(50, 50);\n drawArrow(origin, v1, 'red');\n\n let v2 = p5.Vector.div(v1, 2);\n drawArrow(origin, v2, 'blue');\n\n describe('Two arrows extending from the top left corner. The blue arrow is half the length of the red arrow.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "The number to divide the vector by", + "type": "number" + } + ] + }, + { + "params": [ + { + "name": "x", + "description": "number to divide with the x component of the vector.", + "type": "Number" + }, + { + "name": "y", + "description": "number to divide with the y component of the vector.", + "type": "Number" + }, + { + "name": "z", + "description": "number to divide with the z component of the vector.", + "optional": 1, + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "arr", + "description": "array to divide the components of the vector by.", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "v", + "description": "vector to divide the components of the original vector by.", + "type": "p5.Vector" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + }, + { + "name": "z", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "The resulting new p5.Vector", + "type": "p5.Vector" + } + }, + { + "params": [ + { + "name": "v", + "type": "p5.Vector" + }, + { + "name": "n", + "type": "Number" + }, + { + "name": "target", + "description": "The vector to receive the result", + "optional": 1, + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v0", + "type": "p5.Vector" + }, + { + "name": "v1", + "type": "p5.Vector" + }, + { + "name": "target", + "optional": 1, + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v0", + "type": "p5.Vector" + }, + { + "name": "arr", + "type": "Number[]" + }, + { + "name": "target", + "optional": 1, + "type": "p5.Vector" + } + ] + } + ], + "return": { + "description": "The resulting new p5.Vector", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "mag", + "file": "src/math/p5.Vector.js", + "line": 2798, + "itemtype": "method", + "description": "Returns the magnitude (length) of the vector.", + "example": [ + "
    \n\nlet p = createVector(30, 40);\nline(0, 0, p.x, p.y);\n\nlet m = p.mag();\ntext(m, p.x, p.y);\n\ndescribe('A diagonal black line extends from the top left corner of a gray square. The number 50 is written at the end of the line.');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "magnitude of the vector.", + "type": "Number" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "vecT", + "description": "The vector to return the magnitude of", + "type": "p5.Vector" + } + ], + "return": { + "description": "The magnitude of vecT", + "type": "Number" + } + } + ], + "return": { + "description": "magnitude of the vector.", + "type": "Number" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "magSq", + "file": "src/math/p5.Vector.js", + "line": 2813, + "itemtype": "method", + "description": "Returns the magnitude (length) of the vector squared.", + "example": [ + "
    \n\nlet p = createVector(30, 40);\nline(0, 0, p.x, p.y);\n\nlet m = p.magSq();\ntext(m, p.x, p.y);\n\ndescribe('A diagonal black line extends from the top left corner of a gray square. The number 2500 is written at the end of the line.');\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "squared magnitude of the vector.", + "type": "number" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "vecT", + "description": "the vector to return the squared magnitude of", + "type": "p5.Vector" + } + ], + "return": { + "description": "the squared magnitude of vecT", + "type": "Number" + } + } + ], + "return": { + "description": "squared magnitude of the vector.", + "type": "number" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "dot", + "file": "src/math/p5.Vector.js", + "line": 2700, + "itemtype": "method", + "description": "

    Returns the dot product of two vectors. The dot product is a number that\ndescribes the overlap between two vectors. Visually, the dot product can be\nthought of as the \"shadow\" one vector casts on another. The dot product's\nmagnitude is largest when two vectors point in the same or opposite\ndirections. Its magnitude is 0 when two vectors form a right angle.

    \n

    The version of dot() with one parameter interprets it as another\np5.Vector object.

    \n

    The version of dot() with multiple parameters interprets them as the\nx, y, and z components of another vector.

    \n

    The static version of dot(), as in p5.Vector.dot(v1, v2), is the same\nas calling v1.dot(v2).

    \n", + "example": [ + "
    \n\nlet v1 = createVector(3, 4);\nlet v2 = createVector(3, 0);\nlet dp = v1.dot(v2);\n// Prints \"9\" to the console.\nprint(dp);\n\n
    \n\n
    \n\nlet v1 = createVector(1, 0);\nlet v2 = createVector(0, 1);\nlet dp = p5.Vector.dot(v1, v2);\n// Prints \"0\" to the console.\nprint(dp);\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let v0 = createVector(width / 2, height / 2);\n let v1 = createVector(30, 0);\n drawArrow(v0, v1, 'black');\n\n let v2 = createVector(mouseX - width / 2, mouseY - height / 2);\n drawArrow(v0, v2, 'red');\n\n let dp = v2.dot(v1);\n text(`v2 ā€¢ v1 = ${dp}`, 15, 20);\n\n describe('Two arrows drawn on a gray square. A black arrow points to the right and a red arrow follows the mouse. The text \"v1 ā€¢ v2 = something\" changes as the mouse moves.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component of the vector.", + "type": "Number" + }, + { + "name": "y", + "description": "y component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z component of the vector.", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "dot product.", + "type": "Number" + } + }, + { + "params": [ + { + "name": "v", + "description": "p5.Vector to be dotted.", + "type": "p5.Vector" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v1", + "description": "first p5.Vector.", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "second p5.Vector.", + "type": "p5.Vector" + } + ], + "return": { + "description": "dot product.", + "type": "Number" + } + } + ], + "return": { + "description": "dot product.", + "type": "Number" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "cross", + "file": "src/math/p5.Vector.js", + "line": 2713, + "itemtype": "method", + "description": "

    Returns the cross product of two vectors. The cross product is a vector\nthat points straight out of the plane created by two vectors. The cross\nproduct's magnitude is the area of the parallelogram formed by the original\ntwo vectors.

    \n

    The static version of cross(), as in p5.Vector.cross(v1, v2), is the same\nas calling v1.cross(v2).

    \n", + "example": [ + "
    \n\nlet v1 = createVector(1, 0);\nlet v2 = createVector(3, 4);\nlet cp = v1.cross(v2);\n// Prints \"p5.Vector Object : [0, 0, 4]\" to the console.\nprint(cp.toString());\n\n
    \n\n
    \n\nlet v1 = createVector(1, 0);\nlet v2 = createVector(3, 4);\nlet cp = p5.Vector.cross(v1, v2);\n// Prints \"p5.Vector Object : [0, 0, 4]\" to the console.\nprint(cp.toString());\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v", + "description": "p5.Vector to be crossed.", + "type": "p5.Vector" + } + ], + "return": { + "description": "cross product as a p5.Vector.", + "type": "p5.Vector" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v1", + "description": "first p5.Vector.", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "second p5.Vector.", + "type": "p5.Vector" + } + ], + "return": { + "description": "cross product.", + "type": "Number" + } + } + ], + "return": { + "description": "cross product as a p5.Vector.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "dist", + "file": "src/math/p5.Vector.js", + "line": 2727, + "itemtype": "method", + "description": "

    Returns the distance between two points represented by vectors. A point's\ncoordinates can be thought of as a vector's components.

    \n

    The static version of dist(), as in p5.Vector.dist(v1, v2), is the same\nas calling v1.dist(v2).

    \n

    Use dist() to calculate the distance between points\nusing coordinates as in dist(x1, y1, x2, y2).

    \n", + "example": [ + "
    \n\nlet v1 = createVector(1, 0);\nlet v2 = createVector(0, 1);\nlet d = v1.dist(v2);\n// Prints \"1.414...\" to the console.\nprint(d);\n\n
    \n\n
    \n\nlet v1 = createVector(1, 0);\nlet v2 = createVector(0, 1);\nlet d = p5.Vector.dist(v1, v2);\n// Prints \"1.414...\" to the console.\nprint(d);\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let origin = createVector(0, 0);\n let v1 = createVector(50, 50);\n drawArrow(origin, v1, 'red');\n\n let v2 = createVector(20, 70);\n drawArrow(origin, v2, 'blue');\n\n let v3 = p5.Vector.sub(v2, v1);\n drawArrow(v1, v3, 'purple');\n\n let m = floor(v3.mag());\n text(m, 50, 75);\n\n describe('Three arrows drawn on a gray square. A red and a blue arrow extend from the top left. A purple arrow extends from the tip of the red arrow to the tip of the blue arrow. The number 36 is written in black near the purple arrow.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v", + "description": "x, y, and z coordinates of a p5.Vector.", + "type": "p5.Vector" + } + ], + "return": { + "description": "distance.", + "type": "Number" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v1", + "description": "The first p5.Vector", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "The second p5.Vector", + "type": "p5.Vector" + } + ], + "return": { + "description": "The distance", + "type": "Number" + } + } + ], + "return": { + "description": "distance.", + "type": "Number" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "normalize", + "file": "src/math/p5.Vector.js", + "line": 2826, + "itemtype": "method", + "description": "

    Scales the components of a p5.Vector object so\nthat its magnitude is 1.

    \n

    The static version of normalize(), as in p5.Vector.normalize(v),\nreturns a new p5.Vector object and doesn't change\nthe original.

    \n", + "example": [ + "
    \n\nlet v = createVector(10, 20, 2);\nv.normalize();\n// Prints \"p5.Vector Object : [0.445..., 0.890..., 0.089...]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nlet v0 = createVector(10, 20, 2);\nlet v1 = p5.Vector.normalize(v0);\n// Prints \"p5.Vector Object : [10, 20, 2]\" to the console.\nprint(v0.toString());\n// Prints \"p5.Vector Object : [0.445..., 0.890..., 0.089...]\" to the console.\nprint(v1.toString());\n\n
    \n\n
    \n\nfunction draw() {\n background(240);\n\n let v0 = createVector(50, 50);\n let v1 = createVector(mouseX - 50, mouseY - 50);\n\n let r = 25;\n drawArrow(v0, v1, 'red');\n v1.normalize();\n drawArrow(v0, v1.mult(r), 'blue');\n\n noFill();\n circle(50, 50, r * 2);\n\n describe(\"A red and blue arrow extend from the center of a circle. Both arrows follow the mouse, but the blue arrow's length is fixed to the circle's radius.\");\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "normalized p5.Vector.", + "type": "p5.Vector" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "The vector to normalize", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "The vector to receive the result", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "The vector v, normalized to a length of 1", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "normalized p5.Vector.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "limit", + "file": "src/math/p5.Vector.js", + "line": 2852, + "itemtype": "method", + "chainable": 1, + "description": "

    Limits a vector's magnitude to a maximum value.

    \n

    The static version of limit(), as in p5.Vector.limit(v, 5), returns a\nnew p5.Vector object and doesn't change the\noriginal.

    \n", + "example": [ + "
    \n\nlet v = createVector(10, 20, 2);\nv.limit(5);\n// Prints \"p5.Vector Object : [2.227..., 4.454..., 0.445...]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nlet v0 = createVector(10, 20, 2);\nlet v1 = p5.Vector.limit(v0, 5);\n// Prints \"p5.Vector Object : [2.227..., 4.454..., 0.445...]\" to the console.\nprint(v1.toString());\n\n
    \n\n
    \n\nfunction draw() {\n background(240);\n\n let v0 = createVector(50, 50);\n let v1 = createVector(mouseX - 50, mouseY - 50);\n\n let r = 25;\n drawArrow(v0, v1, 'red');\n drawArrow(v0, v1.limit(r), 'blue');\n\n noFill();\n circle(50, 50, r * 2);\n\n describe(\"A red and blue arrow extend from the center of a circle. Both arrows follow the mouse, but the blue arrow never crosses the circle's edge.\");\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "max", + "description": "maximum magnitude for the vector.", + "type": "Number" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "the vector to limit", + "type": "p5.Vector" + }, + { + "name": "max", + "type": "Number" + }, + { + "name": "target", + "description": "the vector to receive the result (Optional)", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "v with a magnitude limited to max", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "v with a magnitude limited to max", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "setMag", + "file": "src/math/p5.Vector.js", + "line": 2878, + "itemtype": "method", + "chainable": 1, + "description": "

    Sets a vector's magnitude to a given value.

    \n

    The static version of setMag(), as in p5.Vector.setMag(v, 10), returns\na new p5.Vector object and doesn't change the\noriginal.

    \n", + "example": [ + "
    \n\nlet v = createVector(3, 4, 0);\n// Prints \"5\" to the console.\nprint(v.mag());\n\nv.setMag(10);\n// Prints \"p5.Vector Object : [6, 8, 0]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nlet v0 = createVector(3, 4, 0);\nlet v1 = p5.Vector.setMag(v0, 10);\n// Prints \"5\" to the console.\nprint(v0.mag());\n// Prints \"p5.Vector Object : [6, 8, 0]\" to the console.\nprint(v1.toString());\n\n
    \n\n
    \n\nfunction draw() {\n background(240);\n\n let origin = createVector(0, 0);\n let v = createVector(50, 50);\n\n drawArrow(origin, v, 'red');\n\n v.setMag(30);\n drawArrow(origin, v, 'blue');\n\n describe('Two arrows extend from the top left corner of a square toward its center. The red arrow reaches the center and the blue arrow only extends part of the way.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "len", + "description": "new length for this vector.", + "type": "number" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "the vector to set the magnitude of", + "type": "p5.Vector" + }, + { + "name": "len", + "type": "number" + }, + { + "name": "target", + "description": "the vector to receive the result (Optional)", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "v with a magnitude set to len", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "v with a magnitude set to len", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "heading", + "file": "src/math/p5.Vector.js", + "line": 2904, + "itemtype": "method", + "description": "

    Calculates the angle a 2D vector makes with the positive x-axis. Angles\nincrease in the clockwise direction.

    \n

    If the vector was created with\ncreateVector(), heading() returns angles\nin the units of the current angleMode().

    \n

    The static version of heading(), as in p5.Vector.heading(v), works the\nsame way.

    \n", + "example": [ + "
    \n\nlet v = createVector(1, 1);\n// Prints \"0.785...\" to the console.\nprint(v.heading());\n\nangleMode(DEGREES);\n// Prints \"45\" to the console.\nprint(v.heading());\n\n
    \n\n
    \n\nlet v = createVector(1, 1);\n// Prints \"0.785...\" to the console.\nprint(p5.Vector.heading(v));\n\nangleMode(DEGREES);\n// Prints \"45\" to the console.\nprint(p5.Vector.heading(v));\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let origin = createVector(0, 0);\n let v = createVector(50, 50);\n\n drawArrow(origin, v, 'black');\n\n angleMode(RADIANS);\n let h = round(v.heading(), 2);\n text(`Radians: ${h}`, 20, 70);\n angleMode(DEGREES);\n h = v.heading();\n text(`Degrees: ${h}`, 20, 85);\n\n describe('A black arrow extends from the top left of a square to its center. The text \"Radians: 0.79\" and \"Degrees: 45\" is written near the tip of the arrow.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "angle of rotation.", + "type": "Number" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "the vector to find the angle of", + "type": "p5.Vector" + } + ], + "return": { + "description": "the angle of rotation", + "type": "Number" + } + } + ], + "return": { + "description": "angle of rotation.", + "type": "Number" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "setHeading", + "file": "src/math/p5.Vector.js", + "line": 1633, + "itemtype": "method", + "chainable": 1, + "description": "

    Rotates a 2D vector to a specific angle without changing its magnitude.\nBy convention, the positive x-axis has an angle of 0. Angles increase in\nthe clockwise direction.

    \n

    If the vector was created with\ncreateVector(), setHeading() uses\nthe units of the current angleMode().

    \n", + "example": [ + "
    \n\nlet v = createVector(0, 1);\n// Prints \"1.570...\" to the console.\nprint(v.heading());\n\nv.setHeading(PI);\n// Prints \"3.141...\" to the console.\nprint(v.heading());\n\n
    \n\n
    \n\nangleMode(DEGREES);\nlet v = createVector(0, 1);\n// Prints \"90\" to the console.\nprint(v.heading());\n\nv.setHeading(180);\n// Prints \"180\" to the console.\nprint(v.heading());\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let v0 = createVector(50, 50);\n let v1 = createVector(30, 0);\n\n drawArrow(v0, v1, 'red');\n\n v1.setHeading(HALF_PI);\n drawArrow(v0, v1, 'blue');\n\n describe('Two arrows extend from the center of a gray square. The red arrow points to the right and the blue arrow points down.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "angle of rotation.", + "type": "number" + } + ] + } + ], + "class": "p5.Vector", + "static": false, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "rotate", + "file": "src/math/p5.Vector.js", + "line": 2626, + "itemtype": "method", + "chainable": 1, + "description": "

    Rotates a 2D vector by an angle without changing its magnitude.\nBy convention, the positive x-axis has an angle of 0. Angles increase in\nthe clockwise direction.

    \n

    If the vector was created with\ncreateVector(), rotate() uses\nthe units of the current angleMode().

    \n

    The static version of rotate(), as in p5.Vector.rotate(v, PI),\nreturns a new p5.Vector object and doesn't change\nthe original.

    \n", + "example": [ + "
    \n\nlet v = createVector(1, 0);\n// Prints \"p5.Vector Object : [1, 0, 0]\" to the console.\nprint(v.toString());\nv.rotate(HALF_PI);\n// Prints \"p5.Vector Object : [0, 1, 0]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nangleMode(DEGREES);\nlet v = createVector(1, 0);\n// Prints \"p5.Vector Object : [1, 0, 0]\" to the console.\nprint(v.toString());\nv.rotate(90);\n// Prints \"p5.Vector Object : [0, 1, 0]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nlet v0 = createVector(1, 0);\nlet v1 = p5.Vector.rotate(v0, HALF_PI);\n// Prints \"p5.Vector Object : [1, 0, 0]\" to the console.\nprint(v0.toString());\n// Prints \"p5.Vector Object : [0, 1, 0]\" to the console.\nprint(v1.toString());\n\n
    \n\n
    \n\nangleMode(DEGREES);\nlet v0 = createVector(1, 0);\nlet v1 = p5.Vector.rotate(v0, 90);\n// Prints \"p5.Vector Object : [1, 0, 0]\" to the console.\nprint(v0.toString());\n// Prints \"p5.Vector Object : [0, 1, 0]\" to the console.\nprint(v1.toString());\n\n
    \n\n
    \n\nlet v0;\nlet v1;\n\nfunction setup() {\n v0 = createVector(50, 50);\n v1 = createVector(30, 0);\n}\n\nfunction draw() {\n background(240);\n\n v1.rotate(0.01);\n\n drawArrow(v0, v1, 'black');\n\n describe('A black arrow extends from the center of a gray square. The arrow rotates counterclockwise.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "angle of rotation.", + "type": "number" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "type": "p5.Vector" + }, + { + "name": "angle", + "type": "Number" + }, + { + "name": "target", + "description": "The vector to receive the result", + "optional": 1, + "type": "p5.Vector" + } + ] + } + ], + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "angleBetween", + "file": "src/math/p5.Vector.js", + "line": 2919, + "itemtype": "method", + "description": "

    Returns the angle between two vectors. The angles returned are signed,\nwhich means that v1.angleBetween(v2) === -v2.angleBetween(v1).

    \n

    If the vector was created with\ncreateVector(), angleBetween() returns\nangles in the units of the current\nangleMode().

    \n", + "example": [ + "
    \n\nlet v0 = createVector(1, 0);\nlet v1 = createVector(0, 1);\n// Prints \"1.570...\" to the console.\nprint(v0.angleBetween(v1));\n// Prints \"-1.570...\" to the console.\nprint(v1.angleBetween(v0));\n\n
    \n\n
    \n\nangleMode(DEGREES);\nlet v0 = createVector(1, 0);\nlet v1 = createVector(0, 1);\n// Prints \"90\" to the console.\nprint(v0.angleBetween(v1));\n// Prints \"-90\" to the console.\nprint(v1.angleBetween(v0));\n\n
    \n\n
    \n\nlet v0 = createVector(1, 0);\nlet v1 = createVector(0, 1);\n// Prints \"1.570...\" to the console.\nprint(p5.Vector.angleBetween(v0, v1));\n// Prints \"-1.570...\" to the console.\nprint(p5.Vector.angleBetween(v1, v0));\n\n
    \n\n
    \n\nangleMode(DEGREES);\nlet v0 = createVector(1, 0);\nlet v1 = createVector(0, 1);\n// Prints \"90\" to the console.\nprint(p5.Vector.angleBetween(v0, v1));\n// Prints \"-90\" to the console.\nprint(p5.Vector.angleBetween(v1, v0));\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let v0 = createVector(50, 50);\n let v1 = createVector(30, 0);\n let v2 = createVector(0, 30);\n\n drawArrow(v0, v1, 'red');\n drawArrow(v0, v2, 'blue');\n\n angleMode(RADIANS);\n let angle = round(v1.angleBetween(v2), 2);\n text(`Radians: ${angle}`, 20, 20);\n angleMode(DEGREES);\n angle = round(v1.angleBetween(v2), 2);\n text(`Degrees: ${angle}`, 20, 35);\n\n describe('Two arrows extend from the center of a gray square. A red arrow points to the right and a blue arrow points down. The text \"Radians: 1.57\" and \"Degrees: 90\" is written above the arrows.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "x, y, and z components of a p5.Vector.", + "type": "p5.Vector" + } + ], + "return": { + "description": "angle between the vectors.", + "type": "Number" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v1", + "description": "the first vector.", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "the second vector.", + "type": "p5.Vector" + } + ], + "return": { + "description": "angle between the two vectors.", + "type": "Number" + } + } + ], + "return": { + "description": "angle between the vectors.", + "type": "Number" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "lerp", + "file": "src/math/p5.Vector.js", + "line": 2743, + "itemtype": "method", + "chainable": 1, + "description": "

    Calculates new x, y, and z components that are proportionally the\nsame distance between two vectors. The amt parameter is the amount to\ninterpolate between the old vector and the new vector. 0.0 keeps all\ncomponents equal to the old vector's, 0.5 is halfway between, and 1.0 sets\nall components equal to the new vector's.

    \n

    The static version of lerp(), as in p5.Vector.lerp(v0, v1, 0.5),\nreturns a new p5.Vector object and doesn't change\nthe original.

    \n", + "example": [ + "
    \n\nlet v0 = createVector(1, 1, 1);\nlet v1 = createVector(3, 3, 3);\nv0.lerp(v1, 0.5);\n// Prints \"p5.Vector Object : [2, 2, 2]\" to the console.\nprint(v0.toString());\n\n
    \n\n
    \n\nlet v = createVector(1, 1, 1);\nv.lerp(3, 3, 3, 0.5);\n// Prints \"p5.Vector Object : [2, 2, 2]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nlet v0 = createVector(1, 1, 1);\nlet v1 = createVector(3, 3, 3);\nlet v2 = p5.Vector.lerp(v0, v1, 0.5);\n// Prints \"p5.Vector Object : [2, 2, 2]\" to the console.\nprint(v2.toString());\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let v0 = createVector(50, 50);\n let v1 = createVector(30, 0);\n let v2 = createVector(0, 30);\n let v3 = p5.Vector.lerp(v1, v2, 0.5);\n\n drawArrow(v0, v1, 'red');\n drawArrow(v0, v2, 'blue');\n drawArrow(v0, v3, 'purple');\n\n describe('Three arrows extend from the center of a gray square. A red arrow points to the right, a blue arrow points down, and a purple arrow points to the bottom right.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component.", + "type": "Number" + }, + { + "name": "y", + "description": "y component.", + "type": "Number" + }, + { + "name": "z", + "description": "z component.", + "type": "Number" + }, + { + "name": "amt", + "description": "amount of interpolation between 0.0 (old vector)\nand 1.0 (new vector). 0.5 is halfway between.", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v", + "description": "p5.Vector to lerp toward.", + "type": "p5.Vector" + }, + { + "name": "amt", + "type": "Number" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v1", + "type": "p5.Vector" + }, + { + "name": "v2", + "type": "p5.Vector" + }, + { + "name": "amt", + "type": "Number" + }, + { + "name": "target", + "description": "The vector to receive the result", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "The lerped value", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "The lerped value", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "slerp", + "file": "src/math/p5.Vector.js", + "line": 2773, + "itemtype": "method", + "description": "

    Calculates a new heading and magnitude that are between two vectors. The\namt parameter is the amount to interpolate between the old vector and\nthe new vector. 0.0 keeps the heading and magnitude equal to the old\nvector's, 0.5 sets them halfway between, and 1.0 sets the heading and\nmagnitude equal to the new vector's.

    \n

    slerp() differs from lerp() because\nit interpolates magnitude. Calling v0.slerp(v1, 0.5) sets v0's\nmagnitude to a value halfway between its original magnitude and v1's.\nCalling v0.lerp(v1, 0.5) makes no such guarantee.

    \n

    The static version of slerp(), as in p5.Vector.slerp(v0, v1, 0.5),\nreturns a new p5.Vector object and doesn't change\nthe original.

    \n", + "example": [ + "
    \n\nlet v0 = createVector(3, 0);\n// Prints \"3\" to the console.\nprint(v0.mag());\n// Prints \"0\" to the console.\nprint(v0.heading());\n\nlet v1 = createVector(0, 1);\n// Prints \"1\" to the console.\nprint(v1.mag());\n// Prints \"1.570...\" to the console.\nprint(v1.heading());\n\nv0.slerp(v1, 0.5);\n// Prints \"2\" to the console.\nprint(v0.mag());\n// Prints \"0.785...\" to the console.\nprint(v0.heading());\n\n
    \n\n
    \n\nlet v0 = createVector(3, 0);\n// Prints \"3\" to the console.\nprint(v0.mag());\n// Prints \"0\" to the console.\nprint(v0.heading());\n\nlet v1 = createVector(0, 1);\n// Prints \"1\" to the console.\nprint(v1.mag());\n// Prints \"1.570...\" to the console.\nprint(v1.heading());\n\nlet v3 = p5.Vector.slerp(v0, v1, 0.5);\n// Prints \"2\" to the console.\nprint(v3.mag());\n// Prints \"0.785...\" to the console.\nprint(v3.heading());\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let v0 = createVector(50, 50);\n let v1 = createVector(20, 0);\n let v2 = createVector(-40, 0);\n let v3 = p5.Vector.slerp(v1, v2, 0.5);\n\n drawArrow(v0, v1, 'red');\n drawArrow(v0, v2, 'blue');\n drawArrow(v0, v3, 'purple');\n\n describe('Three arrows extend from the center of a gray square. A red arrow points to the right, a blue arrow points to the left, and a purple arrow points down.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "v", + "description": "p5.Vector to slerp toward.", + "type": "p5.Vector" + }, + { + "name": "amt", + "description": "amount of interpolation between 0.0 (old vector)\nand 1.0 (new vector). 0.5 is halfway between.", + "type": "Number" + } + ], + "return": { + "description": "", + "type": "p5.Vector" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v1", + "description": "old vector.", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "new vector.", + "type": "p5.Vector" + }, + { + "name": "amt", + "type": "Number" + }, + { + "name": "target", + "description": "vector to receive the result.", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "slerped vector between v1 and v2", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "reflect", + "file": "src/math/p5.Vector.js", + "line": 2934, + "itemtype": "method", + "chainable": 1, + "description": "

    Reflects a vector about a line in 2D or a plane in 3D. The orientation of\nthe line or plane is described by a normal vector that points away from the\nshape.

    \n

    The static version of reflect(), as in p5.Vector.reflect(v, n),\nreturns a new p5.Vector object and doesn't change\nthe original.

    \n", + "example": [ + "
    \n\nlet n = createVector(0, 1);\nlet v = createVector(4, 6);\nv.reflect(n);\n// Prints \"p5.Vector Object : [4, -6, 0]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nlet n = createVector(0, 1);\nlet v0 = createVector(4, 6);\nlet v1 = p5.Vector.reflect(v0, n);\n// Prints \"p5.Vector Object : [4, -6, 0]\" to the console.\nprint(v1.toString());\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n line(50, 0, 50, 100);\n let n = createVector(1, 0);\n\n let v0 = createVector(50, 50);\n let v1 = createVector(30, 40);\n let v2 = p5.Vector.reflect(v1, n);\n\n n.setMag(30);\n drawArrow(v0, n, 'black');\n drawArrow(v0, v1, 'red');\n drawArrow(v0, v2, 'blue');\n\n describe('Three arrows extend from the center of a gray square with a vertical line down its middle. A black arrow points to the right, a blue arrow points to the bottom left, and a red arrow points to the bottom right.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "surfaceNormal", + "description": "p5.Vector\nto reflect about.", + "type": "p5.Vector" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "incidentVector", + "description": "vector to be reflected.", + "type": "p5.Vector" + }, + { + "name": "surfaceNormal", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "vector to receive the result.", + "optional": 1, + "type": "p5.Vector" + } + ], + "return": { + "description": "the reflected vector", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "the reflected vector", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "array", + "file": "src/math/p5.Vector.js", + "line": 2960, + "itemtype": "method", + "description": "Returns the vector's components as an array of numbers.", + "example": [ + "
    \n\nlet v = createVector(20, 30);\n// Prints \"[20, 30, 0]\" to the console.\nprint(v.array());\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "array with the vector's components.", + "type": "Number[]" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "the vector to convert to an array", + "type": "p5.Vector" + } + ], + "return": { + "description": "an Array with the 3 values", + "type": "Number[]" + } + } + ], + "return": { + "description": "array with the vector's components.", + "type": "Number[]" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "equals", + "file": "src/math/p5.Vector.js", + "line": 2973, + "itemtype": "method", + "description": "

    Returns true if the vector's components are all the same as another\nvector's and false if not.

    \n

    The version of equals() with one parameter interprets it as another\np5.Vector object.

    \n

    The version of equals() with multiple parameters interprets them as the\ncomponents of another vector. Any missing parameters are assigned the value\n0.

    \n

    The static version of equals(), as in p5.Vector.equals(v0, v1),\ninterprets both parameters as p5.Vector objects.

    \n", + "example": [ + "
    \n\nlet v0 = createVector(10, 20, 30);\nlet v1 = createVector(10, 20, 30);\nlet v2 = createVector(0, 0, 0);\n\n// Prints \"true\" to the console.\nprint(v0.equals(v1));\n// Prints \"false\" to the console.\nprint(v0.equals(v2));\n\n
    \n\n
    \n\nlet v0 = createVector(5, 10, 20);\nlet v1 = createVector(5, 10, 20);\nlet v2 = createVector(13, 10, 19);\n\n// Prints \"true\" to the console.\nprint(v0.equals(v1.x, v1.y, v1.z));\n// Prints \"false\" to the console.\nprint(v0.equals(v2.x, v2.y, v2.z));\n\n
    \n\n
    \n\nlet v0 = createVector(10, 20, 30);\nlet v1 = createVector(10, 20, 30);\nlet v2 = createVector(0, 0, 0);\n\n// Prints \"true\" to the console.\nprint(p5.Vector.equals(v0, v1));\n// Prints \"false\" to the console.\nprint(p5.Vector.equals(v0, v2));\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "y", + "description": "y component of the vector.", + "optional": 1, + "type": "Number" + }, + { + "name": "z", + "description": "z component of the vector.", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "whether the vectors are equal.", + "type": "Boolean" + } + }, + { + "params": [ + { + "name": "value", + "description": "vector to compare.", + "type": "p5.Vector|Array" + } + ], + "return": { + "description": "", + "type": "Boolean" + } + }, + { + "params": [] + }, + { + "params": [ + { + "name": "v1", + "description": "the first vector to compare", + "type": "p5.Vector|Array" + }, + { + "name": "v2", + "description": "the second vector to compare", + "type": "p5.Vector|Array" + } + ], + "return": { + "description": "", + "type": "Boolean" + } + } + ], + "return": { + "description": "whether the vectors are equal.", + "type": "Boolean" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "fromAngle", + "file": "src/math/p5.Vector.js", + "line": 2340, + "itemtype": "method", + "description": "Make a new 2D vector from an angle.", + "example": [ + "
    \n\nlet v = p5.Vector.fromAngle(0);\n// Prints \"p5.Vector Object : [1, 0, 0]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n let v0 = createVector(50, 50);\n let v1 = p5.Vector.fromAngle(0, 30);\n\n drawArrow(v0, v1, 'black');\n\n describe('A black arrow extends from the center of a gray square. It points to the right.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "desired angle, in radians. Unaffected by angleMode().", + "type": "Number" + }, + { + "name": "length", + "description": "length of the new vector (defaults to 1).", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "fromAngles", + "file": "src/math/p5.Vector.js", + "line": 2394, + "itemtype": "method", + "description": "Make a new 3D vector from a pair of ISO spherical angles.", + "example": [ + "
    \n\nlet v = p5.Vector.fromAngles(0, 0);\n// Prints \"p5.Vector Object : [0, -1, 0]\" to the console.\nprint(v.toString());\n\n
    \n\n
    \n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n background(0);\n\n fill(255);\n noStroke();\n\n let theta = frameCount * 0.05;\n let phi = 0;\n let v = p5.Vector.fromAngles(theta, phi, 100);\n let c = color('deeppink');\n pointLight(c, v);\n\n sphere(35);\n\n describe('A light shines on a pink sphere as it orbits.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "theta", + "description": "polar angle in radians (zero is up).", + "type": "Number" + }, + { + "name": "phi", + "description": "azimuthal angle in radians\n(zero is out of the screen).", + "type": "Number" + }, + { + "name": "length", + "description": "length of the new vector (defaults to 1).", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "random2D", + "file": "src/math/p5.Vector.js", + "line": 2456, + "itemtype": "method", + "description": "Make a new 2D unit vector with a random heading.", + "example": [ + "
    \n\nlet v = p5.Vector.random2D();\n// Prints \"p5.Vector Object : [x, y, 0]\" to the console\n// where x and y are small random numbers.\nprint(v.toString());\n\n
    \n\n
    \n\nfunction draw() {\n background(200);\n\n frameRate(1);\n\n let v0 = createVector(50, 50);\n let v1 = p5.Vector.random2D();\n v1.mult(30);\n drawArrow(v0, v1, 'black');\n\n describe('A black arrow in extends from the center of a gray square. It changes direction once per second.');\n}\n\nfunction drawArrow(base, vec, myColor) {\n push();\n stroke(myColor);\n strokeWeight(3);\n fill(myColor);\n translate(base.x, base.y);\n line(0, 0, vec.x, vec.y);\n rotate(vec.heading());\n let arrowSize = 7;\n translate(vec.mag() - arrowSize, 0);\n triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n pop();\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "random3D", + "file": "src/math/p5.Vector.js", + "line": 2475, + "itemtype": "method", + "description": "Make a new 3D unit vector with a random heading.", + "example": [ + "
    \n\nlet v = p5.Vector.random3D();\n// Prints \"p5.Vector Object : [x, y, z]\" to the console\n// where x, y, and z are small random numbers.\nprint(v.toString());\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + } + } + ], + "return": { + "description": "new p5.Vector object.", + "type": "p5.Vector" + }, + "class": "p5.Vector", + "static": 1, + "module": "Math", + "submodule": "Vector" + }, + { + "name": "textBounds", + "file": "src/typography/p5.Font.js", + "line": 139, + "itemtype": "method", + "description": "

    Returns the bounding box for a string of text written using this\np5.Font.

    \n

    The first parameter, str, is a string of text. The second and third\nparameters, x and y, are the text's position. By default, they set the\ncoordinates of the bounding box's bottom-left corner. See\ntextAlign() for more ways to align text.

    \n

    The fourth parameter, fontSize, is optional. It sets the font size used to\ndetermine the bounding box. By default, font.textBounds() will use the\ncurrent textSize().

    \n", + "example": [ + "
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n background(200);\n\n let bbox = font.textBounds('p5*js', 35, 53);\n rect(bbox.x, bbox.y, bbox.w, bbox.h);\n\n textFont(font);\n text('p5*js', 35, 53);\n\n describe('The text \"p5*js\" written in black inside a white rectangle.');\n}\n\n
    \n\n
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n background(200);\n\n textFont(font);\n textSize(15);\n textAlign(CENTER, CENTER);\n\n let bbox = font.textBounds('p5*js', 50, 50);\n rect(bbox.x, bbox.y, bbox.w, bbox.h);\n\n text('p5*js', 50, 50);\n\n describe('The text \"p5*js\" written in black inside a white rectangle.');\n}\n\n
    \n\n
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n background(200);\n\n let bbox = font.textBounds('p5*js', 31, 53, 15);\n rect(bbox.x, bbox.y, bbox.w, bbox.h);\n\n textFont(font);\n textSize(15);\n text('p5*js', 31, 53);\n\n describe('The text \"p5*js\" written in black inside a white rectangle.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "string of text.", + "type": "String" + }, + { + "name": "x", + "description": "x-coordinate of the text.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the text.", + "type": "Number" + }, + { + "name": "fontSize", + "description": "font size. Defaults to the current\ntextSize().", + "optional": 1, + "type": "Number" + } + ], + "return": { + "description": "object describing the bounding box with\nproperties x, y, w, and h.", + "type": "Object" + } + } + ], + "return": { + "description": "object describing the bounding box with\nproperties x, y, w, and h.", + "type": "Object" + }, + "class": "p5.Font", + "static": false, + "module": "Typography", + "submodule": "Loading & Displaying" + }, + { + "name": "textToPoints", + "file": "src/typography/p5.Font.js", + "line": 293, + "itemtype": "method", + "description": "

    Returns an array of points outlining a string of text written using this\np5.Font.

    \n

    The first parameter, str, is a string of text. The second and third\nparameters, x and y, are the text's position. By default, they set the\ncoordinates of the bounding box's bottom-left corner. See\ntextAlign() for more ways to align text.

    \n

    The fourth parameter, fontSize, is optional. It sets the text's font\nsize. By default, font.textToPoints() will use the current\ntextSize().

    \n

    The fifth parameter, options, is also optional. font.textToPoints()\nexpects an object with the following properties:

    \n

    sampleFactor is the ratio of the text's path length to the number of\nsamples. It defaults to 0.1. Higher values produce more points along the\npath and are more precise.

    \n

    simplifyThreshold removes collinear points if it's set to a number other\nthan 0. The value represents the threshold angle to use when determining\nwhether two edges are collinear.

    \n", + "example": [ + "
    \n\nlet font;\n\nfunction preload() {\n font = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n background(200);\n let points = font.textToPoints('p5*js', 6, 60, 35, { sampleFactor: 0.5 });\n points.forEach(p => {\n point(p.x, p.y);\n });\n\n describe('A set of black dots outlining the text \"p5*js\" on a gray background.');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "string of text.", + "type": "String" + }, + { + "name": "x", + "description": "x-coordinate of the text.", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the text.", + "type": "Number" + }, + { + "name": "fontSize", + "description": "font size. Defaults to the current\ntextSize().", + "optional": 1, + "type": "Number" + }, + { + "name": "options", + "description": "object with sampleFactor and simplifyThreshold\nproperties.", + "optional": 1, + "type": "Object" + } + ], + "return": { + "description": "array of point objects, each with x, y, and alpha (path angle) properties.", + "type": "Array" + } + } + ], + "return": { + "description": "array of point objects, each with x, y, and alpha (path angle) properties.", + "type": "Array" + }, + "class": "p5.Font", + "static": false, + "module": "Typography", + "submodule": "Loading & Displaying" + }, + { + "name": "perspective", + "file": "src/webgl/p5.Camera.js", + "line": 788, + "itemtype": "method", + "description": "Sets a perspective projection.\nAccepts the same parameters as the global\nperspective().\nMore information on this function can be found there.", + "example": [ + "
    \n\n// drag the mouse to look around!\n\nlet cam;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n // create a camera\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n // give it a perspective projection\n cam.perspective(PI / 3.0, width / height, 0.1, 500);\n}\n\nfunction draw() {\n background(200);\n orbitControl();\n normalMaterial();\n\n rotateX(-0.3);\n rotateY(-0.2);\n translate(0, 0, -50);\n\n push();\n translate(-15, 0, sin(frameCount / 30) * 65);\n box(30);\n pop();\n push();\n translate(15, 0, sin(frameCount / 30 + PI) * 65);\n box(30);\n pop();\n}\n\n
    " + ], + "alt": "two colored 3D boxes move back and forth, rotating as mouse is dragged.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "ortho", + "file": "src/webgl/p5.Camera.js", + "line": 888, + "itemtype": "method", + "description": "Sets an orthographic projection.\nAccepts the same parameters as the global\northo().\nMore information on this function can be found there.", + "example": [ + "
    \n\n// drag the mouse to look around!\n// there's no vanishing point\n\nlet cam;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n // create a camera\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n // give it an orthographic projection\n cam.ortho(-width / 2, width / 2, height / 2, -height / 2, 0, 500);\n}\nfunction draw() {\n background(200);\n orbitControl();\n normalMaterial();\n\n rotateX(0.2);\n rotateY(-0.2);\n push();\n translate(-15, 0, sin(frameCount / 30) * 65);\n box(30);\n pop();\n push();\n translate(15, 0, sin(frameCount / 30 + PI) * 65);\n box(30);\n pop();\n}\n\n
    " + ], + "alt": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "frustum", + "file": "src/webgl/p5.Camera.js", + "line": 970, + "itemtype": "method", + "description": "Sets the camera's frustum.\nAccepts the same parameters as the global\nfrustum().\nMore information on this function can be found there.", + "example": [ + "
    \n\nlet cam;\n\nfunction setup() {\n x = createCanvas(100, 100, WEBGL);\n setAttributes('antialias', true);\n // create a camera\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n // set its frustum\n cam.frustum(-0.1, 0.1, -0.1, 0.1, 0.1, 200);\n}\n\nfunction draw() {\n background(200);\n orbitControl();\n normalMaterial();\n\n rotateY(-0.2);\n rotateX(-0.3);\n push();\n translate(-15, 0, sin(frameCount / 30) * 25);\n box(30);\n pop();\n push();\n translate(15, 0, sin(frameCount / 30 + PI) * 25);\n box(30);\n pop();\n}\n\n
    " + ], + "alt": "two 3D boxes move back and forth along same plane, rotating as mouse is dragged.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "pan", + "file": "src/webgl/p5.Camera.js", + "line": 1111, + "itemtype": "method", + "description": "Panning rotates the camera view to the left and right.", + "example": [ + "
    \n\nlet cam;\nlet delta = 0.01;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // set initial pan angle\n cam.pan(-0.8);\n}\n\nfunction draw() {\n background(200);\n\n // pan camera according to angle 'delta'\n cam.pan(delta);\n\n // every 160 frames, switch direction\n if (frameCount % 160 === 0) {\n delta *= -1;\n }\n\n rotateX(frameCount * 0.01);\n translate(-100, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n}\n\n
    " + ], + "alt": "camera view pans left and right across a series of rotating 3D boxes.", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "amount to rotate camera in current\nangleMode units.\nGreater than 0 values rotate counterclockwise (to the left).", + "type": "Number" + } + ] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "tilt", + "file": "src/webgl/p5.Camera.js", + "line": 1170, + "itemtype": "method", + "description": "Tilting rotates the camera view up and down.", + "example": [ + "
    \n\nlet cam;\nlet delta = 0.01;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // set initial tilt\n cam.tilt(-0.8);\n}\n\nfunction draw() {\n background(200);\n\n // pan camera according to angle 'delta'\n cam.tilt(delta);\n\n // every 160 frames, switch direction\n if (frameCount % 160 === 0) {\n delta *= -1;\n }\n\n rotateY(frameCount * 0.01);\n translate(0, -100, 0);\n box(20);\n translate(0, 35, 0);\n box(20);\n translate(0, 35, 0);\n box(20);\n translate(0, 35, 0);\n box(20);\n translate(0, 35, 0);\n box(20);\n translate(0, 35, 0);\n box(20);\n translate(0, 35, 0);\n box(20);\n}\n\n
    " + ], + "alt": "camera view tilts up and down across a series of rotating 3D boxes.", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "amount to rotate camera in current\nangleMode units.\nGreater than 0 values rotate counterclockwise (to the left).", + "type": "Number" + } + ] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "lookAt", + "file": "src/webgl/p5.Camera.js", + "line": 1225, + "itemtype": "method", + "description": "Reorients the camera to look at a position in world space.", + "example": [ + "
    \n\nlet cam;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n}\n\nfunction draw() {\n background(200);\n\n // look at a new random point every 60 frames\n if (frameCount % 60 === 0) {\n cam.lookAt(random(-100, 100), random(-50, 50), 0);\n }\n\n rotateX(frameCount * 0.01);\n translate(-100, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n translate(35, 0, 0);\n box(20);\n}\n\n
    " + ], + "alt": "camera view of rotating 3D cubes changes to look at a new random\npoint every second .", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x position of a point in world space", + "type": "Number" + }, + { + "name": "y", + "description": "y position of a point in world space", + "type": "Number" + }, + { + "name": "z", + "description": "z position of a point in world space", + "type": "Number" + } + ] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "camera", + "file": "src/webgl/p5.Camera.js", + "line": 1327, + "itemtype": "method", + "description": "Sets the camera's position and orientation.\nAccepts the same parameters as the global\ncamera().\nMore information on this function can be found there.", + "example": [ + "
    \n\nlet cam;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n // Create a camera.\n // createCamera() sets the newly created camera as\n // the current (active) camera.\n cam = createCamera();\n}\n\nfunction draw() {\n background(204);\n // Move the camera away from the plane by a sin wave\n cam.camera(0, 0, 20 + sin(frameCount * 0.01) * 10, 0, 0, 0, 0, 1, 0);\n plane(10, 10);\n}\n\n
    ", + "
    \n\n// move slider to see changes!\n// sliders control the first 6 parameters of camera()\n\nlet sliderGroup = [];\nlet X;\nlet Y;\nlet Z;\nlet centerX;\nlet centerY;\nlet centerZ;\nlet h = 20;\nlet cam;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n // create a camera\n cam = createCamera();\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // create sliders\n for (var i = 0; i < 6; i++) {\n if (i === 2) {\n sliderGroup[i] = createSlider(10, 400, 200);\n } else {\n sliderGroup[i] = createSlider(-400, 400, 0);\n }\n h = map(i, 0, 6, 5, 85);\n sliderGroup[i].position(10, height + h);\n sliderGroup[i].style('width', '80px');\n }\n}\n\nfunction draw() {\n background(60);\n // assigning sliders' value to each parameters\n X = sliderGroup[0].value();\n Y = sliderGroup[1].value();\n Z = sliderGroup[2].value();\n centerX = sliderGroup[3].value();\n centerY = sliderGroup[4].value();\n centerZ = sliderGroup[5].value();\n cam.camera(X, Y, Z, centerX, centerY, centerZ, 0, 1, 0);\n stroke(255);\n fill(255, 102, 94);\n box(85);\n}\n\n
    " + ], + "alt": "White square repeatedly grows to fill canvas and then shrinks.\nAn interactive example of a red cube with 3 sliders for moving it across x, y,\nz axis and 3 sliders for shifting its center.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "move", + "file": "src/webgl/p5.Camera.js", + "line": 1441, + "itemtype": "method", + "description": "Move camera along its local axes while maintaining current camera orientation.", + "example": [ + "
    \n\n// see the camera move along its own axes while maintaining its orientation\nlet cam;\nlet delta = 0.5;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n}\n\nfunction draw() {\n background(200);\n\n // move the camera along its local axes\n cam.move(delta, delta, 0);\n\n // every 100 frames, switch direction\n if (frameCount % 150 === 0) {\n delta *= -1;\n }\n\n translate(-10, -10, 0);\n box(50, 8, 50);\n translate(15, 15, 0);\n box(50, 8, 50);\n translate(15, 15, 0);\n box(50, 8, 50);\n translate(15, 15, 0);\n box(50, 8, 50);\n translate(15, 15, 0);\n box(50, 8, 50);\n translate(15, 15, 0);\n box(50, 8, 50);\n}\n\n
    " + ], + "alt": "camera view moves along a series of 3D boxes, maintaining the same\norientation throughout the move", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "amount to move along camera's left-right axis", + "type": "Number" + }, + { + "name": "y", + "description": "amount to move along camera's up-down axis", + "type": "Number" + }, + { + "name": "z", + "description": "amount to move along camera's forward-backward axis", + "type": "Number" + } + ] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "setPosition", + "file": "src/webgl/p5.Camera.js", + "line": 1508, + "itemtype": "method", + "description": "Set camera position in world-space while maintaining current camera\norientation.", + "example": [ + "
    \n\n// press '1' '2' or '3' keys to set camera position\n\nlet cam;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n normalMaterial();\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n}\n\nfunction draw() {\n background(200);\n\n // '1' key\n if (keyIsDown(49)) {\n cam.setPosition(30, 0, 80);\n }\n // '2' key\n if (keyIsDown(50)) {\n cam.setPosition(0, 0, 80);\n }\n // '3' key\n if (keyIsDown(51)) {\n cam.setPosition(-30, 0, 80);\n }\n\n box(20);\n}\n\n
    " + ], + "alt": "camera position changes as the user presses keys, altering view of a 3D box", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x position of a point in world space", + "type": "Number" + }, + { + "name": "y", + "description": "y position of a point in world space", + "type": "Number" + }, + { + "name": "z", + "description": "z position of a point in world space", + "type": "Number" + } + ] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "set", + "file": "src/webgl/p5.Camera.js", + "line": 1576, + "itemtype": "method", + "description": "Copies information about the argument camera's view and projection to\nthe target camera. If the target camera is active, it will be reflected\non the screen.", + "example": [ + "
    \n\nlet cam, initialCam;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n strokeWeight(3);\n\n // Set the initial state to initialCamera and set it to the camera\n // used for drawing. Then set cam to be the active camera.\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n initialCam = createCamera();\n initialCam.camera(100, 100, 100, 0, 0, 0, 0, 0, -1);\n initialCam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n cam.set(initialCam);\n\n setCamera(cam);\n}\n\nfunction draw() {\n orbitControl();\n background(255);\n box(50);\n translate(0, 0, -25);\n plane(100);\n}\n\nfunction doubleClicked(){\n // Double-click to return the camera to its initial position.\n cam.set(initialCam);\n}\n\n
    " + ], + "alt": "Prepare two cameras. One is the camera that sets the initial state,\nand the other is the camera that moves with interaction.\nDraw a plane and a box on top of it, operate the camera using orbitControl().\nDouble-click to set the camera in the initial state and return to\nthe initial state.", + "overloads": [ + { + "params": [ + { + "name": "cam", + "description": "source camera", + "type": "p5.Camera" + } + ] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "slerp", + "file": "src/webgl/p5.Camera.js", + "line": 1718, + "itemtype": "method", + "description": "For the cameras cam0 and cam1 with the given arguments, their view are combined\nwith the parameter amt that represents the quantity, and the obtained view is applied.\nFor example, if cam0 is looking straight ahead and cam1 is looking straight\nto the right and amt is 0.5, the applied camera will look to the halfway\nbetween front and right.\nIf the applied camera is active, the applied result will be reflected on the screen.\nWhen applying this function, all cameras involved must have exactly the same projection\nsettings. For example, if one is perspective, ortho, frustum, the other two must also be\nperspective, ortho, frustum respectively. However, if all cameras have ortho settings,\ninterpolation is possible if the ratios of left, right, top and bottom are equal to each other.\nFor example, when it is changed by orbitControl().", + "example": [ + "
    \n\nlet cam0, cam1, cam;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n strokeWeight(3);\n\n // camera for slerp.\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // cam0 is looking at the cube from the front.\n cam0 = createCamera();\n cam0.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam0.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // cam1 is pointing straight to the right in the cube\n // at the same position as cam0 by doing a pan(-PI/2).\n cam1 = createCamera();\n cam1.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam1.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n cam1.pan(-PI/2);\n\n // we only use cam.\n setCamera(cam);\n}\n\nfunction draw() {\n // calculate amount.\n const amt = 0.5 - 0.5 * cos(frameCount * TAU / 120);\n // slerp cam0 and cam1 with amt, set to cam.\n // When amt moves from 0 to 1, cam moves from cam0 to cam1,\n // shaking the camera to the right.\n cam.slerp(cam0, cam1, amt);\n\n background(255);\n // Every time the camera turns right, the cube drifts left.\n box(40);\n}\n\n
    ", + "
    \n\nlet cam, lastCam, initialCam;\nlet countForReset = 30;\n// This sample uses orbitControl() to move the camera.\n// Double-clicking the canvas restores the camera to its initial state.\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n strokeWeight(3);\n\n // main camera\n cam = createCamera();\n cam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n cam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // Camera for recording loc info before reset\n lastCam = createCamera();\n lastCam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n lastCam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n // Camera for recording the initial state\n initialCam = createCamera();\n initialCam.camera(0, 0, 50*sqrt(3), 0, 0, 0, 0, 1, 0);\n initialCam.perspective(PI/3, 1, 5*sqrt(3), 500*sqrt(3));\n\n setCamera(cam); // set main camera\n}\n\nfunction draw() {\n if (countForReset < 30) {\n // if the reset count is less than 30,\n // it will move closer to the original camera as it increases.\n countForReset++;\n cam.slerp(lastCam, initialCam, countForReset / 30);\n } else {\n // if the count is 30,\n // you can freely move the main camera with orbitControl().\n orbitControl();\n }\n\n background(255);\n box(40);\n}\n// A double-click sets countForReset to 0 and initiates a reset.\nfunction doubleClicked() {\n if (countForReset === 30) {\n countForReset = 0;\n lastCam.set(cam);\n }\n}\n\n
    " + ], + "alt": "Prepare two cameras. One camera is facing straight ahead to the cube and the other\ncamera is in the same position and looking straight to the right.\nIf you use a camera which interpolates these with slerp(), the facing direction\nof the camera will change smoothly between the front and the right.\nThere is a camera, drawing a cube. The camera can be moved freely with\norbitControl(). Double-click to smoothly return the camera to its initial state.\nThe camera cannot be moved during that time.", + "overloads": [ + { + "params": [ + { + "name": "cam0", + "description": "first p5.Camera", + "type": "p5.Camera" + }, + { + "name": "cam1", + "description": "second p5.Camera", + "type": "p5.Camera" + }, + { + "name": "amt", + "description": "amount to use for interpolation during slerp", + "type": "Number" + } + ] + } + ], + "class": "p5.Camera", + "static": false, + "module": "3D", + "submodule": "Camera" + }, + { + "name": "resize", + "file": "src/webgl/p5.Framebuffer.js", + "line": 205, + "itemtype": "method", + "description": "Resizes the framebuffer to the given width and height.", + "example": [ + "
    \n\nlet framebuffer;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n framebuffer = createFramebuffer();\n noStroke();\n}\n\nfunction mouseMoved() {\n framebuffer.resize(\n max(20, mouseX),\n max(20, mouseY)\n );\n}\n\nfunction draw() {\n // Draw to the framebuffer\n framebuffer.begin();\n background(255);\n normalMaterial();\n sphere(20);\n framebuffer.end();\n\n background(100);\n // Draw the framebuffer to the main canvas\n image(framebuffer, -width/2, -height/2);\n}\n\n
    " + ], + "alt": "A red, green, and blue sphere is drawn in the middle of a white rectangle\nwhich starts in the top left of the canvas and whose bottom right is at\nthe user's mouse", + "overloads": [ + { + "params": [ + { + "name": "width", + "type": "Number" + }, + { + "name": "height", + "type": "Number" + } + ] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "pixelDensity", + "file": "src/webgl/p5.Framebuffer.js", + "line": 223, + "itemtype": "method", + "description": "

    Gets or sets the pixel scaling for high pixel density displays. By\ndefault, the density will match that of the canvas the framebuffer was\ncreated on, which will match the display density.

    \n

    Call this method with no arguments to get the current density, or pass\nin a number to set the density.

    \n", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "density", + "description": "A scaling factor for the number of pixels per\nside of the framebuffer", + "optional": 1, + "type": "Number" + } + ] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "autoSized", + "file": "src/webgl/p5.Framebuffer.js", + "line": 243, + "itemtype": "method", + "description": "

    Gets or sets whether or not this framebuffer will automatically resize\nalong with the canvas it's attached to in order to match its size.

    \n

    Call this method with no arguments to see if it is currently auto-sized,\nor pass in a boolean to set this property.

    \n", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "autoSized", + "description": "Whether or not the framebuffer should resize\nalong with the canvas it's attached to", + "optional": 1, + "type": "Boolean" + } + ] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "createCamera", + "file": "src/webgl/p5.Framebuffer.js", + "line": 681, + "itemtype": "method", + "description": "Creates and returns a new\np5.FramebufferCamera to be used\nwhile drawing to this framebuffer. The camera will be set as the\ncurrently active camera.", + "example": [], + "overloads": [ + { + "params": [], + "return": { + "description": "A new camera", + "type": "p5.Camera" + } + } + ], + "return": { + "description": "A new camera", + "type": "p5.Camera" + }, + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "remove", + "file": "src/webgl/p5.Framebuffer.js", + "line": 745, + "itemtype": "method", + "description": "Removes the framebuffer and frees its resources.", + "example": [ + "
    \n\nlet framebuffer;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n const useFramebuffer = (frameCount % 120) > 60;\n if (useFramebuffer && !framebuffer) {\n // Create a new framebuffer for us to use\n framebuffer = createFramebuffer();\n } else if (!useFramebuffer && framebuffer) {\n // Free the old framebuffer's resources\n framebuffer.remove();\n framebuffer = undefined;\n }\n\n background(255);\n if (useFramebuffer) {\n // Draw to the framebuffer\n framebuffer.begin();\n background(255);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n fill(255, 0, 0);\n box(30);\n framebuffer.end();\n\n image(framebuffer, -width/2, -height/2);\n }\n}\n\n
    " + ], + "alt": "A rotating red cube blinks on and off every second.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "begin", + "file": "src/webgl/p5.Framebuffer.js", + "line": 803, + "itemtype": "method", + "description": "Begin drawing to this framebuffer. Subsequent drawing functions to the\ncanvas the framebuffer is attached to will not be immediately visible, and\nwill instead be drawn to the framebuffer's texture. Call\nend() when finished to make draw\nfunctions go right to the canvas again and to be able to read the\ncontents of the framebuffer's texture.", + "example": [ + "
    \n\nlet framebuffer;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n framebuffer = createFramebuffer();\n noStroke();\n}\n\nfunction draw() {\n // Draw to the framebuffer\n framebuffer.begin();\n background(255);\n translate(0, 10*sin(frameCount * 0.01), 0);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n fill(255, 0, 0);\n box(50);\n framebuffer.end();\n\n background(100);\n // Draw the framebuffer to the main canvas\n image(framebuffer, -50, -50, 25, 25);\n image(framebuffer, 0, 0, 35, 35);\n}\n\n
    " + ], + "alt": "A video of a floating and rotating red cube is pasted twice on the\ncanvas: once in the top left, and again, larger, in the bottom right.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "end", + "file": "src/webgl/p5.Framebuffer.js", + "line": 892, + "itemtype": "method", + "description": "After having previously called\nbegin(), this method stops drawing\nfunctions from going to the framebuffer's texture, allowing them to go\nright to the canvas again. After this, one can read from the framebuffer's\ntexture.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "draw", + "file": "src/webgl/p5.Framebuffer.js", + "line": 955, + "itemtype": "method", + "description": "Run a function while drawing to the framebuffer rather than to its canvas.\nThis is equivalent to calling framebuffer.begin(), running the function,\nand then calling framebuffer.end(), but ensures that one never\naccidentally forgets begin or end.", + "example": [ + "
    \n\nlet framebuffer;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n framebuffer = createFramebuffer();\n noStroke();\n}\n\nfunction draw() {\n // Draw to the framebuffer\n framebuffer.draw(function() {\n background(255);\n translate(0, 10*sin(frameCount * 0.01), 0);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n fill(255, 0, 0);\n box(50);\n });\n\n background(100);\n // Draw the framebuffer to the main canvas\n image(framebuffer, -50, -50, 25, 25);\n image(framebuffer, 0, 0, 35, 35);\n}\n\n
    " + ], + "alt": "A video of a floating and rotating red cube is pasted twice on the\ncanvas: once in the top left, and again, larger, in the bottom right.", + "overloads": [ + { + "params": [ + { + "name": "callback", + "description": "A function to run that draws to the canvas. The\nfunction will immediately be run, but it will draw to the framebuffer\ninstead of the canvas.", + "type": "Function" + } + ] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "loadPixels", + "file": "src/webgl/p5.Framebuffer.js", + "line": 967, + "itemtype": "method", + "description": "Call this befpre updating pixels\nand calling updatePixels\nto replace the content of the framebuffer with the data in the pixels\narray.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "get", + "file": "src/webgl/p5.Framebuffer.js", + "line": 1018, + "itemtype": "method", + "description": "

    Get a region of pixels from the canvas in the form of a\np5.Image, or a single pixel as an array of\nnumbers.

    \n

    Returns an array of [R,G,B,A] values for any pixel or grabs a section of\nan image. If the Framebuffer has been set up to not store alpha values, then\nonly [R,G,B] will be returned. If no parameters are specified, the entire\nimage is returned.\nUse the x and y parameters to get the value of one pixel. Get a section of\nthe display window by specifying additional w and h parameters. When\ngetting an image, the x and y parameters define the coordinates for the\nupper-left corner of the image, regardless of the current imageMode().

    \n", + "example": [], + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "x-coordinate of the pixel", + "type": "Number" + }, + { + "name": "y", + "description": "y-coordinate of the pixel", + "type": "Number" + }, + { + "name": "w", + "description": "width of the section to be returned", + "type": "Number" + }, + { + "name": "h", + "description": "height of the section to be returned", + "type": "Number" + } + ], + "return": { + "description": "the rectangle p5.Image", + "type": "p5.Image" + } + }, + { + "params": [], + "return": { + "description": "the whole p5.Image", + "type": "p5.Image" + } + }, + { + "params": [ + { + "name": "x", + "type": "Number" + }, + { + "name": "y", + "type": "Number" + } + ], + "return": { + "description": "color of pixel at x,y in array format [R, G, B, A]", + "type": "Number[]" + } + } + ], + "return": { + "description": "the rectangle p5.Image", + "type": "p5.Image" + }, + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "updatePixels", + "file": "src/webgl/p5.Framebuffer.js", + "line": 1168, + "itemtype": "method", + "description": "

    Call this after initially calling \nloadPixels() and updating pixels\nto replace the content of the framebuffer with the data in the pixels\narray.

    \n

    This will also clear the depth buffer so that any future drawing done\nafterwards will go on top.

    \n", + "example": [ + "
    \n\nlet framebuffer;\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n framebuffer = createFramebuffer();\n}\n\nfunction draw() {\n noStroke();\n lights();\n\n // Draw a sphere to the framebuffer\n framebuffer.begin();\n background(0);\n sphere(25);\n framebuffer.end();\n\n // Load its pixels and draw a gradient over the lower half of the canvas\n framebuffer.loadPixels();\n for (let y = height/2; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const idx = (y * width + x) * 4;\n framebuffer.pixels[idx] = (x / width) * 255;\n framebuffer.pixels[idx + 1] = (y / height) * 255;\n framebuffer.pixels[idx + 2] = 255;\n framebuffer.pixels[idx + 3] = 255;\n }\n }\n framebuffer.updatePixels();\n\n // Draw a cube on top of the pixels we just wrote\n framebuffer.begin();\n push();\n translate(20, 20);\n rotateX(0.5);\n rotateY(0.5);\n box(20);\n pop();\n framebuffer.end();\n\n image(framebuffer, -width/2, -height/2);\n noLoop();\n}\n\n
    " + ], + "alt": "A sphere partly occluded by a gradient from cyan to white to magenta on\nthe lower half of the canvas, with a 3D cube drawn on top of that in the\nlower right corner.", + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Framebuffer", + "static": false, + "module": "Rendering" + }, + { + "name": "clearColors", + "file": "src/webgl/p5.Geometry.js", + "line": 138, + "itemtype": "method", + "description": "Removes the internal colors of p5.Geometry.\nUsing clearColors(), you can use fill() to supply new colors before drawing each shape.\nIf clearColors() is not used, the shapes will use their internal colors by ignoring fill().", + "example": [ + "
    \n\nlet shape01;\nlet shape02;\nlet points = [];\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n points.push(new p5.Vector(-1, -1, 0), new p5.Vector(-1, 1, 0),\n new p5.Vector(1, -1, 0), new p5.Vector(-1, -1, 0));\n buildShape01();\n buildShape02();\n}\nfunction draw() {\n background(0);\n fill('pink'); // shape01 retains its internal blue color, so it won't turn pink.\n model(shape01);\n fill('yellow'); // Now, shape02 is yellow.\n model(shape02);\n}\n\nfunction buildShape01() {\n beginGeometry();\n fill('blue'); // shape01's color is blue because its internal colors remain.\n beginShape();\n for (let vec of points) vertex(vec.x * 100, vec.y * 100, vec.z * 100);\n endShape(CLOSE);\n shape01 = endGeometry();\n}\n\nfunction buildShape02() {\n beginGeometry();\n fill('red'); // shape02.clearColors() removes its internal colors. Now, shape02 is red.\n beginShape();\n for (let vec of points) vertex(vec.x * 200, vec.y * 200, vec.z * 200);\n endShape(CLOSE);\n shape02 = endGeometry();\n shape02.clearColors(); // Resets shape02's colors.\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "computeFaces", + "file": "src/webgl/p5.Geometry.js", + "line": 290, + "itemtype": "method", + "chainable": 1, + "description": "computes faces for geometry objects based on the vertices.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "computeNormals", + "file": "src/webgl/p5.Geometry.js", + "line": 423, + "itemtype": "method", + "chainable": 1, + "description": "

    This function calculates normals for each face, where each vertex's normal is the average of the normals of all faces it's connected to.\ni.e computes smooth normals per vertex as an average of each face.

    \n

    When using FLAT shading, vertices are disconnected/duplicated i.e each face has its own copy of vertices.\nWhen using SMOOTH shading, vertices are connected/deduplicated i.e each face has its vertices shared with other faces.

    \n

    Options can include:

    \n
    • roundToPrecision: Precision value for rounding computations. Defaults to 3.
    ", + "example": [ + "
    \n\nlet helix;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n\n helix = buildGeometry(() => {\n beginShape();\n\n for (let i = 0; i < TWO_PI * 3; i += 0.6) {\n let radius = 20;\n let x = cos(i) * radius;\n let y = sin(i) * radius;\n let z = map(i, 0, TWO_PI * 3, -30, 30);\n vertex(x, y, z);\n }\n endShape();\n });\n helix.computeNormals();\n}\nfunction draw() {\n background(255);\n stroke(0);\n fill(150, 200, 250);\n lights();\n rotateX(PI*0.2);\n orbitControl();\n model(helix);\n}\n\n
    ", + "
    \n\nlet star;\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n\n star = buildGeometry(() => {\n beginShape();\n for (let i = 0; i < TWO_PI; i += PI / 5) {\n let outerRadius = 60;\n let innerRadius = 30;\n let xOuter = cos(i) * outerRadius;\n let yOuter = sin(i) * outerRadius;\n let zOuter = random(-20, 20);\n vertex(xOuter, yOuter, zOuter);\n\n let nextI = i + PI / 5 / 2;\n let xInner = cos(nextI) * innerRadius;\n let yInner = sin(nextI) * innerRadius;\n let zInner = random(-20, 20);\n vertex(xInner, yInner, zInner);\n }\n endShape(CLOSE);\n });\n star.computeNormals(SMOOTH);\n}\nfunction draw() {\n background(255);\n stroke(0);\n fill(150, 200, 250);\n lights();\n rotateX(PI*0.2);\n orbitControl();\n model(star);\n}\n\n
    " + ], + "alt": "A 3D helix using the computeNormals() function by default uses `FLAT` to create a flat shading effect on the helix.\nA star-like geometry, here the computeNormals(SMOOTH) is applied for a smooth shading effect.\nThis helps to avoid the faceted appearance that can occur with flat shading.", + "overloads": [ + { + "params": [ + { + "name": "shadingType", + "description": "shading type (FLAT for flat shading or SMOOTH for smooth shading) for buildGeometry() outputs. Defaults to FLAT.", + "optional": 1, + "type": "String" + }, + { + "name": "options", + "description": "An optional object with configuration.", + "optional": 1, + "type": "Object" + } + ] + } + ], + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "averageNormals", + "file": "src/webgl/p5.Geometry.js", + "line": 503, + "itemtype": "method", + "chainable": 1, + "description": "Averages the vertex normals. Used in curved\nsurfaces", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "averagePoleNormals", + "file": "src/webgl/p5.Geometry.js", + "line": 522, + "itemtype": "method", + "chainable": 1, + "description": "Averages pole normals. Used in spherical primitives", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "normalize", + "file": "src/webgl/p5.Geometry.js", + "line": 831, + "itemtype": "method", + "chainable": 1, + "description": "Modifies all vertices to be centered within the range -100 to 100.", + "example": [], + "overloads": [ + { + "params": [] + } + ], + "class": "p5.Geometry", + "static": false, + "module": "Shape", + "submodule": "3D Primitives" + }, + { + "name": "copyToContext", + "file": "src/webgl/p5.Shader.js", + "line": 127, + "itemtype": "method", + "description": "

    Shaders belong to the main canvas or a p5.Graphics. Once they are compiled,\nthey can only be used in the context they were compiled on.

    \n

    Use this method to make a new copy of a shader that gets compiled on a\ndifferent context.

    \n", + "example": [ + "
    \n\nlet graphic = createGraphics(200, 200, WEBGL);\nlet graphicShader = graphic.createShader(vert, frag);\ngraphic.shader(graphicShader); // Use graphicShader on the graphic\n\nlet mainShader = graphicShader.copyToContext(window);\nshader(mainShader); // Use `mainShader` on the main canvas\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "context", + "description": "The graphic or instance to copy this shader to.\nPass window if you need to copy to the main canvas.", + "type": "p5|p5.Graphics" + } + ], + "return": { + "description": "A new shader on the target context.", + "type": "p5.Shader" + } + } + ], + "return": { + "description": "A new shader on the target context.", + "type": "p5.Shader" + }, + "class": "p5.Shader", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "setUniform", + "file": "src/webgl/p5.Shader.js", + "line": 438, + "itemtype": "method", + "chainable": 1, + "description": "

    Used to set the uniforms of a\np5.Shader object.

    \n

    Uniforms are used as a way to provide shader programs\n(which run on the GPU) with values from a sketch\n(which runs on the CPU).

    \n

    Here are some examples of uniforms you can make:

    \n
    • booleans

      \n
      • Example: setUniform('x', true) becomes uniform float x with the value 1.0
    • numbers

      \n
      • Example: setUniform('x', -2) becomes uniform float x with the value -2.0
    • arrays of numbers

      \n
      • Example: setUniform('x', [0, 0.5, 1]) becomes uniform vec3 x with the value vec3(0.0, 0.5, 1.0)
    • a p5.Image, p5.Graphics, p5.MediaElement, or p5.Texture

      \n
      • Example: setUniform('x', img) becomes uniform sampler2D x
    ", + "example": [ + "
    \n\n// Click within the image to toggle the value of uniforms\n// Note: for an alternative approach to the same example,\n// involving toggling between shaders please refer to:\n// https://p5js.org/reference/#/p5/shader\n\nlet grad;\nlet showRedGreen = false;\n\nfunction preload() {\n // note that we are using two instances\n // of the same vertex and fragment shaders\n grad = loadShader('assets/shader.vert', 'assets/shader-gradient.frag');\n}\n\nfunction setup() {\n createCanvas(100, 100, WEBGL);\n shader(grad);\n noStroke();\n\n describe(\n 'canvas toggles between a circular gradient of orange and blue vertically. and a circular gradient of red and green moving horizontally when mouse is clicked/pressed.'\n );\n}\n\nfunction draw() {\n // update the offset values for each scenario,\n // moving the \"grad\" shader in either vertical or\n // horizontal direction each with differing colors\n\n if (showRedGreen === true) {\n grad.setUniform('colorCenter', [1, 0, 0]);\n grad.setUniform('colorBackground', [0, 1, 0]);\n grad.setUniform('offset', [sin(millis() / 2000), 1]);\n } else {\n grad.setUniform('colorCenter', [1, 0.5, 0]);\n grad.setUniform('colorBackground', [0.226, 0, 0.615]);\n grad.setUniform('offset', [0, sin(millis() / 2000) + 1]);\n }\n quad(-1, -1, 1, -1, 1, 1, -1, 1);\n}\n\nfunction mouseClicked() {\n showRedGreen = !showRedGreen;\n}\n\n
    " + ], + "alt": "canvas toggles between a circular gradient of orange and blue vertically. and a circular gradient of red and green moving horizontally when mouse is clicked/pressed.", + "overloads": [ + { + "params": [ + { + "name": "uniformName", + "description": "the name of the uniform.\nMust correspond to the name used in the vertex and fragment shaders", + "type": "String" + }, + { + "name": "data", + "description": "The value to assign to the uniform. This can be\na boolean (true/false), a number, an array of numbers, or\nan image (p5.Image, p5.Graphics, p5.MediaElement, p5.Texture)", + "type": "Boolean|Number|Number[]|p5.Image|p5.Graphics|p5.MediaElement|p5.Texture" + } + ] + } + ], + "class": "p5.Shader", + "static": false, + "module": "3D", + "submodule": "Material" + }, + { + "name": "remove", + "file": "src/core/main.js", + "line": 341, + "itemtype": "method", + "description": "Removes the entire p5 sketch. This will remove the canvas and any\nelements created by p5.js. It will also stop the draw loop and unbind\nany properties or methods from the window global scope. It will\nleave a variable p5 in case you wanted to create a new p5 sketch.\nIf you like, you can set p5 = null to erase it. While all functions and\nvariables and objects created by the p5 library will be removed, any\nother global variables created by your code will remain.", + "example": [ + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    ", + "
    \nfunction draw() {\n ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n remove(); // remove whole sketch on mouse press\n}\n
    " + ], + "alt": "nothing displayed", + "overloads": [ + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "Structure", + "submodule": "Structure" + }, + { + "name": "createSlider", + "file": "src/dom/dom.js", + "line": 827, + "itemtype": "method", + "description": "INPUT *", + "example": [], + "overloads": [ + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "createAudio", + "file": "src/dom/dom.js", + "line": 2080, + "itemtype": "method", + "description": "AUDIO STUFF *", + "example": [], + "overloads": [ + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + } + ], + "class": "p5", + "static": false, + "module": "DOM", + "submodule": "DOM" + }, + { + "name": "addRow", + "file": "src/io/p5.Table.js", + "line": 95, + "itemtype": "method", + "description": "

    Use addRow() to add a new row of data to a p5.Table object. By default,\nan empty row is created. Typically, you would store a reference to\nthe new row in a TableRow object (see newRow in the example above),\nand then set individual values using set().

    \n

    If a p5.TableRow object is included as a parameter, then that row is\nduplicated and added to the table.

    \n", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "row", + "description": "row to be added to the table", + "optional": 1, + "type": "p5.TableRow" + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + } + } + ], + "return": { + "description": "the row that was added", + "type": "p5.TableRow" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "removeRow", + "file": "src/io/p5.Table.js", + "line": 146, + "itemtype": "method", + "description": "Removes a row from the table object.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //remove the first row\n table.removeRow(0);\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "id", + "description": "ID number of the row to remove", + "type": "Integer" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getRow", + "file": "src/io/p5.Table.js", + "line": 192, + "itemtype": "method", + "description": "Returns a reference to the specified p5.TableRow. The reference\ncan then be used to get and set values of the selected row.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let row = table.getRow(1);\n //print it column by column\n //note: a row is an object, not an array\n for (let c = 0; c < table.getColumnCount(); c++) {\n print(row.getString(c));\n }\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "rowID", + "description": "ID number of the row to get", + "type": "Integer" + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + } + } + ], + "return": { + "description": "p5.TableRow object", + "type": "p5.TableRow" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getRows", + "file": "src/io/p5.Table.js", + "line": 238, + "itemtype": "method", + "description": "Gets all rows from the table. Returns an array of p5.TableRows.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + }, + { + "params": [], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + } + } + ], + "return": { + "description": "Array of p5.TableRows", + "type": "p5.TableRow[]" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "findRow", + "file": "src/io/p5.Table.js", + "line": 283, + "itemtype": "method", + "description": "Finds the first row in the Table that contains the value\nprovided, and returns a reference to that row. Even if\nmultiple rows are possible matches, only the first matching\nrow is returned. The column to search may be specified by\neither its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //find the animal named zebra\n let row = table.findRow('Zebra', 'name');\n //find the corresponding species\n print(row.getString('species'));\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + } + } + ], + "return": { + "description": "", + "type": "p5.TableRow" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "findRows", + "file": "src/io/p5.Table.js", + "line": 349, + "itemtype": "method", + "description": "Finds the rows in the Table that contain the value\nprovided, and returns references to those rows. Returns an\nArray, so for must be used to iterate through all the rows,\nas shown in the example above. The column to search may be\nspecified by either its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "value", + "description": "The value to match", + "type": "String" + }, + { + "name": "column", + "description": "ID number or title of the\ncolumn to search", + "type": "Integer|String" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "matchRow", + "file": "src/io/p5.Table.js", + "line": 408, + "itemtype": "method", + "description": "Finds the first row in the Table that matches the regular\nexpression provided, and returns a reference to that row.\nEven if multiple rows are possible matches, only the first\nmatching row is returned. The column to search may be\nspecified by either its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //Search using specified regex on a given column, return TableRow object\n let mammal = table.matchRow(new RegExp('ant'), 1);\n print(mammal.getString(1));\n //Output \"Panthera pardus\"\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "type": "String|Integer" + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + } + } + ], + "return": { + "description": "TableRow object", + "type": "p5.TableRow" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "matchRows", + "file": "src/io/p5.Table.js", + "line": 473, + "itemtype": "method", + "description": "Finds the rows in the Table that match the regular expression provided,\nand returns references to those rows. Returns an array, so for must be\nused to iterate through all the rows, as shown in the example. The\ncolumn to search may be specified by either its ID or title.", + "example": [ + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    ", + "
    \n\nlet table;\n\nfunction setup() {\n table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', 'Lion');\n newRow.setString('type', 'Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', 'Snake');\n newRow.setString('type', 'Reptile');\n\n newRow = table.addRow();\n newRow.setString('name', 'Mosquito');\n newRow.setString('type', 'Insect');\n\n newRow = table.addRow();\n newRow.setString('name', 'Lizard');\n newRow.setString('type', 'Reptile');\n\n let rows = table.matchRows('R.*', 'type');\n for (let i = 0; i < rows.length; i++) {\n print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + }, + { + "params": [ + { + "name": "regexp", + "description": "The regular expression to match", + "type": "String" + }, + { + "name": "column", + "description": "The column ID (number) or\ntitle (string)", + "optional": 1, + "type": "String|Integer" + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + } + } + ], + "return": { + "description": "An Array of TableRow objects", + "type": "p5.TableRow[]" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getColumn", + "file": "src/io/p5.Table.js", + "line": 526, + "itemtype": "method", + "description": "Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn('species'));\n //outputs [\"Capra hircus\", \"Panthera pardus\", \"Equus zebra\"]\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + }, + { + "params": [ + { + "name": "column", + "description": "String or Number of the column to return", + "type": "String|Number" + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + } + } + ], + "return": { + "description": "Array of column values", + "type": "Array" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "clearRows", + "file": "src/io/p5.Table.js", + "line": 572, + "itemtype": "method", + "description": "Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + }, + { + "params": [] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "addColumn", + "file": "src/io/p5.Table.js", + "line": 620, + "itemtype": "method", + "description": "Use addColumn() to add a new column to a Table object.\nTypically, you will want to specify a title, so the column\nmay be easily referenced later by name. (If no title is\nspecified, the new column's title will be null.)", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "title", + "description": "title of the given column", + "optional": 1, + "type": "String" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getColumnCount", + "file": "src/io/p5.Table.js", + "line": 656, + "itemtype": "method", + "description": "Returns the total number of columns in a Table.", + "example": [ + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + } + } + ], + "return": { + "description": "Number of columns in this table", + "type": "Integer" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getRowCount", + "file": "src/io/p5.Table.js", + "line": 691, + "itemtype": "method", + "description": "Returns the total number of rows in a Table.", + "example": [ + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    ", + "
    \n\n// given the cvs file \"blobs.csv\" in /assets directory\n//\n// ID, Name, Flavor, Shape, Color\n// Blob1, Blobby, Sweet, Blob, Pink\n// Blob2, Saddy, Savory, Blob, Blue\n\nlet table;\n\nfunction preload() {\n table = loadTable('assets/blobs.csv');\n}\n\nfunction setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n}\n\nfunction draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + }, + { + "params": [], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + } + } + ], + "return": { + "description": "Number of rows in this table", + "type": "Integer" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "removeTokens", + "file": "src/io/p5.Table.js", + "line": 731, + "itemtype": "method", + "description": "

    Removes any of the specified characters (or \"tokens\").

    \n

    If no column is specified, then the values in all columns and\nrows are processed. A specific column may be referenced by\neither its ID or title.

    \n", + "example": [ + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' $Lion ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "chars", + "description": "String listing characters to be removed", + "type": "String" + }, + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "trim", + "file": "src/io/p5.Table.js", + "line": 799, + "itemtype": "method", + "description": "Trims leading and trailing whitespace, such as spaces and tabs,\nfrom String table values. If no column is specified, then the\nvalues in all columns and rows are trimmed. A specific column\nmay be referenced by either its ID or title.", + "example": [ + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    ", + "
    \nfunction setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', ' Lion ,');\n newRow.setString('type', ' Mammal ');\n\n newRow = table.addRow();\n newRow.setString('name', ' Snake ');\n newRow.setString('type', ' Reptile ');\n\n table.trim();\n print(table.getArray());\n}\n\n// prints:\n// 0 \"Lion\" \"Mamal\"\n// 1 \"Snake\" \"Reptile\"\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "Column ID (number)\nor name (string)", + "optional": 1, + "type": "String|Integer" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "removeColumn", + "file": "src/io/p5.Table.js", + "line": 865, + "itemtype": "method", + "description": "Use removeColumn() to remove an existing column from a Table\nobject. The column to be removed may be identified by either\nits title (a String) or its index value (an int).\nremoveColumn(0) would remove the first column, removeColumn(1)\nwould remove the second column, and so on.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + }, + { + "params": [ + { + "name": "column", + "description": "columnName (string) or ID (number)", + "type": "String|Integer" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "set", + "file": "src/io/p5.Table.js", + "line": 933, + "itemtype": "method", + "description": "Stores a value in the Table's specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.set(0, 'species', 'Canis Lupus');\n table.set(0, 'name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n for (let c = 0; c < table.getColumnCount(); c++)\n print(table.getString(r, c));\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String|Number" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "setNum", + "file": "src/io/p5.Table.js", + "line": 977, + "itemtype": "method", + "description": "Stores a Float value in the Table's specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n table.setNum(1, 'id', 1);\n\n print(table.getColumn(0));\n //[\"0\", 1, \"2\"]\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "Number" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "setString", + "file": "src/io/p5.Table.js", + "line": 1020, + "itemtype": "method", + "description": "Stores a String value in the Table's specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.", + "example": [ + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    ", + "
    \n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n print(table.getArray());\n\n describe('no image displayed');\n}\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "column ID (Number)\nor title (String)", + "type": "String|Integer" + }, + { + "name": "value", + "description": "value to assign", + "type": "String" + } + ] + } + ], + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "get", + "file": "src/io/p5.Table.js", + "line": 1063, + "itemtype": "method", + "description": "Retrieves a value from the Table's specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, 'species'));\n //Capra hircus\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String|Number" + } + } + ], + "return": { + "description": "", + "type": "String|Number" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getNum", + "file": "src/io/p5.Table.js", + "line": 1104, + "itemtype": "method", + "description": "Retrieves a Float value from the Table's specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "Number" + } + } + ], + "return": { + "description": "", + "type": "Number" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getString", + "file": "src/io/p5.Table.js", + "line": 1153, + "itemtype": "method", + "description": "Retrieves a String value from the Table's specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n print(table.getString(0, 0)); // 0\n print(table.getString(0, 1)); // Capra hircus\n print(table.getString(0, 2)); // Goat\n print(table.getString(1, 0)); // 1\n print(table.getString(1, 1)); // Panthera pardus\n print(table.getString(1, 2)); // Leopard\n print(table.getString(2, 0)); // 2\n print(table.getString(2, 1)); // Equus zebra\n print(table.getString(2, 2)); // Zebra\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + }, + { + "params": [ + { + "name": "row", + "description": "row ID", + "type": "Integer" + }, + { + "name": "column", + "description": "columnName (string) or\nID (number)", + "type": "String|Integer" + } + ], + "return": { + "description": "", + "type": "String" + } + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getObject", + "file": "src/io/p5.Table.js", + "line": 1196, + "itemtype": "method", + "description": "Retrieves all table data and returns as an object. If a column name is\npassed in, each row object will be stored with that attribute as its\ntitle.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableObject = table.getObject();\n\n print(tableObject);\n //outputs an object\n\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + }, + { + "params": [ + { + "name": "headerColumn", + "description": "Name of the column which should be used to\ntitle each row object (optional)", + "optional": 1, + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + } + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + }, + { + "name": "getArray", + "file": "src/io/p5.Table.js", + "line": 1252, + "itemtype": "method", + "description": "Retrieves all table data and returns it as a multidimensional array.", + "example": [ + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    ", + "
    \n\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n // table is comma separated value \"CSV\"\n // and has specifiying header for column labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n let tableArray = table.getArray();\n for (let i = 0; i < tableArray.length; i++) {\n print(tableArray[i]);\n }\n describe('no image displayed');\n}\n\n
    " + ], + "overloads": [ + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + }, + { + "params": [], + "return": { + "description": "", + "type": "Array" + } + } + ], + "return": { + "description": "", + "type": "Array" + }, + "class": "p5.Table", + "static": false, + "module": "IO", + "submodule": "Table" + } + ], + "warnings": [], + "consts": { + "namedColors": [], + "WHITESPACE": [], + "colorPatterns": [], + "VERSION": [], + "P2D": [], + "WEBGL": [], + "WEBGL2": [], + "ARROW": [], + "CROSS": [], + "HAND": [], + "MOVE": [], + "TEXT": [], + "WAIT": [], + "HALF_PI": [], + "PI": [], + "QUARTER_PI": [], + "TAU": [], + "TWO_PI": [], + "DEGREES": [], + "RADIANS": [], + "CORNER": [], + "CORNERS": [], + "RADIUS": [], + "RIGHT": [], + "LEFT": [], + "CENTER": [], + "TOP": [], + "BOTTOM": [], + "BASELINE": [], + "POINTS": [ + "p5.beginShape" + ], + "LINES": [ + "p5.beginShape" + ], + "LINE_STRIP": [], + "LINE_LOOP": [], + "TRIANGLES": [ + "p5.beginShape" + ], + "TRIANGLE_FAN": [ + "p5.beginShape" + ], + "TRIANGLE_STRIP": [ + "p5.beginShape" + ], + "QUADS": [ + "p5.beginShape" + ], + "QUAD_STRIP": [ + "p5.beginShape" + ], + "TESS": [ + "p5.beginShape" + ], + "CLOSE": [ + "p5.endShape" + ], + "OPEN": [], + "CHORD": [], + "PIE": [], + "PROJECT": [], + "SQUARE": [], + "ROUND": [], + "BEVEL": [], + "MITER": [], + "RGB": [], + "HSB": [], + "HSL": [], + "AUTO": [], + "ALT": [], + "BACKSPACE": [], + "CONTROL": [], + "DELETE": [], + "DOWN_ARROW": [], + "ENTER": [], + "ESCAPE": [], + "LEFT_ARROW": [], + "OPTION": [], + "RETURN": [], + "RIGHT_ARROW": [], + "SHIFT": [], + "TAB": [], + "UP_ARROW": [], + "BLEND": [], + "REMOVE": [], + "ADD": [], + "DARKEST": [], + "LIGHTEST": [], + "DIFFERENCE": [], + "SUBTRACT": [], + "EXCLUSION": [], + "MULTIPLY": [], + "SCREEN": [], + "REPLACE": [], + "OVERLAY": [], + "HARD_LIGHT": [], + "SOFT_LIGHT": [], + "DODGE": [], + "BURN": [], + "THRESHOLD": [], + "GRAY": [], + "OPAQUE": [], + "INVERT": [], + "POSTERIZE": [], + "DILATE": [], + "ERODE": [], + "BLUR": [], + "NORMAL": [], + "ITALIC": [], + "BOLD": [], + "BOLDITALIC": [], + "CHAR": [], + "WORD": [], + "LINEAR": [], + "QUADRATIC": [], + "BEZIER": [], + "CURVE": [], + "STROKE": [], + "FILL": [], + "TEXTURE": [], + "IMMEDIATE": [], + "IMAGE": [], + "NEAREST": [], + "REPEAT": [], + "CLAMP": [], + "MIRROR": [], + "FLAT": [], + "SMOOTH": [], + "LANDSCAPE": [], + "PORTRAIT": [], + "GRID": [], + "AXES": [], + "LABEL": [], + "FALLBACK": [], + "CONTAIN": [], + "COVER": [], + "UNSIGNED_BYTE": [], + "UNSIGNED_INT": [], + "FLOAT": [], + "HALF_FLOAT": [], + "RGBA": [], + "initialize": [], + "availableTranslatorLanguages": [], + "currentTranslatorLanguage": [], + "setTranslatorLanguage": [], + "languages": [], + "styleEmpty": [], + "Filters": [] + } +} \ No newline at end of file diff --git a/docs/parameterData.json.bak b/docs/parameterData.json.bak new file mode 100644 index 0000000000..6f10499199 --- /dev/null +++ b/docs/parameterData.json.bak @@ -0,0 +1,16154 @@ +{ + "p5": { + "describe": { + "name": "describe", + "params": [ + { + "name": "text", + "description": "

    description of the canvas.

    \n", + "type": "String" + }, + { + "name": "display", + "description": "

    either LABEL or FALLBACK.

    \n", + "type": "Constant", + "optional": true + } + ], + "class": "p5", + "module": "Environment" + }, + "describeElement": { + "name": "describeElement", + "params": [ + { + "name": "name", + "description": "

    name of the element.

    \n", + "type": "String" + }, + { + "name": "text", + "description": "

    description of the element.

    \n", + "type": "String" + }, + { + "name": "display", + "description": "

    either LABEL or FALLBACK.

    \n", + "type": "Constant", + "optional": true + } + ], + "class": "p5", + "module": "Environment" + }, + "textOutput": { + "name": "textOutput", + "params": [ + { + "name": "display", + "description": "

    either FALLBACK or LABEL.

    \n", + "type": "Constant", + "optional": true + } + ], + "class": "p5", + "module": "Environment" + }, + "gridOutput": { + "name": "gridOutput", + "params": [ + { + "name": "display", + "description": "

    either FALLBACK or LABEL.

    \n", + "type": "Constant", + "optional": true + } + ], + "class": "p5", + "module": "Environment" + }, + "alpha": { + "name": "alpha", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "blue": { + "name": "blue", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "brightness": { + "name": "brightness", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "color": { + "name": "color", + "class": "p5", + "module": "Color", + "overloads": [ + { + "params": [ + { + "name": "gray", + "description": "

    number specifying value between white and black.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "

    alpha value relative to current color range\n (default is 0-255).

    \n", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to\n the current color range.

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value\n relative to the current color range.

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value\n relative to the current color range.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "

    a color string.

    \n", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "

    an array containing the red, green, blue,\n and alpha components of the color.

    \n", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "", + "type": "p5.Color" + } + ] + } + ] + }, + "green": { + "name": "green", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "hue": { + "name": "hue", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "lerpColor": { + "name": "lerpColor", + "params": [ + { + "name": "c1", + "description": "

    interpolate from this color.

    \n", + "type": "p5.Color" + }, + { + "name": "c2", + "description": "

    interpolate to this color.

    \n", + "type": "p5.Color" + }, + { + "name": "amt", + "description": "

    number between 0 and 1.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Color" + }, + "lightness": { + "name": "lightness", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "red": { + "name": "red", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "saturation": { + "name": "saturation", + "params": [ + { + "name": "color", + "description": "

    p5.Color object, array of\n color components, or CSS color string.

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "class": "p5", + "module": "Color" + }, + "beginClip": { + "name": "beginClip", + "params": [ + { + "name": "options", + "description": "

    An object containing clip settings.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5", + "module": "Color" + }, + "endClip": { + "name": "endClip", + "class": "p5", + "module": "Color" + }, + "clip": { + "name": "clip", + "params": [ + { + "name": "callback", + "description": "

    A function that draws the mask shape.

    \n", + "type": "Function" + }, + { + "name": "options", + "description": "

    An object containing clip settings.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5", + "module": "Color" + }, + "background": { + "name": "background", + "class": "p5", + "module": "Color", + "overloads": [ + { + "params": [ + { + "name": "color", + "description": "

    any value created by the color() function

    \n", + "type": "p5.Color" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "colorstring", + "description": "

    color string, possible formats include: integer\n rgb() or rgba(), percentage rgb() or rgba(),\n 3-digit hex, 6-digit hex.

    \n", + "type": "String" + }, + { + "name": "a", + "description": "

    opacity of the background relative to current\n color range (default is 0-255).

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "gray", + "description": "

    specifies a value between white and black.

    \n", + "type": "Number" + }, + { + "name": "a", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "

    red value if color mode is RGB, or hue value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green value if color mode is RGB, or saturation value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue value if color mode is RGB, or brightness value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "a", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "values", + "description": "

    an array containing the red, green, blue\n and alpha components of the color.

    \n", + "type": "Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "image", + "description": "

    image created with loadImage()\n or createImage(),\n to set as background.\n (must be same size as the sketch window).

    \n", + "type": "p5.Image" + }, + { + "name": "a", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "clear": { + "name": "clear", + "params": [ + { + "name": "r", + "description": "

    normalized red value.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "g", + "description": "

    normalized green value.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "b", + "description": "

    normalized blue value.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "a", + "description": "

    normalized alpha value.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Color" + }, + "colorMode": { + "name": "colorMode", + "class": "p5", + "module": "Color", + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "

    either RGB, HSB or HSL, corresponding to\n Red/Green/Blue and Hue/Saturation/Brightness\n (or Lightness).

    \n", + "type": "Constant" + }, + { + "name": "max", + "description": "

    range for all values.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "mode", + "description": "", + "type": "Constant" + }, + { + "name": "max1", + "description": "

    range for the red or hue depending on the\n current color mode.

    \n", + "type": "Number" + }, + { + "name": "max2", + "description": "

    range for the green or saturation depending\n on the current color mode.

    \n", + "type": "Number" + }, + { + "name": "max3", + "description": "

    range for the blue or brightness/lightness\n depending on the current color mode.

    \n", + "type": "Number" + }, + { + "name": "maxA", + "description": "

    range for the alpha.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "fill": { + "name": "fill", + "class": "p5", + "module": "Color", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red value if color mode is RGB or hue value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green value if color mode is RGB or saturation value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue value if color mode is RGB or brightness value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    a color string.

    \n", + "type": "String" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "gray", + "description": "

    a grayscale value.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "values", + "description": "

    an array containing the red, green, blue &\n and alpha components of the color.

    \n", + "type": "Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    the fill color.

    \n", + "type": "p5.Color" + } + ], + "chainable": 1 + } + ] + }, + "noFill": { + "name": "noFill", + "class": "p5", + "module": "Color" + }, + "noStroke": { + "name": "noStroke", + "class": "p5", + "module": "Color" + }, + "stroke": { + "name": "stroke", + "class": "p5", + "module": "Color", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red value if color mode is RGB or hue value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green value if color mode is RGB or saturation value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue value if color mode is RGB or brightness value if color mode is HSB.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    a color string.

    \n", + "type": "String" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "gray", + "description": "

    a grayscale value.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "values", + "description": "

    an array containing the red, green, blue,\n and alpha components of the color.

    \n", + "type": "Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    the stroke color.

    \n", + "type": "p5.Color" + } + ], + "chainable": 1 + } + ] + }, + "erase": { + "name": "erase", + "params": [ + { + "name": "strengthFill", + "description": "

    a number (0-255) for the strength of erasing under a shape's interior.\n Defaults to 255, which is full strength.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "strengthStroke", + "description": "

    a number (0-255) for the strength of erasing under a shape's edge.\n Defaults to 255, which is full strength.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Color" + }, + "noErase": { + "name": "noErase", + "class": "p5", + "module": "Color" + }, + "arc": { + "name": "arc", + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the arc's ellipse.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the arc's ellipse.

    \n", + "type": "Number" + }, + { + "name": "w", + "description": "

    width of the arc's ellipse by default.

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the arc's ellipse by default.

    \n", + "type": "Number" + }, + { + "name": "start", + "description": "

    angle to start the arc, specified in radians.

    \n", + "type": "Number" + }, + { + "name": "stop", + "description": "

    angle to stop the arc, specified in radians.

    \n", + "type": "Number" + }, + { + "name": "mode", + "description": "

    optional parameter to determine the way of drawing\n the arc. either CHORD, PIE, or OPEN.

    \n", + "type": "Constant", + "optional": true + }, + { + "name": "detail", + "description": "

    optional parameter for WebGL mode only. This is to\n specify the number of vertices that makes up the\n perimeter of the arc. Default value is 25. Won't\n draw a stroke for a detail of more than 50.

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "ellipse": { + "name": "ellipse", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the center of the ellipse.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the center of the ellipse.

    \n", + "type": "Number" + }, + { + "name": "w", + "description": "

    width of the ellipse.

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the ellipse.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "w", + "description": "", + "type": "Number" + }, + { + "name": "h", + "description": "", + "type": "Number" + }, + { + "name": "detail", + "description": "

    optional parameter for WebGL mode only. This is to\n specify the number of vertices that makes up the\n perimeter of the ellipse. Default value is 25. Won't\n draw a stroke for a detail of more than 50.

    \n", + "type": "Integer", + "optional": true + } + ] + } + ] + }, + "circle": { + "name": "circle", + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the center of the circle.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the center of the circle.

    \n", + "type": "Number" + }, + { + "name": "d", + "description": "

    diameter of the circle.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "line": { + "name": "line", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "

    the x-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "y1", + "description": "

    the y-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "

    the x-coordinate of the second point.

    \n", + "type": "Number" + }, + { + "name": "y2", + "description": "

    the y-coordinate of the second point.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x1", + "description": "", + "type": "Number" + }, + { + "name": "y1", + "description": "", + "type": "Number" + }, + { + "name": "z1", + "description": "

    the z-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "", + "type": "Number" + }, + { + "name": "y2", + "description": "", + "type": "Number" + }, + { + "name": "z2", + "description": "

    the z-coordinate of the second point.

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "point": { + "name": "point", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    the x-coordinate.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    the y-coordinate.

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    the z-coordinate (for WebGL mode).

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "coordinateVector", + "description": "

    the coordinate vector.

    \n", + "type": "p5.Vector" + } + ], + "chainable": 1 + } + ] + }, + "quad": { + "name": "quad", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "

    the x-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "y1", + "description": "

    the y-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "

    the x-coordinate of the second point.

    \n", + "type": "Number" + }, + { + "name": "y2", + "description": "

    the y-coordinate of the second point.

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "

    the x-coordinate of the third point.

    \n", + "type": "Number" + }, + { + "name": "y3", + "description": "

    the y-coordinate of the third point.

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "

    the x-coordinate of the fourth point.

    \n", + "type": "Number" + }, + { + "name": "y4", + "description": "

    the y-coordinate of the fourth point.

    \n", + "type": "Number" + }, + { + "name": "detailX", + "description": "

    number of segments in the x-direction.

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    number of segments in the y-direction.

    \n", + "type": "Integer", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x1", + "description": "", + "type": "Number" + }, + { + "name": "y1", + "description": "", + "type": "Number" + }, + { + "name": "z1", + "description": "

    the z-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "", + "type": "Number" + }, + { + "name": "y2", + "description": "", + "type": "Number" + }, + { + "name": "z2", + "description": "

    the z-coordinate of the second point.

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "", + "type": "Number" + }, + { + "name": "y3", + "description": "", + "type": "Number" + }, + { + "name": "z3", + "description": "

    the z-coordinate of the third point.

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "", + "type": "Number" + }, + { + "name": "y4", + "description": "", + "type": "Number" + }, + { + "name": "z4", + "description": "

    the z-coordinate of the fourth point.

    \n", + "type": "Number" + }, + { + "name": "detailX", + "description": "", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "", + "type": "Integer", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "rect": { + "name": "rect", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the rectangle.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the rectangle.

    \n", + "type": "Number" + }, + { + "name": "w", + "description": "

    width of the rectangle.

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the rectangle.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "tl", + "description": "

    optional radius of top-left corner.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "tr", + "description": "

    optional radius of top-right corner.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "br", + "description": "

    optional radius of bottom-right corner.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "bl", + "description": "

    optional radius of bottom-left corner.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "w", + "description": "", + "type": "Number" + }, + { + "name": "h", + "description": "", + "type": "Number" + }, + { + "name": "detailX", + "description": "

    number of segments in the x-direction (for WebGL mode).

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    number of segments in the y-direction (for WebGL mode).

    \n", + "type": "Integer", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "square": { + "name": "square", + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the square.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the square.

    \n", + "type": "Number" + }, + { + "name": "s", + "description": "

    side size of the square.

    \n", + "type": "Number" + }, + { + "name": "tl", + "description": "

    optional radius of top-left corner.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "tr", + "description": "

    optional radius of top-right corner.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "br", + "description": "

    optional radius of bottom-right corner.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "bl", + "description": "

    optional radius of bottom-left corner.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "triangle": { + "name": "triangle", + "params": [ + { + "name": "x1", + "description": "

    x-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "y1", + "description": "

    y-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "

    x-coordinate of the second point.

    \n", + "type": "Number" + }, + { + "name": "y2", + "description": "

    y-coordinate of the second point.

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "

    x-coordinate of the third point.

    \n", + "type": "Number" + }, + { + "name": "y3", + "description": "

    y-coordinate of the third point.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "ellipseMode": { + "name": "ellipseMode", + "params": [ + { + "name": "mode", + "description": "

    either CENTER, RADIUS, CORNER, or CORNERS

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "Shape" + }, + "noSmooth": { + "name": "noSmooth", + "class": "p5", + "module": "Shape" + }, + "rectMode": { + "name": "rectMode", + "params": [ + { + "name": "mode", + "description": "

    either CORNER, CORNERS, CENTER, or RADIUS

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "Shape" + }, + "smooth": { + "name": "smooth", + "class": "p5", + "module": "Shape" + }, + "strokeCap": { + "name": "strokeCap", + "params": [ + { + "name": "cap", + "description": "

    either ROUND, SQUARE, or PROJECT

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "Shape" + }, + "strokeJoin": { + "name": "strokeJoin", + "params": [ + { + "name": "join", + "description": "

    either MITER, BEVEL, or ROUND

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "Shape" + }, + "strokeWeight": { + "name": "strokeWeight", + "params": [ + { + "name": "weight", + "description": "

    the weight of the stroke (in pixels).

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "bezier": { + "name": "bezier", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "

    x-coordinate for the first anchor point

    \n", + "type": "Number" + }, + { + "name": "y1", + "description": "

    y-coordinate for the first anchor point

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "

    x-coordinate for the first control point

    \n", + "type": "Number" + }, + { + "name": "y2", + "description": "

    y-coordinate for the first control point

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "

    x-coordinate for the second control point

    \n", + "type": "Number" + }, + { + "name": "y3", + "description": "

    y-coordinate for the second control point

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "

    x-coordinate for the second anchor point

    \n", + "type": "Number" + }, + { + "name": "y4", + "description": "

    y-coordinate for the second anchor point

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x1", + "description": "", + "type": "Number" + }, + { + "name": "y1", + "description": "", + "type": "Number" + }, + { + "name": "z1", + "description": "

    z-coordinate for the first anchor point

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "", + "type": "Number" + }, + { + "name": "y2", + "description": "", + "type": "Number" + }, + { + "name": "z2", + "description": "

    z-coordinate for the first control point

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "", + "type": "Number" + }, + { + "name": "y3", + "description": "", + "type": "Number" + }, + { + "name": "z3", + "description": "

    z-coordinate for the second control point

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "", + "type": "Number" + }, + { + "name": "y4", + "description": "", + "type": "Number" + }, + { + "name": "z4", + "description": "

    z-coordinate for the second anchor point

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "bezierDetail": { + "name": "bezierDetail", + "params": [ + { + "name": "detail", + "description": "

    resolution of the curves

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "bezierPoint": { + "name": "bezierPoint", + "params": [ + { + "name": "a", + "description": "

    coordinate of first point on the curve

    \n", + "type": "Number" + }, + { + "name": "b", + "description": "

    coordinate of first control point

    \n", + "type": "Number" + }, + { + "name": "c", + "description": "

    coordinate of second control point

    \n", + "type": "Number" + }, + { + "name": "d", + "description": "

    coordinate of second point on the curve

    \n", + "type": "Number" + }, + { + "name": "t", + "description": "

    value between 0 and 1

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "bezierTangent": { + "name": "bezierTangent", + "params": [ + { + "name": "a", + "description": "

    coordinate of first point on the curve

    \n", + "type": "Number" + }, + { + "name": "b", + "description": "

    coordinate of first control point

    \n", + "type": "Number" + }, + { + "name": "c", + "description": "

    coordinate of second control point

    \n", + "type": "Number" + }, + { + "name": "d", + "description": "

    coordinate of second point on the curve

    \n", + "type": "Number" + }, + { + "name": "t", + "description": "

    value between 0 and 1

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "curve": { + "name": "curve", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "

    x-coordinate for the beginning control point

    \n", + "type": "Number" + }, + { + "name": "y1", + "description": "

    y-coordinate for the beginning control point

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "

    x-coordinate for the first point

    \n", + "type": "Number" + }, + { + "name": "y2", + "description": "

    y-coordinate for the first point

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "

    x-coordinate for the second point

    \n", + "type": "Number" + }, + { + "name": "y3", + "description": "

    y-coordinate for the second point

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "

    x-coordinate for the ending control point

    \n", + "type": "Number" + }, + { + "name": "y4", + "description": "

    y-coordinate for the ending control point

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x1", + "description": "", + "type": "Number" + }, + { + "name": "y1", + "description": "", + "type": "Number" + }, + { + "name": "z1", + "description": "

    z-coordinate for the beginning control point

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "", + "type": "Number" + }, + { + "name": "y2", + "description": "", + "type": "Number" + }, + { + "name": "z2", + "description": "

    z-coordinate for the first point

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "", + "type": "Number" + }, + { + "name": "y3", + "description": "", + "type": "Number" + }, + { + "name": "z3", + "description": "

    z-coordinate for the second point

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "", + "type": "Number" + }, + { + "name": "y4", + "description": "", + "type": "Number" + }, + { + "name": "z4", + "description": "

    z-coordinate for the ending control point

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "curveDetail": { + "name": "curveDetail", + "params": [ + { + "name": "resolution", + "description": "

    resolution of the curves

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "curveTightness": { + "name": "curveTightness", + "params": [ + { + "name": "amount", + "description": "

    amount of deformation from the original vertices

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "curvePoint": { + "name": "curvePoint", + "params": [ + { + "name": "a", + "description": "

    coordinate of first control point of the curve

    \n", + "type": "Number" + }, + { + "name": "b", + "description": "

    coordinate of first point

    \n", + "type": "Number" + }, + { + "name": "c", + "description": "

    coordinate of second point

    \n", + "type": "Number" + }, + { + "name": "d", + "description": "

    coordinate of second control point

    \n", + "type": "Number" + }, + { + "name": "t", + "description": "

    value between 0 and 1

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "curveTangent": { + "name": "curveTangent", + "params": [ + { + "name": "a", + "description": "

    coordinate of first control point

    \n", + "type": "Number" + }, + { + "name": "b", + "description": "

    coordinate of first point on the curve

    \n", + "type": "Number" + }, + { + "name": "c", + "description": "

    coordinate of second point on the curve

    \n", + "type": "Number" + }, + { + "name": "d", + "description": "

    coordinate of second conrol point

    \n", + "type": "Number" + }, + { + "name": "t", + "description": "

    value between 0 and 1

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Shape" + }, + "beginContour": { + "name": "beginContour", + "class": "p5", + "module": "Shape" + }, + "beginShape": { + "name": "beginShape", + "params": [ + { + "name": "kind", + "description": "

    either POINTS, LINES, TRIANGLES, TRIANGLE_FAN\n TRIANGLE_STRIP, QUADS, QUAD_STRIP or TESS

    \n", + "type": "Constant", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "bezierVertex": { + "name": "bezierVertex", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x2", + "description": "

    x-coordinate for the first control point

    \n", + "type": "Number" + }, + { + "name": "y2", + "description": "

    y-coordinate for the first control point

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "

    x-coordinate for the second control point

    \n", + "type": "Number" + }, + { + "name": "y3", + "description": "

    y-coordinate for the second control point

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "

    x-coordinate for the anchor point

    \n", + "type": "Number" + }, + { + "name": "y4", + "description": "

    y-coordinate for the anchor point

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x2", + "description": "", + "type": "Number" + }, + { + "name": "y2", + "description": "", + "type": "Number" + }, + { + "name": "z2", + "description": "

    z-coordinate for the first control point (for WebGL mode)

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "", + "type": "Number" + }, + { + "name": "y3", + "description": "", + "type": "Number" + }, + { + "name": "z3", + "description": "

    z-coordinate for the second control point (for WebGL mode)

    \n", + "type": "Number" + }, + { + "name": "x4", + "description": "", + "type": "Number" + }, + { + "name": "y4", + "description": "", + "type": "Number" + }, + { + "name": "z4", + "description": "

    z-coordinate for the anchor point (for WebGL mode)

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "curveVertex": { + "name": "curveVertex", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the vertex

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the vertex

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "

    z-coordinate of the vertex (for WebGL mode)

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "endContour": { + "name": "endContour", + "class": "p5", + "module": "Shape" + }, + "endShape": { + "name": "endShape", + "params": [ + { + "name": "mode", + "description": "

    use CLOSE to close the shape

    \n", + "type": "Constant", + "optional": true + }, + { + "name": "count", + "description": "

    number of times you want to draw/instance the shape (for WebGL mode).

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "quadraticVertex": { + "name": "quadraticVertex", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "cx", + "description": "

    x-coordinate for the control point

    \n", + "type": "Number" + }, + { + "name": "cy", + "description": "

    y-coordinate for the control point

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "

    x-coordinate for the anchor point

    \n", + "type": "Number" + }, + { + "name": "y3", + "description": "

    y-coordinate for the anchor point

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "cx", + "description": "", + "type": "Number" + }, + { + "name": "cy", + "description": "", + "type": "Number" + }, + { + "name": "cz", + "description": "

    z-coordinate for the control point (for WebGL mode)

    \n", + "type": "Number" + }, + { + "name": "x3", + "description": "", + "type": "Number" + }, + { + "name": "y3", + "description": "", + "type": "Number" + }, + { + "name": "z3", + "description": "

    z-coordinate for the anchor point (for WebGL mode)

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "vertex": { + "name": "vertex", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the vertex

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the vertex

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "

    z-coordinate of the vertex.\n Defaults to 0 if not specified.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "u", + "description": "

    the vertex's texture u-coordinate

    \n", + "type": "Number", + "optional": true + }, + { + "name": "v", + "description": "

    the vertex's texture v-coordinate

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "normal": { + "name": "normal", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "vector", + "description": "

    A p5.Vector representing the vertex normal.

    \n", + "type": "Vector" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "

    The x component of the vertex normal.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    The y component of the vertex normal.

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    The z component of the vertex normal.

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "VERSION": { + "name": "VERSION", + "class": "p5", + "module": "Constants" + }, + "P2D": { + "name": "P2D", + "class": "p5", + "module": "Constants" + }, + "WEBGL": { + "name": "WEBGL", + "class": "p5", + "module": "Constants" + }, + "WEBGL2": { + "name": "WEBGL2", + "class": "p5", + "module": "Constants" + }, + "ARROW": { + "name": "ARROW", + "class": "p5", + "module": "Constants" + }, + "CROSS": { + "name": "CROSS", + "class": "p5", + "module": "Constants" + }, + "HAND": { + "name": "HAND", + "class": "p5", + "module": "Constants" + }, + "MOVE": { + "name": "MOVE", + "class": "p5", + "module": "Constants" + }, + "TEXT": { + "name": "TEXT", + "class": "p5", + "module": "Constants" + }, + "WAIT": { + "name": "WAIT", + "class": "p5", + "module": "Constants" + }, + "HALF_PI": { + "name": "HALF_PI", + "class": "p5", + "module": "Constants" + }, + "PI": { + "name": "PI", + "class": "p5", + "module": "Constants" + }, + "QUARTER_PI": { + "name": "QUARTER_PI", + "class": "p5", + "module": "Constants" + }, + "TAU": { + "name": "TAU", + "class": "p5", + "module": "Constants" + }, + "TWO_PI": { + "name": "TWO_PI", + "class": "p5", + "module": "Constants" + }, + "DEGREES": { + "name": "DEGREES", + "class": "p5", + "module": "Constants" + }, + "RADIANS": { + "name": "RADIANS", + "class": "p5", + "module": "Constants" + }, + "CORNER": { + "name": "CORNER", + "class": "p5", + "module": "Constants" + }, + "CORNERS": { + "name": "CORNERS", + "class": "p5", + "module": "Constants" + }, + "RADIUS": { + "name": "RADIUS", + "class": "p5", + "module": "Constants" + }, + "RIGHT": { + "name": "RIGHT", + "class": "p5", + "module": "Constants" + }, + "LEFT": { + "name": "LEFT", + "class": "p5", + "module": "Constants" + }, + "CENTER": { + "name": "CENTER", + "class": "p5", + "module": "Constants" + }, + "TOP": { + "name": "TOP", + "class": "p5", + "module": "Constants" + }, + "BOTTOM": { + "name": "BOTTOM", + "class": "p5", + "module": "Constants" + }, + "BASELINE": { + "name": "BASELINE", + "class": "p5", + "module": "Constants" + }, + "POINTS": { + "name": "POINTS", + "class": "p5", + "module": "Constants" + }, + "LINES": { + "name": "LINES", + "class": "p5", + "module": "Constants" + }, + "LINE_STRIP": { + "name": "LINE_STRIP", + "class": "p5", + "module": "Constants" + }, + "LINE_LOOP": { + "name": "LINE_LOOP", + "class": "p5", + "module": "Constants" + }, + "TRIANGLES": { + "name": "TRIANGLES", + "class": "p5", + "module": "Constants" + }, + "TRIANGLE_FAN": { + "name": "TRIANGLE_FAN", + "class": "p5", + "module": "Constants" + }, + "TRIANGLE_STRIP": { + "name": "TRIANGLE_STRIP", + "class": "p5", + "module": "Constants" + }, + "QUADS": { + "name": "QUADS", + "class": "p5", + "module": "Constants" + }, + "QUAD_STRIP": { + "name": "QUAD_STRIP", + "class": "p5", + "module": "Constants" + }, + "TESS": { + "name": "TESS", + "class": "p5", + "module": "Constants" + }, + "CLOSE": { + "name": "CLOSE", + "class": "p5", + "module": "Constants" + }, + "OPEN": { + "name": "OPEN", + "class": "p5", + "module": "Constants" + }, + "CHORD": { + "name": "CHORD", + "class": "p5", + "module": "Constants" + }, + "PIE": { + "name": "PIE", + "class": "p5", + "module": "Constants" + }, + "PROJECT": { + "name": "PROJECT", + "class": "p5", + "module": "Constants" + }, + "SQUARE": { + "name": "SQUARE", + "class": "p5", + "module": "Constants" + }, + "ROUND": { + "name": "ROUND", + "class": "p5", + "module": "Constants" + }, + "BEVEL": { + "name": "BEVEL", + "class": "p5", + "module": "Constants" + }, + "MITER": { + "name": "MITER", + "class": "p5", + "module": "Constants" + }, + "RGB": { + "name": "RGB", + "class": "p5", + "module": "Constants" + }, + "HSB": { + "name": "HSB", + "class": "p5", + "module": "Constants" + }, + "HSL": { + "name": "HSL", + "class": "p5", + "module": "Constants" + }, + "AUTO": { + "name": "AUTO", + "class": "p5", + "module": "Constants" + }, + "ALT": { + "name": "ALT", + "class": "p5", + "module": "Constants" + }, + "BACKSPACE": { + "name": "BACKSPACE", + "class": "p5", + "module": "Constants" + }, + "CONTROL": { + "name": "CONTROL", + "class": "p5", + "module": "Constants" + }, + "DELETE": { + "name": "DELETE", + "class": "p5", + "module": "Constants" + }, + "DOWN_ARROW": { + "name": "DOWN_ARROW", + "class": "p5", + "module": "Constants" + }, + "ENTER": { + "name": "ENTER", + "class": "p5", + "module": "Constants" + }, + "ESCAPE": { + "name": "ESCAPE", + "class": "p5", + "module": "Constants" + }, + "LEFT_ARROW": { + "name": "LEFT_ARROW", + "class": "p5", + "module": "Constants" + }, + "OPTION": { + "name": "OPTION", + "class": "p5", + "module": "Constants" + }, + "RETURN": { + "name": "RETURN", + "class": "p5", + "module": "Constants" + }, + "RIGHT_ARROW": { + "name": "RIGHT_ARROW", + "class": "p5", + "module": "Constants" + }, + "SHIFT": { + "name": "SHIFT", + "class": "p5", + "module": "Constants" + }, + "TAB": { + "name": "TAB", + "class": "p5", + "module": "Constants" + }, + "UP_ARROW": { + "name": "UP_ARROW", + "class": "p5", + "module": "Constants" + }, + "BLEND": { + "name": "BLEND", + "class": "p5", + "module": "Constants" + }, + "REMOVE": { + "name": "REMOVE", + "class": "p5", + "module": "Constants" + }, + "ADD": { + "name": "ADD", + "class": "p5", + "module": "Constants" + }, + "DARKEST": { + "name": "DARKEST", + "class": "p5", + "module": "Constants" + }, + "LIGHTEST": { + "name": "LIGHTEST", + "class": "p5", + "module": "Constants" + }, + "DIFFERENCE": { + "name": "DIFFERENCE", + "class": "p5", + "module": "Constants" + }, + "SUBTRACT": { + "name": "SUBTRACT", + "class": "p5", + "module": "Constants" + }, + "EXCLUSION": { + "name": "EXCLUSION", + "class": "p5", + "module": "Constants" + }, + "MULTIPLY": { + "name": "MULTIPLY", + "class": "p5", + "module": "Constants" + }, + "SCREEN": { + "name": "SCREEN", + "class": "p5", + "module": "Constants" + }, + "REPLACE": { + "name": "REPLACE", + "class": "p5", + "module": "Constants" + }, + "OVERLAY": { + "name": "OVERLAY", + "class": "p5", + "module": "Constants" + }, + "HARD_LIGHT": { + "name": "HARD_LIGHT", + "class": "p5", + "module": "Constants" + }, + "SOFT_LIGHT": { + "name": "SOFT_LIGHT", + "class": "p5", + "module": "Constants" + }, + "DODGE": { + "name": "DODGE", + "class": "p5", + "module": "Constants" + }, + "BURN": { + "name": "BURN", + "class": "p5", + "module": "Constants" + }, + "THRESHOLD": { + "name": "THRESHOLD", + "class": "p5", + "module": "Constants" + }, + "GRAY": { + "name": "GRAY", + "class": "p5", + "module": "Constants" + }, + "OPAQUE": { + "name": "OPAQUE", + "class": "p5", + "module": "Constants" + }, + "INVERT": { + "name": "INVERT", + "class": "p5", + "module": "Constants" + }, + "POSTERIZE": { + "name": "POSTERIZE", + "class": "p5", + "module": "Constants" + }, + "DILATE": { + "name": "DILATE", + "class": "p5", + "module": "Constants" + }, + "ERODE": { + "name": "ERODE", + "class": "p5", + "module": "Constants" + }, + "BLUR": { + "name": "BLUR", + "class": "p5", + "module": "Constants" + }, + "NORMAL": { + "name": "NORMAL", + "class": "p5", + "module": "Constants" + }, + "ITALIC": { + "name": "ITALIC", + "class": "p5", + "module": "Constants" + }, + "BOLD": { + "name": "BOLD", + "class": "p5", + "module": "Constants" + }, + "BOLDITALIC": { + "name": "BOLDITALIC", + "class": "p5", + "module": "Constants" + }, + "CHAR": { + "name": "CHAR", + "class": "p5", + "module": "Constants" + }, + "WORD": { + "name": "WORD", + "class": "p5", + "module": "Constants" + }, + "LINEAR": { + "name": "LINEAR", + "class": "p5", + "module": "Constants" + }, + "QUADRATIC": { + "name": "QUADRATIC", + "class": "p5", + "module": "Constants" + }, + "BEZIER": { + "name": "BEZIER", + "class": "p5", + "module": "Constants" + }, + "CURVE": { + "name": "CURVE", + "class": "p5", + "module": "Constants" + }, + "STROKE": { + "name": "STROKE", + "class": "p5", + "module": "Constants" + }, + "FILL": { + "name": "FILL", + "class": "p5", + "module": "Constants" + }, + "TEXTURE": { + "name": "TEXTURE", + "class": "p5", + "module": "Constants" + }, + "IMMEDIATE": { + "name": "IMMEDIATE", + "class": "p5", + "module": "Constants" + }, + "IMAGE": { + "name": "IMAGE", + "class": "p5", + "module": "Constants" + }, + "NEAREST": { + "name": "NEAREST", + "class": "p5", + "module": "Constants" + }, + "REPEAT": { + "name": "REPEAT", + "class": "p5", + "module": "Constants" + }, + "CLAMP": { + "name": "CLAMP", + "class": "p5", + "module": "Constants" + }, + "MIRROR": { + "name": "MIRROR", + "class": "p5", + "module": "Constants" + }, + "FLAT": { + "name": "FLAT", + "class": "p5", + "module": "Constants" + }, + "SMOOTH": { + "name": "SMOOTH", + "class": "p5", + "module": "Constants" + }, + "LANDSCAPE": { + "name": "LANDSCAPE", + "class": "p5", + "module": "Constants" + }, + "PORTRAIT": { + "name": "PORTRAIT", + "class": "p5", + "module": "Constants" + }, + "GRID": { + "name": "GRID", + "class": "p5", + "module": "Constants" + }, + "AXES": { + "name": "AXES", + "class": "p5", + "module": "Constants" + }, + "LABEL": { + "name": "LABEL", + "class": "p5", + "module": "Constants" + }, + "FALLBACK": { + "name": "FALLBACK", + "class": "p5", + "module": "Constants" + }, + "CONTAIN": { + "name": "CONTAIN", + "class": "p5", + "module": "Constants" + }, + "COVER": { + "name": "COVER", + "class": "p5", + "module": "Constants" + }, + "UNSIGNED_BYTE": { + "name": "UNSIGNED_BYTE", + "class": "p5", + "module": "Constants" + }, + "UNSIGNED_INT": { + "name": "UNSIGNED_INT", + "class": "p5", + "module": "Constants" + }, + "FLOAT": { + "name": "FLOAT", + "class": "p5", + "module": "Constants" + }, + "HALF_FLOAT": { + "name": "HALF_FLOAT", + "class": "p5", + "module": "Constants" + }, + "RGBA": { + "name": "RGBA", + "class": "p5", + "module": "Constants" + }, + "print": { + "name": "print", + "params": [ + { + "name": "contents", + "description": "

    content to print to the console.

    \n", + "type": "Any" + } + ], + "class": "p5", + "module": "Environment" + }, + "frameCount": { + "name": "frameCount", + "class": "p5", + "module": "Environment" + }, + "deltaTime": { + "name": "deltaTime", + "class": "p5", + "module": "Environment" + }, + "focused": { + "name": "focused", + "class": "p5", + "module": "Environment" + }, + "cursor": { + "name": "cursor", + "params": [ + { + "name": "type", + "description": "

    Built-in: either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT.\n Native CSS properties: 'grab', 'progress', and so on.\n Path to cursor image.

    \n", + "type": "String|Constant" + }, + { + "name": "x", + "description": "

    horizontal active spot of the cursor.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "y", + "description": "

    vertical active spot of the cursor.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Environment" + }, + "frameRate": { + "name": "frameRate", + "class": "p5", + "module": "Environment", + "overloads": [ + { + "params": [ + { + "name": "fps", + "description": "

    number of frames to draw per second.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "getTargetFrameRate": { + "name": "getTargetFrameRate", + "class": "p5", + "module": "Environment" + }, + "noCursor": { + "name": "noCursor", + "class": "p5", + "module": "Environment" + }, + "webglVersion": { + "name": "webglVersion", + "class": "p5", + "module": "Environment" + }, + "displayWidth": { + "name": "displayWidth", + "class": "p5", + "module": "Environment" + }, + "displayHeight": { + "name": "displayHeight", + "class": "p5", + "module": "Environment" + }, + "windowWidth": { + "name": "windowWidth", + "class": "p5", + "module": "Environment" + }, + "windowHeight": { + "name": "windowHeight", + "class": "p5", + "module": "Environment" + }, + "windowResized": { + "name": "windowResized", + "params": [ + { + "name": "event", + "description": "

    optional resize Event.

    \n", + "type": "UIEvent", + "optional": true + } + ], + "class": "p5", + "module": "Environment" + }, + "width": { + "name": "width", + "class": "p5", + "module": "Environment" + }, + "height": { + "name": "height", + "class": "p5", + "module": "Environment" + }, + "fullscreen": { + "name": "fullscreen", + "params": [ + { + "name": "val", + "description": "

    whether the sketch should be in fullscreen mode.

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "Environment" + }, + "pixelDensity": { + "name": "pixelDensity", + "class": "p5", + "module": "Environment", + "overloads": [ + { + "params": [ + { + "name": "val", + "description": "

    desired pixel density.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "displayDensity": { + "name": "displayDensity", + "class": "p5", + "module": "Environment" + }, + "getURL": { + "name": "getURL", + "class": "p5", + "module": "Environment" + }, + "getURLPath": { + "name": "getURLPath", + "class": "p5", + "module": "Environment" + }, + "getURLParams": { + "name": "getURLParams", + "class": "p5", + "module": "Environment" + }, + "preload": { + "name": "preload", + "class": "p5", + "module": "Structure" + }, + "setup": { + "name": "setup", + "class": "p5", + "module": "Structure" + }, + "draw": { + "name": "draw", + "class": "p5", + "module": "Structure" + }, + "remove": { + "name": "remove", + "class": "p5", + "module": "Structure" + }, + "disableFriendlyErrors": { + "name": "disableFriendlyErrors", + "class": "p5", + "module": "Structure" + }, + "let": { + "name": "let", + "class": "p5", + "module": "Foundation" + }, + "const": { + "name": "const", + "class": "p5", + "module": "Foundation" + }, + "===": { + "name": "===", + "class": "p5", + "module": "Foundation" + }, + ">": { + "name": ">", + "class": "p5", + "module": "Foundation" + }, + ">=": { + "name": ">=", + "class": "p5", + "module": "Foundation" + }, + "<": { + "name": "<", + "class": "p5", + "module": "Foundation" + }, + "<=": { + "name": "<=", + "class": "p5", + "module": "Foundation" + }, + "if-else": { + "name": "if-else", + "class": "p5", + "module": "Foundation" + }, + "function": { + "name": "function", + "class": "p5", + "module": "Foundation" + }, + "return": { + "name": "return", + "class": "p5", + "module": "Foundation" + }, + "boolean": { + "name": "boolean", + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "String|Boolean|Number|Array" + } + ], + "class": "p5", + "module": "Data" + }, + "string": { + "name": "string", + "class": "p5", + "module": "Foundation" + }, + "number": { + "name": "number", + "class": "p5", + "module": "Foundation" + }, + "object": { + "name": "object", + "class": "p5", + "module": "Foundation" + }, + "class": { + "name": "class", + "class": "p5", + "module": "Foundation" + }, + "for": { + "name": "for", + "class": "p5", + "module": "Foundation" + }, + "while": { + "name": "while", + "class": "p5", + "module": "Foundation" + }, + "createCanvas": { + "name": "createCanvas", + "class": "p5", + "module": "Rendering", + "overloads": [ + { + "params": [ + { + "name": "w", + "description": "

    width of the canvas

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the canvas

    \n", + "type": "Number" + }, + { + "name": "renderer", + "description": "

    either P2D or WEBGL

    \n", + "type": "Constant", + "optional": true + }, + { + "name": "canvas", + "description": "

    existing html canvas element

    \n", + "type": "HTMLCanvasElement", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "w", + "description": "", + "type": "Number" + }, + { + "name": "h", + "description": "", + "type": "Number" + }, + { + "name": "canvas", + "description": "", + "type": "HTMLCanvasElement", + "optional": true + } + ] + } + ] + }, + "resizeCanvas": { + "name": "resizeCanvas", + "params": [ + { + "name": "w", + "description": "

    width of the canvas

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the canvas

    \n", + "type": "Number" + }, + { + "name": "noRedraw", + "description": "

    don't redraw the canvas immediately

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "Rendering" + }, + "noCanvas": { + "name": "noCanvas", + "class": "p5", + "module": "Rendering" + }, + "createGraphics": { + "name": "createGraphics", + "class": "p5", + "module": "Rendering", + "overloads": [ + { + "params": [ + { + "name": "w", + "description": "

    width of the offscreen graphics buffer

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the offscreen graphics buffer

    \n", + "type": "Number" + }, + { + "name": "renderer", + "description": "

    either P2D or WEBGL\n undefined defaults to p2d

    \n", + "type": "Constant", + "optional": true + }, + { + "name": "canvas", + "description": "

    existing html canvas element

    \n", + "type": "HTMLCanvasElement", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "w", + "description": "", + "type": "Number" + }, + { + "name": "h", + "description": "", + "type": "Number" + }, + { + "name": "canvas", + "description": "", + "type": "HTMLCanvasElement", + "optional": true + } + ] + } + ] + }, + "createFramebuffer": { + "name": "createFramebuffer", + "params": [ + { + "name": "options", + "description": "

    An optional object with configuration

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5", + "module": "Rendering" + }, + "clearDepth": { + "name": "clearDepth", + "params": [ + { + "name": "depth", + "description": "

    The value, between 0 and 1, to reset the depth to, where\n0 corresponds to a value as close as possible to the camera before getting\nclipped, and 1 corresponds to a value as far away from the camera as possible.\nThe default value is 1.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Rendering" + }, + "blendMode": { + "name": "blendMode", + "params": [ + { + "name": "mode", + "description": "

    blend mode to set for canvas.\n either BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY,\n EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n SOFT_LIGHT, DODGE, BURN, ADD, REMOVE or SUBTRACT

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "Rendering" + }, + "drawingContext": { + "name": "drawingContext", + "class": "p5", + "module": "Rendering" + }, + "noLoop": { + "name": "noLoop", + "class": "p5", + "module": "Structure" + }, + "loop": { + "name": "loop", + "class": "p5", + "module": "Structure" + }, + "isLooping": { + "name": "isLooping", + "class": "p5", + "module": "Structure" + }, + "push": { + "name": "push", + "class": "p5", + "module": "Structure" + }, + "pop": { + "name": "pop", + "class": "p5", + "module": "Structure" + }, + "redraw": { + "name": "redraw", + "params": [ + { + "name": "n", + "description": "

    Redraw for n-times. The default value is 1.

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Structure" + }, + "p5": { + "name": "p5", + "params": [ + { + "name": "sketch", + "description": "

    a function containing a p5.js sketch

    \n", + "type": "Object" + }, + { + "name": "node", + "description": "

    ID or pointer to HTML DOM node to contain sketch in

    \n", + "type": "String|Object" + } + ], + "class": "p5", + "module": "Structure" + }, + "applyMatrix": { + "name": "applyMatrix", + "class": "p5", + "module": "Transform", + "overloads": [ + { + "params": [ + { + "name": "arr", + "description": "

    an array of numbers - should be 6 or 16 length (2Ɨ3 or 4Ɨ4 matrix values)

    \n", + "type": "Array" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "a", + "description": "

    numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "b", + "description": "

    numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "c", + "description": "

    numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "d", + "description": "

    numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "e", + "description": "

    numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "f", + "description": "

    numbers which define the 2Ɨ3 or 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "a", + "description": "", + "type": "Number" + }, + { + "name": "b", + "description": "", + "type": "Number" + }, + { + "name": "c", + "description": "", + "type": "Number" + }, + { + "name": "d", + "description": "", + "type": "Number" + }, + { + "name": "e", + "description": "", + "type": "Number" + }, + { + "name": "f", + "description": "", + "type": "Number" + }, + { + "name": "g", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "i", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "j", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "k", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "l", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "m", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "n", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "o", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + }, + { + "name": "p", + "description": "

    numbers which define the 4Ɨ4 matrix to be multiplied

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "resetMatrix": { + "name": "resetMatrix", + "class": "p5", + "module": "Transform" + }, + "rotate": { + "name": "rotate", + "params": [ + { + "name": "angle", + "description": "

    the angle of rotation, specified in radians\n or degrees, depending on current angleMode

    \n", + "type": "Number" + }, + { + "name": "axis", + "description": "

    (in 3d) the axis to rotate around

    \n", + "type": "p5.Vector|Number[]", + "optional": true + } + ], + "class": "p5", + "module": "Transform" + }, + "rotateX": { + "name": "rotateX", + "params": [ + { + "name": "angle", + "description": "

    the angle of rotation, specified in radians\n or degrees, depending on current angleMode

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Transform" + }, + "rotateY": { + "name": "rotateY", + "params": [ + { + "name": "angle", + "description": "

    the angle of rotation, specified in radians\n or degrees, depending on current angleMode

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Transform" + }, + "rotateZ": { + "name": "rotateZ", + "params": [ + { + "name": "angle", + "description": "

    the angle of rotation, specified in radians\n or degrees, depending on current angleMode

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Transform" + }, + "scale": { + "name": "scale", + "class": "p5", + "module": "Transform", + "overloads": [ + { + "params": [ + { + "name": "s", + "description": "

    percent to scale the object, or percentage to\n scale the object in the x-axis if multiple arguments\n are given

    \n", + "type": "Number|p5.Vector|Number[]" + }, + { + "name": "y", + "description": "

    percent to scale the object in the y-axis

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    percent to scale the object in the z-axis (webgl only)

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "scales", + "description": "

    per-axis percents to scale the object

    \n", + "type": "p5.Vector|Number[]" + } + ], + "chainable": 1 + } + ] + }, + "shearX": { + "name": "shearX", + "params": [ + { + "name": "angle", + "description": "

    angle of shear specified in radians or degrees,\n depending on current angleMode

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Transform" + }, + "shearY": { + "name": "shearY", + "params": [ + { + "name": "angle", + "description": "

    angle of shear specified in radians or degrees,\n depending on current angleMode

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Transform" + }, + "translate": { + "name": "translate", + "class": "p5", + "module": "Transform", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    left/right translation

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    up/down translation

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    forward/backward translation (WEBGL only)

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "vector", + "description": "

    the vector to translate by

    \n", + "type": "p5.Vector" + } + ], + "chainable": 1 + } + ] + }, + "storeItem": { + "name": "storeItem", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "value", + "description": "", + "type": "String|Number|Object|Boolean|p5.Color|p5.Vector" + } + ], + "class": "p5", + "module": "Data" + }, + "getItem": { + "name": "getItem", + "params": [ + { + "name": "key", + "description": "

    name that you wish to use to store in local storage

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "Data" + }, + "clearStorage": { + "name": "clearStorage", + "class": "p5", + "module": "Data" + }, + "removeItem": { + "name": "removeItem", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "class": "p5", + "module": "Data" + }, + "createStringDict": { + "name": "createStringDict", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "value", + "description": "", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "object", + "description": "

    object

    \n", + "type": "Object" + } + ] + } + ] + }, + "createNumberDict": { + "name": "createNumberDict", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "", + "type": "Number" + }, + { + "name": "value", + "description": "", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "object", + "description": "

    object

    \n", + "type": "Object" + } + ] + } + ] + }, + "select": { + "name": "select", + "params": [ + { + "name": "selectors", + "description": "

    CSS selector string of element to search for.

    \n", + "type": "String" + }, + { + "name": "container", + "description": "

    CSS selector string, p5.Element, or\n HTMLElement to search within.

    \n", + "type": "String|p5.Element|HTMLElement", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "selectAll": { + "name": "selectAll", + "params": [ + { + "name": "selectors", + "description": "

    CSS selector string of element to search for.

    \n", + "type": "String" + }, + { + "name": "container", + "description": "

    CSS selector string, p5.Element, or\n HTMLElement to search within.

    \n", + "type": "String|p5.Element|HTMLElement", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "removeElements": { + "name": "removeElements", + "class": "p5", + "module": "DOM" + }, + "changed": { + "name": "changed", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the element changes.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5", + "module": "DOM" + }, + "input": { + "name": "input", + "params": [ + { + "name": "fxn", + "description": "

    function to call when input is detected within\n the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5", + "module": "DOM" + }, + "createDiv": { + "name": "createDiv", + "params": [ + { + "name": "html", + "description": "

    inner HTML for the new <div></div> element.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createP": { + "name": "createP", + "params": [ + { + "name": "html", + "description": "

    inner HTML for the new <p></p> element.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createSpan": { + "name": "createSpan", + "params": [ + { + "name": "html", + "description": "

    inner HTML for the new <span></span> element.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createImg": { + "name": "createImg", + "class": "p5", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "src", + "description": "

    relative path or URL for the image.

    \n", + "type": "String" + }, + { + "name": "alt", + "description": "

    alternate text for the image.

    \n", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "src", + "description": "", + "type": "String" + }, + { + "name": "alt", + "description": "", + "type": "String" + }, + { + "name": "crossOrigin", + "description": "

    crossOrigin property to use when fetching the image.

    \n", + "type": "String", + "optional": true + }, + { + "name": "successCallback", + "description": "

    function to call once the image loads. The new image will be passed\n to the function as a p5.Element object.

    \n", + "type": "Function", + "optional": true + } + ] + } + ] + }, + "createA": { + "name": "createA", + "params": [ + { + "name": "href", + "description": "

    URL of linked page.

    \n", + "type": "String" + }, + { + "name": "html", + "description": "

    inner HTML of link element to display.

    \n", + "type": "String" + }, + { + "name": "target", + "description": "

    target where the new link should open,\n either '_blank', '_self', '_parent', or '_top'.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createSlider": { + "name": "createSlider", + "params": [ + { + "name": "min", + "description": "

    minimum value of the slider.

    \n", + "type": "Number" + }, + { + "name": "max", + "description": "

    maximum value of the slider.

    \n", + "type": "Number" + }, + { + "name": "value", + "description": "

    default value of the slider.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "step", + "description": "

    size for each step in the slider's range.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createButton": { + "name": "createButton", + "params": [ + { + "name": "label", + "description": "

    label displayed on the button.

    \n", + "type": "String" + }, + { + "name": "value", + "description": "

    value of the button.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createCheckbox": { + "name": "createCheckbox", + "params": [ + { + "name": "label", + "description": "

    label displayed after the checkbox.

    \n", + "type": "String", + "optional": true + }, + { + "name": "value", + "description": "

    value of the checkbox. Checked is true and unchecked is false.

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createSelect": { + "name": "createSelect", + "class": "p5", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "multiple", + "description": "

    support multiple selections.

    \n", + "type": "Boolean", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "existing", + "description": "

    select element to wrap, either as a p5.Element or\n a HTMLSelectElement.

    \n", + "type": "Object" + } + ] + } + ] + }, + "createRadio": { + "name": "createRadio", + "class": "p5", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "containerElement", + "description": "

    container HTML Element, either a <div></div>\nor <span></span>.

    \n", + "type": "Object", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "name", + "description": "

    name parameter assigned to each option's <input></input> element.

    \n", + "type": "String", + "optional": true + } + ] + }, + { + "params": [] + } + ] + }, + "createColorPicker": { + "name": "createColorPicker", + "params": [ + { + "name": "value", + "description": "

    default color as a CSS color string.

    \n", + "type": "String|p5.Color", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createInput": { + "name": "createInput", + "class": "p5", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "

    default value of the input box. Defaults to an empty string ''.

    \n", + "type": "String", + "optional": true + }, + { + "name": "type", + "description": "

    type of input. Defaults to 'text'.

    \n", + "type": "String", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "", + "type": "String", + "optional": true + } + ] + } + ] + }, + "createFileInput": { + "name": "createFileInput", + "params": [ + { + "name": "callback", + "description": "

    function to call once the file loads.

    \n", + "type": "Function" + }, + { + "name": "multiple", + "description": "

    allow multiple files to be selected.

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createVideo": { + "name": "createVideo", + "params": [ + { + "name": "src", + "description": "

    path to a video file, or an array of paths for\n supporting different browsers.

    \n", + "type": "String|String[]" + }, + { + "name": "callback", + "description": "

    function to call once the video is ready to play.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createAudio": { + "name": "createAudio", + "params": [ + { + "name": "src", + "description": "

    path to an audio file, or an array of paths\n for supporting different browsers.

    \n", + "type": "String|String[]", + "optional": true + }, + { + "name": "callback", + "description": "

    function to call once the audio is ready to play.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createCapture": { + "name": "createCapture", + "params": [ + { + "name": "type", + "description": "

    type of capture, either AUDIO or VIDEO,\n or a constraints object. Both video and audio\n audio streams are captured by default.

    \n", + "type": "String|Constant|Object", + "optional": true + }, + { + "name": "callback", + "description": "

    function to call once the stream\n has loaded.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "createElement": { + "name": "createElement", + "params": [ + { + "name": "tag", + "description": "

    tag for the new element.

    \n", + "type": "String" + }, + { + "name": "content", + "description": "

    HTML content to insert into the element.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "DOM" + }, + "deviceOrientation": { + "name": "deviceOrientation", + "class": "p5", + "module": "Events" + }, + "accelerationX": { + "name": "accelerationX", + "class": "p5", + "module": "Events" + }, + "accelerationY": { + "name": "accelerationY", + "class": "p5", + "module": "Events" + }, + "accelerationZ": { + "name": "accelerationZ", + "class": "p5", + "module": "Events" + }, + "pAccelerationX": { + "name": "pAccelerationX", + "class": "p5", + "module": "Events" + }, + "pAccelerationY": { + "name": "pAccelerationY", + "class": "p5", + "module": "Events" + }, + "pAccelerationZ": { + "name": "pAccelerationZ", + "class": "p5", + "module": "Events" + }, + "rotationX": { + "name": "rotationX", + "class": "p5", + "module": "Events" + }, + "rotationY": { + "name": "rotationY", + "class": "p5", + "module": "Events" + }, + "rotationZ": { + "name": "rotationZ", + "class": "p5", + "module": "Events" + }, + "pRotationX": { + "name": "pRotationX", + "class": "p5", + "module": "Events" + }, + "pRotationY": { + "name": "pRotationY", + "class": "p5", + "module": "Events" + }, + "pRotationZ": { + "name": "pRotationZ", + "class": "p5", + "module": "Events" + }, + "turnAxis": { + "name": "turnAxis", + "class": "p5", + "module": "Events" + }, + "setMoveThreshold": { + "name": "setMoveThreshold", + "params": [ + { + "name": "value", + "description": "

    The threshold value

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Events" + }, + "setShakeThreshold": { + "name": "setShakeThreshold", + "params": [ + { + "name": "value", + "description": "

    The threshold value

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Events" + }, + "deviceMoved": { + "name": "deviceMoved", + "class": "p5", + "module": "Events" + }, + "deviceTurned": { + "name": "deviceTurned", + "class": "p5", + "module": "Events" + }, + "deviceShaken": { + "name": "deviceShaken", + "class": "p5", + "module": "Events" + }, + "keyIsPressed": { + "name": "keyIsPressed", + "class": "p5", + "module": "Events" + }, + "key": { + "name": "key", + "class": "p5", + "module": "Events" + }, + "keyCode": { + "name": "keyCode", + "class": "p5", + "module": "Events" + }, + "keyPressed": { + "name": "keyPressed", + "params": [ + { + "name": "event", + "description": "

    optional KeyboardEvent callback argument.

    \n", + "type": "KeyboardEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "keyReleased": { + "name": "keyReleased", + "params": [ + { + "name": "event", + "description": "

    optional KeyboardEvent callback argument.

    \n", + "type": "KeyboardEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "keyTyped": { + "name": "keyTyped", + "params": [ + { + "name": "event", + "description": "

    optional KeyboardEvent callback argument.

    \n", + "type": "KeyboardEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "keyIsDown": { + "name": "keyIsDown", + "params": [ + { + "name": "code", + "description": "

    The key to check for.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Events" + }, + "movedX": { + "name": "movedX", + "class": "p5", + "module": "Events" + }, + "movedY": { + "name": "movedY", + "class": "p5", + "module": "Events" + }, + "mouseX": { + "name": "mouseX", + "class": "p5", + "module": "Events" + }, + "mouseY": { + "name": "mouseY", + "class": "p5", + "module": "Events" + }, + "pmouseX": { + "name": "pmouseX", + "class": "p5", + "module": "Events" + }, + "pmouseY": { + "name": "pmouseY", + "class": "p5", + "module": "Events" + }, + "winMouseX": { + "name": "winMouseX", + "class": "p5", + "module": "Events" + }, + "winMouseY": { + "name": "winMouseY", + "class": "p5", + "module": "Events" + }, + "pwinMouseX": { + "name": "pwinMouseX", + "class": "p5", + "module": "Events" + }, + "pwinMouseY": { + "name": "pwinMouseY", + "class": "p5", + "module": "Events" + }, + "mouseButton": { + "name": "mouseButton", + "class": "p5", + "module": "Events" + }, + "mouseIsPressed": { + "name": "mouseIsPressed", + "class": "p5", + "module": "Events" + }, + "mouseMoved": { + "name": "mouseMoved", + "params": [ + { + "name": "event", + "description": "

    optional MouseEvent callback argument.

    \n", + "type": "MouseEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "mouseDragged": { + "name": "mouseDragged", + "params": [ + { + "name": "event", + "description": "

    optional MouseEvent callback argument.

    \n", + "type": "MouseEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "mousePressed": { + "name": "mousePressed", + "params": [ + { + "name": "event", + "description": "

    optional MouseEvent callback argument.

    \n", + "type": "MouseEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "mouseReleased": { + "name": "mouseReleased", + "params": [ + { + "name": "event", + "description": "

    optional MouseEvent callback argument.

    \n", + "type": "MouseEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "mouseClicked": { + "name": "mouseClicked", + "params": [ + { + "name": "event", + "description": "

    optional MouseEvent callback argument.

    \n", + "type": "MouseEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "doubleClicked": { + "name": "doubleClicked", + "params": [ + { + "name": "event", + "description": "

    optional MouseEvent callback argument.

    \n", + "type": "MouseEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "mouseWheel": { + "name": "mouseWheel", + "params": [ + { + "name": "event", + "description": "

    optional WheelEvent callback argument.

    \n", + "type": "WheelEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "requestPointerLock": { + "name": "requestPointerLock", + "class": "p5", + "module": "Events" + }, + "exitPointerLock": { + "name": "exitPointerLock", + "class": "p5", + "module": "Events" + }, + "touches": { + "name": "touches", + "class": "p5", + "module": "Events" + }, + "touchStarted": { + "name": "touchStarted", + "params": [ + { + "name": "event", + "description": "

    optional TouchEvent callback argument.

    \n", + "type": "TouchEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "touchMoved": { + "name": "touchMoved", + "params": [ + { + "name": "event", + "description": "

    optional TouchEvent callback argument.

    \n", + "type": "TouchEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "touchEnded": { + "name": "touchEnded", + "params": [ + { + "name": "event", + "description": "

    optional TouchEvent callback argument.

    \n", + "type": "TouchEvent", + "optional": true + } + ], + "class": "p5", + "module": "Events" + }, + "createImage": { + "name": "createImage", + "params": [ + { + "name": "width", + "description": "

    width in pixels.

    \n", + "type": "Integer" + }, + { + "name": "height", + "description": "

    height in pixels.

    \n", + "type": "Integer" + } + ], + "class": "p5", + "module": "Image" + }, + "saveCanvas": { + "name": "saveCanvas", + "class": "p5", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "selectedCanvas", + "description": "

    reference to a\n specific HTML5 canvas element.

    \n", + "type": "p5.Framebuffer|p5.Element|HTMLCanvasElement" + }, + { + "name": "filename", + "description": "

    file name. Defaults to 'untitled'.

    \n", + "type": "String", + "optional": true + }, + { + "name": "extension", + "description": "

    file extension, either 'jpg' or 'png'. Defaults to 'png'.

    \n", + "type": "String", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "filename", + "description": "", + "type": "String", + "optional": true + }, + { + "name": "extension", + "description": "", + "type": "String", + "optional": true + } + ] + } + ] + }, + "saveFrames": { + "name": "saveFrames", + "params": [ + { + "name": "filename", + "description": "

    prefix of file name.

    \n", + "type": "String" + }, + { + "name": "extension", + "description": "

    file extension, either 'jpg' or 'png'.

    \n", + "type": "String" + }, + { + "name": "duration", + "description": "

    duration in seconds to record. This parameter will be constrained to be less or equal to 15.

    \n", + "type": "Number" + }, + { + "name": "framerate", + "description": "

    number of frames to save per second. This parameter will be constrained to be less or equal to 22.

    \n", + "type": "Number" + }, + { + "name": "callback", + "description": "

    callback function that will be executed\n to handle the image data. This function\n should accept an array as argument. The\n array will contain the specified number of\n frames of objects. Each object has three\n properties: imageData, filename, and extension.

    \n", + "type": "Function(Array)", + "optional": true + } + ], + "class": "p5", + "module": "Image" + }, + "loadImage": { + "name": "loadImage", + "params": [ + { + "name": "path", + "description": "

    path of the image to be loaded or base64 encoded image.

    \n", + "type": "String" + }, + { + "name": "successCallback", + "description": "

    function called with\n p5.Image once it\n loads.

    \n", + "type": "function(p5.Image)", + "optional": true + }, + { + "name": "failureCallback", + "description": "

    function called with event\n error if the image fails to load.

    \n", + "type": "Function(Event)", + "optional": true + } + ], + "class": "p5", + "module": "Image" + }, + "saveGif": { + "name": "saveGif", + "params": [ + { + "name": "filename", + "description": "

    file name of gif.

    \n", + "type": "String" + }, + { + "name": "duration", + "description": "

    duration in seconds to capture from the sketch.

    \n", + "type": "Number" + }, + { + "name": "options", + "description": "

    an object that can contain five more properties:\n delay, a Number specifying how much time to wait before recording;\n units, a String that can be either 'seconds' or 'frames'. By default it's 'secondsā€™;\n silent, a Boolean that defines presence of progress notifications. By default itā€™s false;\n notificationDuration, a Number that defines how long in seconds the final notification\n will live. By default it's 0, meaning the notification will never be removed;\n notificationID, a String that specifies the id of the notification's DOM element. By default itā€™s 'progressBarā€™.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5", + "module": "Image" + }, + "image": { + "name": "image", + "class": "p5", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "img", + "description": "

    image to display.

    \n", + "type": "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture" + }, + { + "name": "x", + "description": "

    x-coordinate of the top-left corner of the image.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the top-left corner of the image.

    \n", + "type": "Number" + }, + { + "name": "width", + "description": "

    width to draw the image.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "height", + "description": "

    height to draw the image.

    \n", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "img", + "description": "", + "type": "p5.Image|p5.Element|p5.Texture|p5.Framebuffer|p5.FramebufferTexture" + }, + { + "name": "dx", + "description": "

    the x-coordinate of the destination\n rectangle in which to draw the source image

    \n", + "type": "Number" + }, + { + "name": "dy", + "description": "

    the y-coordinate of the destination\n rectangle in which to draw the source image

    \n", + "type": "Number" + }, + { + "name": "dWidth", + "description": "

    the width of the destination rectangle

    \n", + "type": "Number" + }, + { + "name": "dHeight", + "description": "

    the height of the destination rectangle

    \n", + "type": "Number" + }, + { + "name": "sx", + "description": "

    the x-coordinate of the subsection of the source\nimage to draw into the destination rectangle

    \n", + "type": "Number" + }, + { + "name": "sy", + "description": "

    the y-coordinate of the subsection of the source\nimage to draw into the destination rectangle

    \n", + "type": "Number" + }, + { + "name": "sWidth", + "description": "

    the width of the subsection of the\n source image to draw into the destination\n rectangle

    \n", + "type": "Number", + "optional": true + }, + { + "name": "sHeight", + "description": "

    the height of the subsection of the\n source image to draw into the destination rectangle

    \n", + "type": "Number", + "optional": true + }, + { + "name": "fit", + "description": "

    either CONTAIN or COVER

    \n", + "type": "Constant", + "optional": true + }, + { + "name": "xAlign", + "description": "

    either LEFT, RIGHT or CENTER default is CENTER

    \n", + "type": "Constant", + "optional": true + }, + { + "name": "yAlign", + "description": "

    either TOP, BOTTOM or CENTER default is CENTER

    \n", + "type": "Constant", + "optional": true + } + ] + } + ] + }, + "tint": { + "name": "tint", + "class": "p5", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value.

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value.

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "

    CSS color string.

    \n", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "gray", + "description": "

    grayscale value.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "values", + "description": "

    array containing the red, green, blue &\n alpha components of the color.

    \n", + "type": "Number[]" + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "

    the tint color

    \n", + "type": "p5.Color" + } + ] + } + ] + }, + "noTint": { + "name": "noTint", + "class": "p5", + "module": "Image" + }, + "imageMode": { + "name": "imageMode", + "params": [ + { + "name": "mode", + "description": "

    either CORNER, CORNERS, or CENTER.

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "Image" + }, + "pixels": { + "name": "pixels", + "class": "p5", + "module": "Image" + }, + "blend": { + "name": "blend", + "class": "p5", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "

    source image.

    \n", + "type": "p5.Image" + }, + { + "name": "sx", + "description": "

    x-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sy", + "description": "

    y-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sw", + "description": "

    source image width.

    \n", + "type": "Integer" + }, + { + "name": "sh", + "description": "

    source image height.

    \n", + "type": "Integer" + }, + { + "name": "dx", + "description": "

    x-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dy", + "description": "

    y-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dw", + "description": "

    destination image width.

    \n", + "type": "Integer" + }, + { + "name": "dh", + "description": "

    destination image height.

    \n", + "type": "Integer" + }, + { + "name": "blendMode", + "description": "

    the blend mode. either\n BLEND, DARKEST, LIGHTEST, DIFFERENCE,\n MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n SOFT_LIGHT, DODGE, BURN, ADD or NORMAL.

    \n", + "type": "Constant" + } + ] + }, + { + "params": [ + { + "name": "sx", + "description": "", + "type": "Integer" + }, + { + "name": "sy", + "description": "", + "type": "Integer" + }, + { + "name": "sw", + "description": "", + "type": "Integer" + }, + { + "name": "sh", + "description": "", + "type": "Integer" + }, + { + "name": "dx", + "description": "", + "type": "Integer" + }, + { + "name": "dy", + "description": "", + "type": "Integer" + }, + { + "name": "dw", + "description": "", + "type": "Integer" + }, + { + "name": "dh", + "description": "", + "type": "Integer" + }, + { + "name": "blendMode", + "description": "", + "type": "Constant" + } + ] + } + ] + }, + "copy": { + "name": "copy", + "class": "p5", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "

    source image.

    \n", + "type": "p5.Image|p5.Element" + }, + { + "name": "sx", + "description": "

    x-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sy", + "description": "

    y-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sw", + "description": "

    source image width.

    \n", + "type": "Integer" + }, + { + "name": "sh", + "description": "

    source image height.

    \n", + "type": "Integer" + }, + { + "name": "dx", + "description": "

    x-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dy", + "description": "

    y-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dw", + "description": "

    destination image width.

    \n", + "type": "Integer" + }, + { + "name": "dh", + "description": "

    destination image height.

    \n", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "sx", + "description": "", + "type": "Integer" + }, + { + "name": "sy", + "description": "", + "type": "Integer" + }, + { + "name": "sw", + "description": "", + "type": "Integer" + }, + { + "name": "sh", + "description": "", + "type": "Integer" + }, + { + "name": "dx", + "description": "", + "type": "Integer" + }, + { + "name": "dy", + "description": "", + "type": "Integer" + }, + { + "name": "dw", + "description": "", + "type": "Integer" + }, + { + "name": "dh", + "description": "", + "type": "Integer" + } + ] + } + ] + }, + "filter": { + "name": "filter", + "class": "p5", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "filterType", + "description": "

    either THRESHOLD, GRAY, OPAQUE, INVERT,\n POSTERIZE, BLUR, ERODE, DILATE or BLUR.

    \n", + "type": "Constant" + }, + { + "name": "filterParam", + "description": "

    parameter unique to each filter.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "useWebGL", + "description": "

    flag to control whether to use fast\n WebGL filters (GPU) or original image\n filters (CPU); defaults to true.

    \n", + "type": "Boolean", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "filterType", + "description": "", + "type": "Constant" + }, + { + "name": "useWebGL", + "description": "", + "type": "Boolean", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "shaderFilter", + "description": "

    shader that's been loaded, with the\n frag shader using a tex0 uniform.

    \n", + "type": "p5.Shader" + } + ] + } + ] + }, + "get": { + "name": "get", + "class": "p5", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "w", + "description": "

    width of the subsection to be returned.

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the subsection to be returned.

    \n", + "type": "Number" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + } + ] + } + ] + }, + "loadPixels": { + "name": "loadPixels", + "class": "p5", + "module": "Image" + }, + "set": { + "name": "set", + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "c", + "description": "

    grayscale value | pixel array |\n p5.Color object | p5.Image to copy.

    \n", + "type": "Number|Number[]|Object" + } + ], + "class": "p5", + "module": "Image" + }, + "updatePixels": { + "name": "updatePixels", + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the upper-left corner of region\n to update.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "y", + "description": "

    y-coordinate of the upper-left corner of region\n to update.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "w", + "description": "

    width of region to update.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "h", + "description": "

    height of region to update.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Image" + }, + "loadJSON": { + "name": "loadJSON", + "class": "p5", + "module": "IO", + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "

    name of the file or url to load

    \n", + "type": "String" + }, + { + "name": "jsonpOptions", + "description": "

    options object for jsonp related settings

    \n", + "type": "Object", + "optional": true + }, + { + "name": "datatype", + "description": "

    \"json\" or \"jsonp\"

    \n", + "type": "String", + "optional": true + }, + { + "name": "callback", + "description": "

    function to be executed after\n loadJSON() completes, data is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if\n there is an error, response is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "datatype", + "description": "", + "type": "String" + }, + { + "name": "callback", + "description": "", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "", + "type": "Function", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "callback", + "description": "", + "type": "Function" + }, + { + "name": "errorCallback", + "description": "", + "type": "Function", + "optional": true + } + ] + } + ] + }, + "loadStrings": { + "name": "loadStrings", + "params": [ + { + "name": "filename", + "description": "

    name of the file or url to load

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    function to be executed after loadStrings()\n completes, Array is passed in as first\n argument

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if\n there is an error, response is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "loadTable": { + "name": "loadTable", + "params": [ + { + "name": "filename", + "description": "

    name of the file or URL to load

    \n", + "type": "String" + }, + { + "name": "extension", + "description": "

    parse the table by comma-separated values \"csv\", semicolon-separated\n values \"ssv\", or tab-separated values \"tsv\"

    \n", + "type": "String", + "optional": true + }, + { + "name": "header", + "description": "

    \"header\" to indicate table has header row

    \n", + "type": "String", + "optional": true + }, + { + "name": "callback", + "description": "

    function to be executed after\n loadTable() completes. On success, the\n Table object is passed in as the\n first argument.

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if\n there is an error, response is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "loadXML": { + "name": "loadXML", + "params": [ + { + "name": "filename", + "description": "

    name of the file or URL to load

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    function to be executed after loadXML()\n completes, XML object is passed in as\n first argument

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if\n there is an error, response is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "loadBytes": { + "name": "loadBytes", + "params": [ + { + "name": "file", + "description": "

    name of the file or URL to load

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    function to be executed after loadBytes()\n completes

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if there\n is an error

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "httpGet": { + "name": "httpGet", + "class": "p5", + "module": "IO", + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "

    name of the file or url to load

    \n", + "type": "String" + }, + { + "name": "datatype", + "description": "

    \"json\", \"jsonp\", \"binary\", \"arrayBuffer\",\n \"xml\", or \"text\"

    \n", + "type": "String", + "optional": true + }, + { + "name": "data", + "description": "

    param data passed sent with request

    \n", + "type": "Object|Boolean", + "optional": true + }, + { + "name": "callback", + "description": "

    function to be executed after\n httpGet() completes, data is passed in\n as first argument

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if\n there is an error, response is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "data", + "description": "", + "type": "Object|Boolean" + }, + { + "name": "callback", + "description": "", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "", + "type": "Function", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "callback", + "description": "", + "type": "Function" + }, + { + "name": "errorCallback", + "description": "", + "type": "Function", + "optional": true + } + ] + } + ] + }, + "httpPost": { + "name": "httpPost", + "class": "p5", + "module": "IO", + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "

    name of the file or url to load

    \n", + "type": "String" + }, + { + "name": "datatype", + "description": "

    \"json\", \"jsonp\", \"xml\", or \"text\".\n If omitted, httpPost() will guess.

    \n", + "type": "String", + "optional": true + }, + { + "name": "data", + "description": "

    param data passed sent with request

    \n", + "type": "Object|Boolean", + "optional": true + }, + { + "name": "callback", + "description": "

    function to be executed after\n httpPost() completes, data is passed in\n as first argument

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if\n there is an error, response is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "data", + "description": "", + "type": "Object|Boolean" + }, + { + "name": "callback", + "description": "", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "", + "type": "Function", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "callback", + "description": "", + "type": "Function" + }, + { + "name": "errorCallback", + "description": "", + "type": "Function", + "optional": true + } + ] + } + ] + }, + "httpDo": { + "name": "httpDo", + "class": "p5", + "module": "IO", + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "

    name of the file or url to load

    \n", + "type": "String" + }, + { + "name": "method", + "description": "

    either \"GET\", \"POST\", or \"PUT\",\n defaults to \"GET\"

    \n", + "type": "String", + "optional": true + }, + { + "name": "datatype", + "description": "

    \"json\", \"jsonp\", \"xml\", or \"text\"

    \n", + "type": "String", + "optional": true + }, + { + "name": "data", + "description": "

    param data passed sent with request

    \n", + "type": "Object", + "optional": true + }, + { + "name": "callback", + "description": "

    function to be executed after\n httpGet() completes, data is passed in\n as first argument

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to be executed if\n there is an error, response is passed\n in as first argument

    \n", + "type": "Function", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "options", + "description": "

    Request object options as documented in the\n \"fetch\" API\nreference

    \n", + "type": "Object" + }, + { + "name": "callback", + "description": "", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "", + "type": "Function", + "optional": true + } + ] + } + ] + }, + "createWriter": { + "name": "createWriter", + "params": [ + { + "name": "name", + "description": "

    name of the file to be created

    \n", + "type": "String" + }, + { + "name": "extension", + "description": "", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "save": { + "name": "save", + "params": [ + { + "name": "objectOrFilename", + "description": "

    If filename is provided, will\n save canvas as an image with\n either png or jpg extension\n depending on the filename.\n If object is provided, will\n save depending on the object\n and filename (see examples\n above).

    \n", + "type": "Object|String", + "optional": true + }, + { + "name": "filename", + "description": "

    If an object is provided as the first\n parameter, then the second parameter\n indicates the filename,\n and should include an appropriate\n file extension (see examples above).

    \n", + "type": "String", + "optional": true + }, + { + "name": "options", + "description": "

    Additional options depend on\n filetype. For example, when saving JSON,\n true indicates that the\n output will be optimized for filesize,\n rather than readability.

    \n", + "type": "Boolean|String", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "saveJSON": { + "name": "saveJSON", + "params": [ + { + "name": "json", + "description": "", + "type": "Array|Object" + }, + { + "name": "filename", + "description": "", + "type": "String" + }, + { + "name": "optimize", + "description": "

    If true, removes line breaks\n and spaces from the output\n file to optimize filesize\n (but not readability).

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "saveStrings": { + "name": "saveStrings", + "params": [ + { + "name": "list", + "description": "

    string array to be written

    \n", + "type": "String[]" + }, + { + "name": "filename", + "description": "

    filename for output

    \n", + "type": "String" + }, + { + "name": "extension", + "description": "

    the filename's extension

    \n", + "type": "String", + "optional": true + }, + { + "name": "isCRLF", + "description": "

    if true, change line-break to CRLF

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "saveTable": { + "name": "saveTable", + "params": [ + { + "name": "Table", + "description": "

    the Table object to save to a file

    \n", + "type": "p5.Table" + }, + { + "name": "filename", + "description": "

    the filename to which the Table should be saved

    \n", + "type": "String" + }, + { + "name": "options", + "description": "

    can be one of \"tsv\", \"csv\", or \"html\"

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "IO" + }, + "abs": { + "name": "abs", + "params": [ + { + "name": "n", + "description": "

    number to compute.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "ceil": { + "name": "ceil", + "params": [ + { + "name": "n", + "description": "

    number to round up.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "constrain": { + "name": "constrain", + "params": [ + { + "name": "n", + "description": "

    number to constrain.

    \n", + "type": "Number" + }, + { + "name": "low", + "description": "

    minimum limit.

    \n", + "type": "Number" + }, + { + "name": "high", + "description": "

    maximum limit.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "dist": { + "name": "dist", + "class": "p5", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x1", + "description": "

    x-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "y1", + "description": "

    y-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "

    x-coordinate of the second point.

    \n", + "type": "Number" + }, + { + "name": "y2", + "description": "

    y-coordinate of the second point.

    \n", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "x1", + "description": "", + "type": "Number" + }, + { + "name": "y1", + "description": "", + "type": "Number" + }, + { + "name": "z1", + "description": "

    z-coordinate of the first point.

    \n", + "type": "Number" + }, + { + "name": "x2", + "description": "", + "type": "Number" + }, + { + "name": "y2", + "description": "", + "type": "Number" + }, + { + "name": "z2", + "description": "

    z-coordinate of the second point.

    \n", + "type": "Number" + } + ] + } + ] + }, + "exp": { + "name": "exp", + "params": [ + { + "name": "n", + "description": "

    exponent to raise.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "floor": { + "name": "floor", + "params": [ + { + "name": "n", + "description": "

    number to round down.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "lerp": { + "name": "lerp", + "params": [ + { + "name": "start", + "description": "

    first value.

    \n", + "type": "Number" + }, + { + "name": "stop", + "description": "

    second value.

    \n", + "type": "Number" + }, + { + "name": "amt", + "description": "

    number.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "log": { + "name": "log", + "params": [ + { + "name": "n", + "description": "

    number greater than 0.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "mag": { + "name": "mag", + "params": [ + { + "name": "x", + "description": "

    first component.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    second component.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "map": { + "name": "map", + "params": [ + { + "name": "value", + "description": "

    the incoming value to be converted.

    \n", + "type": "Number" + }, + { + "name": "start1", + "description": "

    lower bound of the value's current range.

    \n", + "type": "Number" + }, + { + "name": "stop1", + "description": "

    upper bound of the value's current range.

    \n", + "type": "Number" + }, + { + "name": "start2", + "description": "

    lower bound of the value's target range.

    \n", + "type": "Number" + }, + { + "name": "stop2", + "description": "

    upper bound of the value's target range.

    \n", + "type": "Number" + }, + { + "name": "withinBounds", + "description": "

    constrain the value to the newly mapped range.

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "Math" + }, + "max": { + "name": "max", + "class": "p5", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "n0", + "description": "

    first number to compare.

    \n", + "type": "Number" + }, + { + "name": "n1", + "description": "

    second number to compare.

    \n", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "nums", + "description": "

    numbers to compare.

    \n", + "type": "Number[]" + } + ] + } + ] + }, + "min": { + "name": "min", + "class": "p5", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "n0", + "description": "

    first number to compare.

    \n", + "type": "Number" + }, + { + "name": "n1", + "description": "

    second number to compare.

    \n", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "nums", + "description": "

    numbers to compare.

    \n", + "type": "Number[]" + } + ] + } + ] + }, + "norm": { + "name": "norm", + "params": [ + { + "name": "value", + "description": "

    incoming value to be normalized.

    \n", + "type": "Number" + }, + { + "name": "start", + "description": "

    lower bound of the value's current range.

    \n", + "type": "Number" + }, + { + "name": "stop", + "description": "

    upper bound of the value's current range.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "pow": { + "name": "pow", + "params": [ + { + "name": "n", + "description": "

    base of the exponential expression.

    \n", + "type": "Number" + }, + { + "name": "e", + "description": "

    power by which to raise the base.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "round": { + "name": "round", + "params": [ + { + "name": "n", + "description": "

    number to round.

    \n", + "type": "Number" + }, + { + "name": "decimals", + "description": "

    number of decimal places to round to, default is 0.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Math" + }, + "sq": { + "name": "sq", + "params": [ + { + "name": "n", + "description": "

    number to square.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "sqrt": { + "name": "sqrt", + "params": [ + { + "name": "n", + "description": "

    non-negative number to square root.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "fract": { + "name": "fract", + "params": [ + { + "name": "n", + "description": "

    number whose fractional part will be found.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "createVector": { + "name": "createVector", + "params": [ + { + "name": "x", + "description": "

    x component of the vector.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "y", + "description": "

    y component of the vector.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    z component of the vector.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Math" + }, + "noise": { + "name": "noise", + "params": [ + { + "name": "x", + "description": "

    x-coordinate in noise space.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate in noise space.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    z-coordinate in noise space.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Math" + }, + "noiseDetail": { + "name": "noiseDetail", + "params": [ + { + "name": "lod", + "description": "

    number of octaves to be used by the noise.

    \n", + "type": "Number" + }, + { + "name": "falloff", + "description": "

    falloff factor for each octave.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "noiseSeed": { + "name": "noiseSeed", + "params": [ + { + "name": "seed", + "description": "

    seed value.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "randomSeed": { + "name": "randomSeed", + "params": [ + { + "name": "seed", + "description": "

    seed value.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "random": { + "name": "random", + "class": "p5", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "min", + "description": "

    lower bound (inclusive).

    \n", + "type": "Number", + "optional": true + }, + { + "name": "max", + "description": "

    upper bound (exclusive).

    \n", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "choices", + "description": "

    array to choose from.

    \n", + "type": "Array" + } + ] + } + ] + }, + "randomGaussian": { + "name": "randomGaussian", + "params": [ + { + "name": "mean", + "description": "

    mean.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "sd", + "description": "

    standard deviation.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Math" + }, + "acos": { + "name": "acos", + "params": [ + { + "name": "value", + "description": "

    value whose arc cosine is to be returned.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "asin": { + "name": "asin", + "params": [ + { + "name": "value", + "description": "

    value whose arc sine is to be returned.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "atan": { + "name": "atan", + "params": [ + { + "name": "value", + "description": "

    value whose arc tangent is to be returned.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "atan2": { + "name": "atan2", + "params": [ + { + "name": "y", + "description": "

    y-coordinate of the point.

    \n", + "type": "Number" + }, + { + "name": "x", + "description": "

    x-coordinate of the point.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "cos": { + "name": "cos", + "params": [ + { + "name": "angle", + "description": "

    the angle.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "sin": { + "name": "sin", + "params": [ + { + "name": "angle", + "description": "

    the angle.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "tan": { + "name": "tan", + "params": [ + { + "name": "angle", + "description": "

    the angle.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "degrees": { + "name": "degrees", + "params": [ + { + "name": "radians", + "description": "

    radians value to convert to degrees.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "radians": { + "name": "radians", + "params": [ + { + "name": "degrees", + "description": "

    degree value to convert to radians.

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "Math" + }, + "angleMode": { + "name": "angleMode", + "class": "p5", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "mode", + "description": "

    either RADIANS or DEGREES.

    \n", + "type": "Constant" + } + ] + }, + { + "params": [] + } + ] + }, + "textAlign": { + "name": "textAlign", + "class": "p5", + "module": "Typography", + "overloads": [ + { + "params": [ + { + "name": "horizAlign", + "description": "

    horizontal alignment, either LEFT,\n CENTER, or RIGHT.

    \n", + "type": "Constant" + }, + { + "name": "vertAlign", + "description": "

    vertical alignment, either TOP,\n BOTTOM, CENTER, or BASELINE.

    \n", + "type": "Constant", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "textLeading": { + "name": "textLeading", + "class": "p5", + "module": "Typography", + "overloads": [ + { + "params": [ + { + "name": "leading", + "description": "

    spacing between lines of text in units of pixels.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "textSize": { + "name": "textSize", + "class": "p5", + "module": "Typography", + "overloads": [ + { + "params": [ + { + "name": "size", + "description": "

    size of the letters in units of pixels

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "textStyle": { + "name": "textStyle", + "class": "p5", + "module": "Typography", + "overloads": [ + { + "params": [ + { + "name": "style", + "description": "

    styling for text, either NORMAL,\n ITALIC, BOLD or BOLDITALIC

    \n", + "type": "Constant" + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "textWidth": { + "name": "textWidth", + "params": [ + { + "name": "str", + "description": "

    string of text to measure.

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "Typography" + }, + "textAscent": { + "name": "textAscent", + "class": "p5", + "module": "Typography" + }, + "textDescent": { + "name": "textDescent", + "class": "p5", + "module": "Typography" + }, + "textWrap": { + "name": "textWrap", + "params": [ + { + "name": "style", + "description": "

    text wrapping style, either WORD or CHAR.

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "Typography" + }, + "loadFont": { + "name": "loadFont", + "params": [ + { + "name": "path", + "description": "

    path of the font to be loaded.

    \n", + "type": "String" + }, + { + "name": "successCallback", + "description": "

    function called with the\n p5.Font object after it\n loads.

    \n", + "type": "Function", + "optional": true + }, + { + "name": "failureCallback", + "description": "

    function called with the error\n Event\n object if the font fails to load.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "Typography" + }, + "text": { + "name": "text", + "params": [ + { + "name": "str", + "description": "

    text to be displayed.

    \n", + "type": "String|Object|Array|Number|Boolean" + }, + { + "name": "x", + "description": "

    x-coordinate of the text box.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the text box.

    \n", + "type": "Number" + }, + { + "name": "maxWidth", + "description": "

    maximum width of the text box. See\n rectMode() for\n other options.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "maxHeight", + "description": "

    maximum height of the text box. See\n rectMode() for\n other options.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "Typography" + }, + "textFont": { + "name": "textFont", + "class": "p5", + "module": "Typography", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "font", + "description": "

    font as a p5.Font object or a string.

    \n", + "type": "Object|String" + }, + { + "name": "size", + "description": "

    font size in pixels.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "append": { + "name": "append", + "params": [ + { + "name": "array", + "description": "

    Array to append

    \n", + "type": "Array" + }, + { + "name": "value", + "description": "

    to be added to the Array

    \n", + "type": "Any" + } + ], + "class": "p5", + "module": "Data" + }, + "arrayCopy": { + "name": "arrayCopy", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "src", + "description": "

    the source Array

    \n", + "type": "Array" + }, + { + "name": "srcPosition", + "description": "

    starting position in the source Array

    \n", + "type": "Integer" + }, + { + "name": "dst", + "description": "

    the destination Array

    \n", + "type": "Array" + }, + { + "name": "dstPosition", + "description": "

    starting position in the destination Array

    \n", + "type": "Integer" + }, + { + "name": "length", + "description": "

    number of Array elements to be copied

    \n", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "src", + "description": "", + "type": "Array" + }, + { + "name": "dst", + "description": "", + "type": "Array" + }, + { + "name": "length", + "description": "", + "type": "Integer", + "optional": true + } + ] + } + ] + }, + "concat": { + "name": "concat", + "params": [ + { + "name": "a", + "description": "

    first Array to concatenate

    \n", + "type": "Array" + }, + { + "name": "b", + "description": "

    second Array to concatenate

    \n", + "type": "Array" + } + ], + "class": "p5", + "module": "Data" + }, + "reverse": { + "name": "reverse", + "params": [ + { + "name": "list", + "description": "

    Array to reverse

    \n", + "type": "Array" + } + ], + "class": "p5", + "module": "Data" + }, + "shorten": { + "name": "shorten", + "params": [ + { + "name": "list", + "description": "

    Array to shorten

    \n", + "type": "Array" + } + ], + "class": "p5", + "module": "Data" + }, + "shuffle": { + "name": "shuffle", + "params": [ + { + "name": "array", + "description": "

    Array to shuffle

    \n", + "type": "Array" + }, + { + "name": "bool", + "description": "

    modify passed array

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "Data" + }, + "sort": { + "name": "sort", + "params": [ + { + "name": "list", + "description": "

    Array to sort

    \n", + "type": "Array" + }, + { + "name": "count", + "description": "

    number of elements to sort, starting from 0

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Data" + }, + "splice": { + "name": "splice", + "params": [ + { + "name": "list", + "description": "

    Array to splice into

    \n", + "type": "Array" + }, + { + "name": "value", + "description": "

    value to be spliced in

    \n", + "type": "Any" + }, + { + "name": "position", + "description": "

    in the array from which to insert data

    \n", + "type": "Integer" + } + ], + "class": "p5", + "module": "Data" + }, + "subset": { + "name": "subset", + "params": [ + { + "name": "list", + "description": "

    Array to extract from

    \n", + "type": "Array" + }, + { + "name": "start", + "description": "

    position to begin

    \n", + "type": "Integer" + }, + { + "name": "count", + "description": "

    number of values to extract

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Data" + }, + "float": { + "name": "float", + "params": [ + { + "name": "str", + "description": "

    float string to parse

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "Data" + }, + "int": { + "name": "int", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "String|Boolean|Number" + }, + { + "name": "radix", + "description": "

    the radix to convert to (default: 10)

    \n", + "type": "Integer", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "ns", + "description": "

    values to parse

    \n", + "type": "Array" + }, + { + "name": "radix", + "description": "", + "type": "Integer", + "optional": true + } + ] + } + ] + }, + "str": { + "name": "str", + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "String|Boolean|Number|Array" + } + ], + "class": "p5", + "module": "Data" + }, + "byte": { + "name": "byte", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "String|Boolean|Number" + } + ] + }, + { + "params": [ + { + "name": "ns", + "description": "

    values to parse

    \n", + "type": "Array" + } + ] + } + ] + }, + "char": { + "name": "char", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "String|Number" + } + ] + }, + { + "params": [ + { + "name": "ns", + "description": "

    values to parse

    \n", + "type": "Array" + } + ] + } + ] + }, + "unchar": { + "name": "unchar", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "ns", + "description": "

    values to parse

    \n", + "type": "Array" + } + ] + } + ] + }, + "hex": { + "name": "hex", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "Number" + }, + { + "name": "digits", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "ns", + "description": "

    array of values to parse

    \n", + "type": "Number[]" + }, + { + "name": "digits", + "description": "", + "type": "Number", + "optional": true + } + ] + } + ] + }, + "unhex": { + "name": "unhex", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    value to parse

    \n", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "ns", + "description": "

    values to parse

    \n", + "type": "Array" + } + ] + } + ] + }, + "join": { + "name": "join", + "params": [ + { + "name": "list", + "description": "

    array of Strings to be joined

    \n", + "type": "Array" + }, + { + "name": "separator", + "description": "

    String to be placed between each item

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "Data" + }, + "match": { + "name": "match", + "params": [ + { + "name": "str", + "description": "

    the String to be searched

    \n", + "type": "String" + }, + { + "name": "regexp", + "description": "

    the regexp to be used for matching

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "Data" + }, + "matchAll": { + "name": "matchAll", + "params": [ + { + "name": "str", + "description": "

    the String to be searched

    \n", + "type": "String" + }, + { + "name": "regexp", + "description": "

    the regexp to be used for matching

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "Data" + }, + "nf": { + "name": "nf", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "

    the Number to format

    \n", + "type": "Number|String" + }, + { + "name": "left", + "description": "

    number of digits to the left of the\n decimal point

    \n", + "type": "Integer|String", + "optional": true + }, + { + "name": "right", + "description": "

    number of digits to the right of the\n decimal point

    \n", + "type": "Integer|String", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "nums", + "description": "

    the Numbers to format

    \n", + "type": "Array" + }, + { + "name": "left", + "description": "", + "type": "Integer|String", + "optional": true + }, + { + "name": "right", + "description": "", + "type": "Integer|String", + "optional": true + } + ] + } + ] + }, + "nfc": { + "name": "nfc", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "

    the Number to format

    \n", + "type": "Number|String" + }, + { + "name": "right", + "description": "

    number of digits to the right of the\n decimal point

    \n", + "type": "Integer|String", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "nums", + "description": "

    the Numbers to format

    \n", + "type": "Array" + }, + { + "name": "right", + "description": "", + "type": "Integer|String", + "optional": true + } + ] + } + ] + }, + "nfp": { + "name": "nfp", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "

    the Number to format

    \n", + "type": "Number" + }, + { + "name": "left", + "description": "

    number of digits to the left of the decimal\n point

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "right", + "description": "

    number of digits to the right of the\n decimal point

    \n", + "type": "Integer", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "nums", + "description": "

    the Numbers to format

    \n", + "type": "Number[]" + }, + { + "name": "left", + "description": "", + "type": "Integer", + "optional": true + }, + { + "name": "right", + "description": "", + "type": "Integer", + "optional": true + } + ] + } + ] + }, + "nfs": { + "name": "nfs", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "num", + "description": "

    the Number to format

    \n", + "type": "Number" + }, + { + "name": "left", + "description": "

    number of digits to the left of the decimal\n point

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "right", + "description": "

    number of digits to the right of the\n decimal point

    \n", + "type": "Integer", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "nums", + "description": "

    the Numbers to format

    \n", + "type": "Array" + }, + { + "name": "left", + "description": "", + "type": "Integer", + "optional": true + }, + { + "name": "right", + "description": "", + "type": "Integer", + "optional": true + } + ] + } + ] + }, + "split": { + "name": "split", + "params": [ + { + "name": "value", + "description": "

    the String to be split

    \n", + "type": "String" + }, + { + "name": "delim", + "description": "

    the String used to separate the data

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "Data" + }, + "splitTokens": { + "name": "splitTokens", + "params": [ + { + "name": "value", + "description": "

    the String to be split

    \n", + "type": "String" + }, + { + "name": "delim", + "description": "

    list of individual Strings that will be used as\n separators

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5", + "module": "Data" + }, + "trim": { + "name": "trim", + "class": "p5", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "str", + "description": "

    a String to be trimmed

    \n", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "strs", + "description": "

    an Array of Strings to be trimmed

    \n", + "type": "Array" + } + ] + } + ] + }, + "day": { + "name": "day", + "class": "p5", + "module": "IO" + }, + "hour": { + "name": "hour", + "class": "p5", + "module": "IO" + }, + "minute": { + "name": "minute", + "class": "p5", + "module": "IO" + }, + "millis": { + "name": "millis", + "class": "p5", + "module": "IO" + }, + "month": { + "name": "month", + "class": "p5", + "module": "IO" + }, + "second": { + "name": "second", + "class": "p5", + "module": "IO" + }, + "year": { + "name": "year", + "class": "p5", + "module": "IO" + }, + "beginGeometry": { + "name": "beginGeometry", + "class": "p5", + "module": "Shape" + }, + "endGeometry": { + "name": "endGeometry", + "class": "p5", + "module": "Shape" + }, + "buildGeometry": { + "name": "buildGeometry", + "params": [ + { + "name": "callback", + "description": "

    A function that draws shapes.

    \n", + "type": "Function" + } + ], + "class": "p5", + "module": "Shape" + }, + "freeGeometry": { + "name": "freeGeometry", + "params": [ + { + "name": "geometry", + "description": "

    The geometry whose resources should be freed

    \n", + "type": "p5.Geometry" + } + ], + "class": "p5", + "module": "Shape" + }, + "plane": { + "name": "plane", + "params": [ + { + "name": "width", + "description": "

    width of the plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "height", + "description": "

    height of the plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "detailX", + "description": "

    Optional number of triangle\n subdivisions in x-dimension

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    Optional number of triangle\n subdivisions in y-dimension

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "box": { + "name": "box", + "params": [ + { + "name": "width", + "description": "

    width of the box

    \n", + "type": "Number", + "optional": true + }, + { + "name": "height", + "description": "

    height of the box

    \n", + "type": "Number", + "optional": true + }, + { + "name": "depth", + "description": "

    depth of the box

    \n", + "type": "Number", + "optional": true + }, + { + "name": "detailX", + "description": "

    Optional number of triangle\n subdivisions in x-dimension

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    Optional number of triangle\n subdivisions in y-dimension

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "sphere": { + "name": "sphere", + "params": [ + { + "name": "radius", + "description": "

    radius of circle

    \n", + "type": "Number", + "optional": true + }, + { + "name": "detailX", + "description": "

    optional number of subdivisions in x-dimension

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    optional number of subdivisions in y-dimension

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "cylinder": { + "name": "cylinder", + "params": [ + { + "name": "radius", + "description": "

    radius of the surface

    \n", + "type": "Number", + "optional": true + }, + { + "name": "height", + "description": "

    height of the cylinder

    \n", + "type": "Number", + "optional": true + }, + { + "name": "detailX", + "description": "

    number of subdivisions in x-dimension;\n default is 24

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    number of subdivisions in y-dimension;\n default is 1

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "bottomCap", + "description": "

    whether to draw the bottom of the cylinder

    \n", + "type": "Boolean", + "optional": true + }, + { + "name": "topCap", + "description": "

    whether to draw the top of the cylinder

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "cone": { + "name": "cone", + "params": [ + { + "name": "radius", + "description": "

    radius of the bottom surface

    \n", + "type": "Number", + "optional": true + }, + { + "name": "height", + "description": "

    height of the cone

    \n", + "type": "Number", + "optional": true + }, + { + "name": "detailX", + "description": "

    number of segments,\n the more segments the smoother geometry\n default is 24

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    number of segments,\n the more segments the smoother geometry\n default is 1

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "cap", + "description": "

    whether to draw the base of the cone

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "ellipsoid": { + "name": "ellipsoid", + "params": [ + { + "name": "radiusx", + "description": "

    x-radius of ellipsoid

    \n", + "type": "Number", + "optional": true + }, + { + "name": "radiusy", + "description": "

    y-radius of ellipsoid

    \n", + "type": "Number", + "optional": true + }, + { + "name": "radiusz", + "description": "

    z-radius of ellipsoid

    \n", + "type": "Number", + "optional": true + }, + { + "name": "detailX", + "description": "

    number of segments,\n the more segments the smoother geometry\n default is 24. Avoid detail number above\n 150, it may crash the browser.

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    number of segments,\n the more segments the smoother geometry\n default is 16. Avoid detail number above\n 150, it may crash the browser.

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "torus": { + "name": "torus", + "params": [ + { + "name": "radius", + "description": "

    radius of the whole ring

    \n", + "type": "Number", + "optional": true + }, + { + "name": "tubeRadius", + "description": "

    radius of the tube

    \n", + "type": "Number", + "optional": true + }, + { + "name": "detailX", + "description": "

    number of segments in x-dimension,\n the more segments the smoother geometry\n default is 24

    \n", + "type": "Integer", + "optional": true + }, + { + "name": "detailY", + "description": "

    number of segments in y-dimension,\n the more segments the smoother geometry\n default is 16

    \n", + "type": "Integer", + "optional": true + } + ], + "class": "p5", + "module": "Shape" + }, + "orbitControl": { + "name": "orbitControl", + "params": [ + { + "name": "sensitivityX", + "description": "

    sensitivity to mouse movement along X axis

    \n", + "type": "Number", + "optional": true + }, + { + "name": "sensitivityY", + "description": "

    sensitivity to mouse movement along Y axis

    \n", + "type": "Number", + "optional": true + }, + { + "name": "sensitivityZ", + "description": "

    sensitivity to scroll movement along Z axis

    \n", + "type": "Number", + "optional": true + }, + { + "name": "options", + "description": "

    An optional object that can contain additional settings,\ndisableTouchActions - Boolean, default value is true.\nSetting this to true makes mobile interactions smoother by preventing\naccidental interactions with the page while orbiting. But if you're already\ndoing it via css or want the default touch actions, consider setting it to false.\nfreeRotation - Boolean, default value is false.\nBy default, horizontal movement of the mouse or touch pointer rotates the camera\naround the y-axis, and vertical movement rotates the camera around the x-axis.\nBut if setting this option to true, the camera always rotates in the direction\nthe pointer is moving. For zoom and move, the behavior is the same regardless of\ntrue/false.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5", + "module": "3D" + }, + "debugMode": { + "name": "debugMode", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "mode", + "description": "

    either GRID or AXES

    \n", + "type": "Constant" + } + ] + }, + { + "params": [ + { + "name": "mode", + "description": "", + "type": "Constant" + }, + { + "name": "gridSize", + "description": "

    size of one side of the grid

    \n", + "type": "Number", + "optional": true + }, + { + "name": "gridDivisions", + "description": "

    number of divisions in the grid

    \n", + "type": "Number", + "optional": true + }, + { + "name": "xOff", + "description": "

    X axis offset from origin (0,0,0)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "yOff", + "description": "

    Y axis offset from origin (0,0,0)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "zOff", + "description": "

    Z axis offset from origin (0,0,0)

    \n", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "mode", + "description": "", + "type": "Constant" + }, + { + "name": "axesSize", + "description": "

    size of axes icon

    \n", + "type": "Number", + "optional": true + }, + { + "name": "xOff", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "yOff", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "zOff", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "gridSize", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "gridDivisions", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "gridXOff", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "gridYOff", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "gridZOff", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "axesSize", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "axesXOff", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "axesYOff", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "axesZOff", + "description": "", + "type": "Number", + "optional": true + } + ] + } + ] + }, + "noDebugMode": { + "name": "noDebugMode", + "class": "p5", + "module": "3D" + }, + "ambientLight": { + "name": "ambientLight", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to\n the current color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value\n relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value\n relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "

    alpha value relative to current\n color range (default is 0-255)

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "gray", + "description": "

    number specifying value between\n white and black

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    a color string

    \n", + "type": "String" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "values", + "description": "

    an array containing the red,green,blue &\n and alpha components of the color

    \n", + "type": "Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color

    \n", + "type": "p5.Color" + } + ], + "chainable": 1 + } + ] + }, + "specularColor": { + "name": "specularColor", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to\n the current color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value\n relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value\n relative to the current color range

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "gray", + "description": "

    number specifying value between\n white and black

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    color as a CSS string

    \n", + "type": "String" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "values", + "description": "

    color as an array containing the\n red, green, and blue components

    \n", + "type": "Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color

    \n", + "type": "p5.Color" + } + ], + "chainable": 1 + } + ] + }, + "directionalLight": { + "name": "directionalLight", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to the current\n color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value relative to the\n current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value relative to the\n current color range

    \n", + "type": "Number" + }, + { + "name": "x", + "description": "

    x component of direction (inclusive range of -1 to 1)

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component of direction (inclusive range of -1 to 1)

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    z component of direction (inclusive range of -1 to 1)

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "", + "type": "Number" + }, + { + "name": "v2", + "description": "", + "type": "Number" + }, + { + "name": "v3", + "description": "", + "type": "Number" + }, + { + "name": "direction", + "description": "

    direction of light as a\n p5.Vector

    \n", + "type": "p5.Vector" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color,\n as an array, or as a CSS string

    \n", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "", + "type": "p5.Color|Number[]|String" + }, + { + "name": "direction", + "description": "", + "type": "p5.Vector" + } + ], + "chainable": 1 + } + ] + }, + "pointLight": { + "name": "pointLight", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to the current\n color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value relative to the\n current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value relative to the\n current color range

    \n", + "type": "Number" + }, + { + "name": "x", + "description": "

    x component of position

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component of position

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    z component of position

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "", + "type": "Number" + }, + { + "name": "v2", + "description": "", + "type": "Number" + }, + { + "name": "v3", + "description": "", + "type": "Number" + }, + { + "name": "position", + "description": "

    of light as a p5.Vector

    \n", + "type": "p5.Vector" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color,\n as an array, or as a CSS string

    \n", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "", + "type": "p5.Color|Number[]|String" + }, + { + "name": "position", + "description": "", + "type": "p5.Vector" + } + ], + "chainable": 1 + } + ] + }, + "imageLight": { + "name": "imageLight", + "params": [ + { + "name": "img", + "description": "

    image for the background

    \n", + "type": "p5.image" + } + ], + "class": "p5", + "module": "3D" + }, + "lights": { + "name": "lights", + "class": "p5", + "module": "3D" + }, + "lightFalloff": { + "name": "lightFalloff", + "params": [ + { + "name": "constant", + "description": "

    CONSTANT value for determining falloff

    \n", + "type": "Number" + }, + { + "name": "linear", + "description": "

    LINEAR value for determining falloff

    \n", + "type": "Number" + }, + { + "name": "quadratic", + "description": "

    QUADRATIC value for determining falloff

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "3D" + }, + "spotLight": { + "name": "spotLight", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "x", + "description": "

    x component of position

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component of position

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    z component of position

    \n", + "type": "Number" + }, + { + "name": "rx", + "description": "

    x component of light direction (inclusive range of -1 to 1)

    \n", + "type": "Number" + }, + { + "name": "ry", + "description": "

    y component of light direction (inclusive range of -1 to 1)

    \n", + "type": "Number" + }, + { + "name": "rz", + "description": "

    z component of light direction (inclusive range of -1 to 1)

    \n", + "type": "Number" + }, + { + "name": "angle", + "description": "

    angle of cone. Defaults to PI/3

    \n", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "

    concentration of cone. Defaults to 100

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color,\n as an array, or as a CSS string

    \n", + "type": "p5.Color|Number[]|String" + }, + { + "name": "position", + "description": "

    position of light as a p5.Vector

    \n", + "type": "p5.Vector" + }, + { + "name": "direction", + "description": "

    direction of light as a p5.Vector

    \n", + "type": "p5.Vector" + }, + { + "name": "angle", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "", + "type": "Number" + }, + { + "name": "v2", + "description": "", + "type": "Number" + }, + { + "name": "v3", + "description": "", + "type": "Number" + }, + { + "name": "position", + "description": "", + "type": "p5.Vector" + }, + { + "name": "direction", + "description": "", + "type": "p5.Vector" + }, + { + "name": "angle", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number" + }, + { + "name": "direction", + "description": "", + "type": "p5.Vector" + }, + { + "name": "angle", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "", + "type": "p5.Color|Number[]|String" + }, + { + "name": "position", + "description": "", + "type": "p5.Vector" + }, + { + "name": "rx", + "description": "", + "type": "Number" + }, + { + "name": "ry", + "description": "", + "type": "Number" + }, + { + "name": "rz", + "description": "", + "type": "Number" + }, + { + "name": "angle", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "", + "type": "Number" + }, + { + "name": "v2", + "description": "", + "type": "Number" + }, + { + "name": "v3", + "description": "", + "type": "Number" + }, + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number" + }, + { + "name": "direction", + "description": "", + "type": "p5.Vector" + }, + { + "name": "angle", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "", + "type": "Number" + }, + { + "name": "v2", + "description": "", + "type": "Number" + }, + { + "name": "v3", + "description": "", + "type": "Number" + }, + { + "name": "position", + "description": "", + "type": "p5.Vector" + }, + { + "name": "rx", + "description": "", + "type": "Number" + }, + { + "name": "ry", + "description": "", + "type": "Number" + }, + { + "name": "rz", + "description": "", + "type": "Number" + }, + { + "name": "angle", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "color", + "description": "", + "type": "p5.Color|Number[]|String" + }, + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number" + }, + { + "name": "rx", + "description": "", + "type": "Number" + }, + { + "name": "ry", + "description": "", + "type": "Number" + }, + { + "name": "rz", + "description": "", + "type": "Number" + }, + { + "name": "angle", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "concentration", + "description": "", + "type": "Number", + "optional": true + } + ] + } + ] + }, + "noLights": { + "name": "noLights", + "class": "p5", + "module": "3D" + }, + "loadModel": { + "name": "loadModel", + "class": "p5", + "module": "Shape", + "overloads": [ + { + "params": [ + { + "name": "path", + "description": "

    Path of the model to be loaded

    \n", + "type": "String" + }, + { + "name": "normalize", + "description": "

    If true, scale the model to a\n standardized size when loading

    \n", + "type": "Boolean" + }, + { + "name": "successCallback", + "description": "

    Function to be called\n once the model is loaded. Will be passed\n the 3D model object.

    \n", + "type": "function(p5.Geometry)", + "optional": true + }, + { + "name": "failureCallback", + "description": "

    called with event error if\n the model fails to load.

    \n", + "type": "Function(Event)", + "optional": true + }, + { + "name": "fileType", + "description": "

    The file extension of the model\n (.stl, .obj).

    \n", + "type": "String", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "successCallback", + "description": "", + "type": "function(p5.Geometry)", + "optional": true + }, + { + "name": "failureCallback", + "description": "", + "type": "Function(Event)", + "optional": true + }, + { + "name": "fileType", + "description": "", + "type": "String", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object", + "optional": true, + "props": [ + { + "name": "successCallback", + "description": "", + "type": "function(p5.Geometry)", + "optional": true + }, + { + "name": "failureCallback", + "description": "", + "type": "Function(Event)", + "optional": true + }, + { + "name": "fileType", + "description": "", + "type": "String", + "optional": true + }, + { + "name": "normalize", + "description": "", + "type": "Boolean", + "optional": true + }, + { + "name": "flipU", + "description": "", + "type": "Boolean", + "optional": true + }, + { + "name": "flipV", + "description": "", + "type": "Boolean", + "optional": true + } + ] + } + ] + } + ] + }, + "model": { + "name": "model", + "params": [ + { + "name": "model", + "description": "

    Loaded 3d model to be rendered

    \n", + "type": "p5.Geometry" + } + ], + "class": "p5", + "module": "Shape" + }, + "loadShader": { + "name": "loadShader", + "params": [ + { + "name": "vertFilename", + "description": "

    path to file containing vertex shader\nsource code

    \n", + "type": "String" + }, + { + "name": "fragFilename", + "description": "

    path to file containing fragment shader\nsource code

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    callback to be executed after loadShader\ncompletes. On success, the p5.Shader object is passed as the first argument.

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    callback to be executed when an error\noccurs inside loadShader. On error, the error is passed as the first\nargument.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "3D" + }, + "createShader": { + "name": "createShader", + "params": [ + { + "name": "vertSrc", + "description": "

    source code for the vertex shader

    \n", + "type": "String" + }, + { + "name": "fragSrc", + "description": "

    source code for the fragment shader

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "3D" + }, + "createFilterShader": { + "name": "createFilterShader", + "params": [ + { + "name": "fragSrc", + "description": "

    source code for the fragment shader

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "3D" + }, + "shader": { + "name": "shader", + "params": [ + { + "name": "s", + "description": "

    the p5.Shader object\nto use for rendering shapes.

    \n", + "type": "p5.Shader" + } + ], + "class": "p5", + "module": "3D" + }, + "resetShader": { + "name": "resetShader", + "class": "p5", + "module": "3D" + }, + "texture": { + "name": "texture", + "params": [ + { + "name": "tex", + "description": "

    image to use as texture

    \n", + "type": "p5.Image|p5.MediaElement|p5.Graphics|p5.Texture|p5.Framebuffer|p5.FramebufferTexture" + } + ], + "class": "p5", + "module": "3D" + }, + "textureMode": { + "name": "textureMode", + "params": [ + { + "name": "mode", + "description": "

    either IMAGE or NORMAL

    \n", + "type": "Constant" + } + ], + "class": "p5", + "module": "3D" + }, + "textureWrap": { + "name": "textureWrap", + "params": [ + { + "name": "wrapX", + "description": "

    either CLAMP, REPEAT, or MIRROR

    \n", + "type": "Constant" + }, + { + "name": "wrapY", + "description": "

    either CLAMP, REPEAT, or MIRROR

    \n", + "type": "Constant", + "optional": true + } + ], + "class": "p5", + "module": "3D" + }, + "normalMaterial": { + "name": "normalMaterial", + "class": "p5", + "module": "3D" + }, + "ambientMaterial": { + "name": "ambientMaterial", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to the current\n color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value relative to the\n current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value relative to the\n current color range

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "gray", + "description": "

    number specifying value between\n white and black

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color,\n as an array, or as a CSS string

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "chainable": 1 + } + ] + }, + "emissiveMaterial": { + "name": "emissiveMaterial", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to the current\n color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value relative to the\n current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value relative to the\n current color range

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "

    alpha value relative to current color\n range (default is 0-255)

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "gray", + "description": "

    number specifying value between\n white and black

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color,\n as an array, or as a CSS string

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "chainable": 1 + } + ] + }, + "specularMaterial": { + "name": "specularMaterial", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "gray", + "description": "

    number specifying value between white and black.

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "

    alpha value relative to current color range\n (default is 0-255)

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "

    red or hue value relative to\n the current color range

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    green or saturation value\n relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "v3", + "description": "

    blue or brightness value\n relative to the current color range

    \n", + "type": "Number" + }, + { + "name": "alpha", + "description": "", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "color", + "description": "

    color as a p5.Color,\n as an array, or as a CSS string

    \n", + "type": "p5.Color|Number[]|String" + } + ], + "chainable": 1 + } + ] + }, + "shininess": { + "name": "shininess", + "params": [ + { + "name": "shine", + "description": "

    degree of shininess

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "3D" + }, + "metalness": { + "name": "metalness", + "params": [ + { + "name": "metallic", + "description": "
      \n
    • The degree of metalness.
    • \n
    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "3D" + }, + "camera": { + "name": "camera", + "params": [ + { + "name": "x", + "description": "

    camera position value on x axis

    \n", + "type": "Number", + "optional": true + }, + { + "name": "y", + "description": "

    camera position value on y axis

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    camera position value on z axis

    \n", + "type": "Number", + "optional": true + }, + { + "name": "centerX", + "description": "

    x coordinate representing center of the sketch

    \n", + "type": "Number", + "optional": true + }, + { + "name": "centerY", + "description": "

    y coordinate representing center of the sketch

    \n", + "type": "Number", + "optional": true + }, + { + "name": "centerZ", + "description": "

    z coordinate representing center of the sketch

    \n", + "type": "Number", + "optional": true + }, + { + "name": "upX", + "description": "

    x component of direction 'up' from camera

    \n", + "type": "Number", + "optional": true + }, + { + "name": "upY", + "description": "

    y component of direction 'up' from camera

    \n", + "type": "Number", + "optional": true + }, + { + "name": "upZ", + "description": "

    z component of direction 'up' from camera

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "3D" + }, + "perspective": { + "name": "perspective", + "params": [ + { + "name": "fovy", + "description": "

    camera frustum vertical field of view,\n from bottom to top of view, in angleMode units

    \n", + "type": "Number", + "optional": true + }, + { + "name": "aspect", + "description": "

    camera frustum aspect ratio

    \n", + "type": "Number", + "optional": true + }, + { + "name": "near", + "description": "

    frustum near plane length

    \n", + "type": "Number", + "optional": true + }, + { + "name": "far", + "description": "

    frustum far plane length

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "3D" + }, + "linePerspective": { + "name": "linePerspective", + "class": "p5", + "module": "3D", + "overloads": [ + { + "params": [ + { + "name": "enable", + "description": "
      \n
    • Set to true to enable line perspective, false to disable.
    • \n
    \n", + "type": "Boolean" + } + ] + }, + { + "params": [] + } + ] + }, + "ortho": { + "name": "ortho", + "params": [ + { + "name": "left", + "description": "

    camera frustum left plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "right", + "description": "

    camera frustum right plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "bottom", + "description": "

    camera frustum bottom plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "top", + "description": "

    camera frustum top plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "near", + "description": "

    camera frustum near plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "far", + "description": "

    camera frustum far plane

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "3D" + }, + "frustum": { + "name": "frustum", + "params": [ + { + "name": "left", + "description": "

    camera frustum left plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "right", + "description": "

    camera frustum right plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "bottom", + "description": "

    camera frustum bottom plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "top", + "description": "

    camera frustum top plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "near", + "description": "

    camera frustum near plane

    \n", + "type": "Number", + "optional": true + }, + { + "name": "far", + "description": "

    camera frustum far plane

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "3D" + }, + "createCamera": { + "name": "createCamera", + "class": "p5", + "module": "3D" + }, + "setCamera": { + "name": "setCamera", + "params": [ + { + "name": "cam", + "description": "

    p5.Camera object

    \n", + "type": "p5.Camera" + } + ], + "class": "p5", + "module": "3D" + }, + "setAttributes": { + "name": "setAttributes", + "class": "p5", + "module": "Rendering", + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "

    Name of attribute

    \n", + "type": "String" + }, + { + "name": "value", + "description": "

    New value of named attribute

    \n", + "type": "Boolean" + } + ] + }, + { + "params": [ + { + "name": "obj", + "description": "

    object with key-value pairs

    \n", + "type": "Object" + } + ] + } + ] + }, + "getAudioContext": { + "name": "getAudioContext", + "class": "p5", + "module": "p5.sound" + }, + "userStartAudio": { + "params": [ + { + "name": "elements", + "description": "

    This argument can be an Element,\n Selector String, NodeList, p5.Element,\n jQuery Element, or an Array of any of those.

    \n", + "type": "Element|Array", + "optional": true + }, + { + "name": "callback", + "description": "

    Callback to invoke when the AudioContext\n has started

    \n", + "type": "Function", + "optional": true + } + ], + "name": "userStartAudio", + "class": "p5", + "module": "p5.sound" + }, + "getOutputVolume": { + "name": "getOutputVolume", + "class": "p5", + "module": "p5.sound" + }, + "outputVolume": { + "name": "outputVolume", + "params": [ + { + "name": "volume", + "description": "

    Volume (amplitude) between 0.0\n and 1.0 or modulating signal/oscillator

    \n", + "type": "Number|Object" + }, + { + "name": "rampTime", + "description": "

    Fade for t seconds

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    Schedule this event to happen at\n t seconds in the future

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5", + "module": "p5.sound" + }, + "soundOut": { + "name": "soundOut", + "class": "p5", + "module": "p5.sound" + }, + "sampleRate": { + "name": "sampleRate", + "class": "p5", + "module": "p5.sound" + }, + "freqToMidi": { + "name": "freqToMidi", + "params": [ + { + "name": "frequency", + "description": "

    A freqeuncy, for example, the \"A\"\n above Middle C is 440Hz

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "p5.sound" + }, + "midiToFreq": { + "name": "midiToFreq", + "params": [ + { + "name": "midiNote", + "description": "

    The number of a MIDI note

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "p5.sound" + }, + "soundFormats": { + "name": "soundFormats", + "params": [ + { + "name": "formats", + "description": "

    i.e. 'mp3', 'wav', 'ogg'

    \n", + "type": "String", + "optional": true, + "multiple": true + } + ], + "class": "p5", + "module": "p5.sound" + }, + "saveSound": { + "name": "saveSound", + "params": [ + { + "name": "soundFile", + "description": "

    p5.SoundFile that you wish to save

    \n", + "type": "p5.SoundFile" + }, + { + "name": "fileName", + "description": "

    name of the resulting .wav file.

    \n", + "type": "String" + } + ], + "class": "p5", + "module": "p5.sound" + }, + "loadSound": { + "name": "loadSound", + "params": [ + { + "name": "path", + "description": "

    Path to the sound file, or an array with\n paths to soundfiles in multiple formats\n i.e. ['sound.ogg', 'sound.mp3'].\n Alternately, accepts an object: either\n from the HTML5 File API, or a p5.File.

    \n", + "type": "String|Array" + }, + { + "name": "successCallback", + "description": "

    Name of a function to call once file loads

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    Name of a function to call if there is\n an error loading the file.

    \n", + "type": "Function", + "optional": true + }, + { + "name": "whileLoading", + "description": "

    Name of a function to call while file is loading.\n This function will receive the percentage loaded\n so far, from 0.0 to 1.0.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "p5.sound" + }, + "createConvolver": { + "name": "createConvolver", + "params": [ + { + "name": "path", + "description": "

    path to a sound file

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    function to call if loading is successful.\n The object will be passed in as the argument\n to the callback function.

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    function to call if loading is not successful.\n A custom error will be passed in as the argument\n to the callback function.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5", + "module": "p5.sound" + }, + "setBPM": { + "name": "setBPM", + "params": [ + { + "name": "BPM", + "description": "

    Beats Per Minute

    \n", + "type": "Number" + }, + { + "name": "rampTime", + "description": "

    Seconds from now

    \n", + "type": "Number" + } + ], + "class": "p5", + "module": "p5.sound" + } + }, + "p5.Color": { + "toString": { + "name": "toString", + "params": [ + { + "name": "format", + "description": "

    how the color string will be formatted.\nLeaving this empty formats the string as rgba(r, g, b, a).\n'#rgb' '#rgba' '#rrggbb' and '#rrggbbaa' format as hexadecimal color codes.\n'rgb' 'hsb' and 'hsl' return the color formatted in the specified color mode.\n'rgba' 'hsba' and 'hsla' are the same as above but with alpha channels.\n'rgb%' 'hsb%' 'hsl%' 'rgba%' 'hsba%' and 'hsla%' format as percentages.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.Color", + "module": "Color" + }, + "setRed": { + "name": "setRed", + "params": [ + { + "name": "red", + "description": "

    the new red value.

    \n", + "type": "Number" + } + ], + "class": "p5.Color", + "module": "Color" + }, + "setGreen": { + "name": "setGreen", + "params": [ + { + "name": "green", + "description": "

    the new green value.

    \n", + "type": "Number" + } + ], + "class": "p5.Color", + "module": "Color" + }, + "setBlue": { + "name": "setBlue", + "params": [ + { + "name": "blue", + "description": "

    the new blue value.

    \n", + "type": "Number" + } + ], + "class": "p5.Color", + "module": "Color" + }, + "setAlpha": { + "name": "setAlpha", + "params": [ + { + "name": "alpha", + "description": "

    the new alpha value.

    \n", + "type": "Number" + } + ], + "class": "p5.Color", + "module": "Color" + } + }, + "p5.Element": { + "elt": { + "name": "elt", + "class": "p5.Element", + "module": "DOM" + }, + "width": { + "name": "width", + "class": "p5.Element", + "module": "DOM" + }, + "height": { + "name": "height", + "class": "p5.Element", + "module": "DOM" + }, + "parent": { + "name": "parent", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "parent", + "description": "

    ID, p5.Element,\n or HTMLElement of desired parent element.

    \n", + "type": "String|p5.Element|Object" + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "id": { + "name": "id", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "id", + "description": "

    ID of the element.

    \n", + "type": "String" + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "class": { + "name": "class", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "class", + "description": "

    class to add.

    \n", + "type": "String" + } + ], + "chainable": 1 + }, + { + "params": [] + } + ] + }, + "mousePressed": { + "name": "mousePressed", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse is\n pressed over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "doubleClicked": { + "name": "doubleClicked", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse is\n double clicked over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "mouseWheel": { + "name": "mouseWheel", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse wheel is\n scrolled over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "mouseReleased": { + "name": "mouseReleased", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse is\n pressed over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "mouseClicked": { + "name": "mouseClicked", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse is\n pressed and released over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "mouseMoved": { + "name": "mouseMoved", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse\n moves over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "mouseOver": { + "name": "mouseOver", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse\n moves onto the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "mouseOut": { + "name": "mouseOut", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the mouse\n moves off the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "touchStarted": { + "name": "touchStarted", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the touch\n starts.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "touchMoved": { + "name": "touchMoved", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the touch\n moves over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "touchEnded": { + "name": "touchEnded", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the touch\n ends.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "dragOver": { + "name": "dragOver", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the file is\n dragged over the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "dragLeave": { + "name": "dragLeave", + "params": [ + { + "name": "fxn", + "description": "

    function to call when the file is\n dragged off the element.\n false disables the function.

    \n", + "type": "Function|Boolean" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "addClass": { + "name": "addClass", + "params": [ + { + "name": "class", + "description": "

    name of class to add

    \n", + "type": "String" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "removeClass": { + "name": "removeClass", + "params": [ + { + "name": "class", + "description": "

    name of class to remove

    \n", + "type": "String" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "hasClass": { + "name": "hasClass", + "params": [ + { + "name": "c", + "description": "

    class name of class to check

    \n", + "type": "String" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "toggleClass": { + "name": "toggleClass", + "params": [ + { + "name": "c", + "description": "

    class name to toggle

    \n", + "type": "String" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "child": { + "name": "child", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "child", + "description": "

    the ID, DOM node, or p5.Element\n to add to the current element

    \n", + "type": "String|p5.Element", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "center": { + "name": "center", + "params": [ + { + "name": "align", + "description": "

    passing 'vertical', 'horizontal' aligns element accordingly

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "html": { + "name": "html", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "html", + "description": "

    the HTML to be placed inside the element

    \n", + "type": "String", + "optional": true + }, + { + "name": "append", + "description": "

    whether to append HTML to existing

    \n", + "type": "Boolean", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "position": { + "name": "position", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "x", + "description": "

    x-position relative to upper left of window (optional)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "y", + "description": "

    y-position relative to upper left of window (optional)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "positionType", + "description": "

    it can be static, fixed, relative, sticky, initial or inherit (optional)

    \n", + "type": "String", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "style": { + "name": "style", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [ + { + "name": "property", + "description": "

    style property to set.

    \n", + "type": "String" + } + ] + }, + { + "params": [ + { + "name": "property", + "description": "", + "type": "String" + }, + { + "name": "value", + "description": "

    value to assign to the property.

    \n", + "type": "String|p5.Color" + } + ], + "chainable": 1 + } + ] + }, + "attribute": { + "name": "attribute", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "attr", + "description": "

    attribute to set.

    \n", + "type": "String" + }, + { + "name": "value", + "description": "

    value to assign to the attribute.

    \n", + "type": "String" + } + ], + "chainable": 1 + } + ] + }, + "removeAttribute": { + "name": "removeAttribute", + "params": [ + { + "name": "attr", + "description": "

    attribute to remove.

    \n", + "type": "String" + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "value": { + "name": "value", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "value", + "description": "", + "type": "String|Number" + } + ], + "chainable": 1 + } + ] + }, + "show": { + "name": "show", + "class": "p5.Element", + "module": "DOM" + }, + "hide": { + "name": "hide", + "class": "p5.Element", + "module": "DOM" + }, + "size": { + "name": "size", + "class": "p5.Element", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "w", + "description": "

    width of the element, either AUTO, or a number.

    \n", + "type": "Number|Constant" + }, + { + "name": "h", + "description": "

    height of the element, either AUTO, or a number.

    \n", + "type": "Number|Constant", + "optional": true + } + ], + "chainable": 1 + } + ] + }, + "remove": { + "name": "remove", + "class": "p5.Element", + "module": "DOM" + }, + "drop": { + "name": "drop", + "params": [ + { + "name": "callback", + "description": "

    called when a file loads. Called once for each file dropped.

    \n", + "type": "Function" + }, + { + "name": "fxn", + "description": "

    called once when any files are dropped.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5.Element", + "module": "DOM" + }, + "draggable": { + "name": "draggable", + "params": [ + { + "name": "elmnt", + "description": "

    pass another p5.Element

    \n", + "type": "p5.Element", + "optional": true + } + ], + "class": "p5.Element", + "module": "DOM" + } + }, + "p5.Graphics": { + "reset": { + "name": "reset", + "class": "p5.Graphics", + "module": "Rendering" + }, + "remove": { + "name": "remove", + "class": "p5.Graphics", + "module": "Rendering" + }, + "createFramebuffer": { + "name": "createFramebuffer", + "class": "p5.Graphics", + "module": "Rendering" + } + }, + "JSON": { + "stringify": { + "name": "stringify", + "params": [ + { + "name": "object", + "description": "

    :Javascript object that you would like to convert to JSON

    \n", + "type": "Object" + } + ], + "class": "JSON", + "module": "Foundation" + } + }, + "console": { + "log": { + "name": "log", + "params": [ + { + "name": "message", + "description": "

    :Message that you would like to print to the console

    \n", + "type": "String|Expression|Object" + } + ], + "class": "console", + "module": "Foundation" + } + }, + "p5.TypedDict": { + "size": { + "name": "size", + "class": "p5.TypedDict", + "module": "Data" + }, + "hasKey": { + "name": "hasKey", + "params": [ + { + "name": "key", + "description": "

    that you want to look up

    \n", + "type": "Number|String" + } + ], + "class": "p5.TypedDict", + "module": "Data" + }, + "get": { + "name": "get", + "params": [ + { + "name": "the", + "description": "

    key you want to access

    \n", + "type": "Number|String" + } + ], + "class": "p5.TypedDict", + "module": "Data" + }, + "set": { + "name": "set", + "params": [ + { + "name": "key", + "description": "", + "type": "Number|String" + }, + { + "name": "value", + "description": "", + "type": "Number|String" + } + ], + "class": "p5.TypedDict", + "module": "Data" + }, + "create": { + "name": "create", + "class": "p5.TypedDict", + "module": "Data", + "overloads": [ + { + "params": [ + { + "name": "key", + "description": "", + "type": "Number|String" + }, + { + "name": "value", + "description": "", + "type": "Number|String" + } + ] + }, + { + "params": [ + { + "name": "obj", + "description": "

    key/value pair

    \n", + "type": "Object" + } + ] + } + ] + }, + "clear": { + "name": "clear", + "class": "p5.TypedDict", + "module": "Data" + }, + "remove": { + "name": "remove", + "params": [ + { + "name": "key", + "description": "

    for the pair to remove

    \n", + "type": "Number|String" + } + ], + "class": "p5.TypedDict", + "module": "Data" + }, + "print": { + "name": "print", + "class": "p5.TypedDict", + "module": "Data" + }, + "saveTable": { + "name": "saveTable", + "class": "p5.TypedDict", + "module": "Data" + }, + "saveJSON": { + "name": "saveJSON", + "class": "p5.TypedDict", + "module": "Data" + } + }, + "p5.NumberDict": { + "add": { + "name": "add", + "params": [ + { + "name": "Key", + "description": "

    for the value you wish to add to

    \n", + "type": "Number" + }, + { + "name": "Number", + "description": "

    to add to the value

    \n", + "type": "Number" + } + ], + "class": "p5.NumberDict", + "module": "Data" + }, + "sub": { + "name": "sub", + "params": [ + { + "name": "Key", + "description": "

    for the value you wish to subtract from

    \n", + "type": "Number" + }, + { + "name": "Number", + "description": "

    to subtract from the value

    \n", + "type": "Number" + } + ], + "class": "p5.NumberDict", + "module": "Data" + }, + "mult": { + "name": "mult", + "params": [ + { + "name": "Key", + "description": "

    for value you wish to multiply

    \n", + "type": "Number" + }, + { + "name": "Amount", + "description": "

    to multiply the value by

    \n", + "type": "Number" + } + ], + "class": "p5.NumberDict", + "module": "Data" + }, + "div": { + "name": "div", + "params": [ + { + "name": "Key", + "description": "

    for value you wish to divide

    \n", + "type": "Number" + }, + { + "name": "Amount", + "description": "

    to divide the value by

    \n", + "type": "Number" + } + ], + "class": "p5.NumberDict", + "module": "Data" + }, + "minValue": { + "name": "minValue", + "class": "p5.NumberDict", + "module": "Data" + }, + "maxValue": { + "name": "maxValue", + "class": "p5.NumberDict", + "module": "Data" + }, + "minKey": { + "name": "minKey", + "class": "p5.NumberDict", + "module": "Data" + }, + "maxKey": { + "name": "maxKey", + "class": "p5.NumberDict", + "module": "Data" + } + }, + "p5.MediaElement": { + "src": { + "name": "src", + "class": "p5.MediaElement", + "module": "DOM" + }, + "play": { + "name": "play", + "class": "p5.MediaElement", + "module": "DOM" + }, + "stop": { + "name": "stop", + "class": "p5.MediaElement", + "module": "DOM" + }, + "pause": { + "name": "pause", + "class": "p5.MediaElement", + "module": "DOM" + }, + "loop": { + "name": "loop", + "class": "p5.MediaElement", + "module": "DOM" + }, + "noLoop": { + "name": "noLoop", + "class": "p5.MediaElement", + "module": "DOM" + }, + "autoplay": { + "name": "autoplay", + "params": [ + { + "name": "shouldAutoplay", + "description": "

    whether the element should autoplay.

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5.MediaElement", + "module": "DOM" + }, + "volume": { + "name": "volume", + "class": "p5.MediaElement", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "val", + "description": "

    volume between 0.0 and 1.0.

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "speed": { + "name": "speed", + "class": "p5.MediaElement", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "speed", + "description": "

    speed multiplier for playback.

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "time": { + "name": "time", + "class": "p5.MediaElement", + "module": "DOM", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "time", + "description": "

    time to jump to (in seconds).

    \n", + "type": "Number" + } + ], + "chainable": 1 + } + ] + }, + "duration": { + "name": "duration", + "class": "p5.MediaElement", + "module": "DOM" + }, + "onended": { + "name": "onended", + "params": [ + { + "name": "callback", + "description": "

    function to call when playback ends.\n The p5.MediaElement is passed as\n the argument.

    \n", + "type": "Function" + } + ], + "class": "p5.MediaElement", + "module": "DOM" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "audioNode", + "description": "

    AudioNode from the Web Audio API,\nor an object from the p5.sound library

    \n", + "type": "AudioNode|Object" + } + ], + "class": "p5.MediaElement", + "module": "DOM" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.MediaElement", + "module": "DOM" + }, + "showControls": { + "name": "showControls", + "class": "p5.MediaElement", + "module": "DOM" + }, + "hideControls": { + "name": "hideControls", + "class": "p5.MediaElement", + "module": "DOM" + }, + "addCue": { + "name": "addCue", + "params": [ + { + "name": "time", + "description": "

    cue time to run the callback function.

    \n", + "type": "Number" + }, + { + "name": "callback", + "description": "

    function to call at the cue time.

    \n", + "type": "Function" + }, + { + "name": "value", + "description": "

    object to pass as the argument to\n callback.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.MediaElement", + "module": "DOM" + }, + "removeCue": { + "name": "removeCue", + "params": [ + { + "name": "id", + "description": "

    ID of the cue, created by media.addCue().

    \n", + "type": "Number" + } + ], + "class": "p5.MediaElement", + "module": "DOM" + }, + "clearCues": { + "name": "clearCues", + "class": "p5.MediaElement", + "module": "DOM" + } + }, + "p5.File": { + "file": { + "name": "file", + "class": "p5.File", + "module": "DOM" + }, + "type": { + "name": "type", + "class": "p5.File", + "module": "DOM" + }, + "subtype": { + "name": "subtype", + "class": "p5.File", + "module": "DOM" + }, + "name": { + "name": "name", + "class": "p5.File", + "module": "DOM" + }, + "size": { + "name": "size", + "class": "p5.File", + "module": "DOM" + }, + "data": { + "name": "data", + "class": "p5.File", + "module": "DOM" + } + }, + "p5.Image": { + "width": { + "name": "width", + "class": "p5.Image", + "module": "Image" + }, + "height": { + "name": "height", + "class": "p5.Image", + "module": "Image" + }, + "pixels": { + "name": "pixels", + "class": "p5.Image", + "module": "Image" + }, + "pixelDensity": { + "name": "pixelDensity", + "params": [ + { + "name": "density", + "description": "

    A scaling factor for the number of pixels per\nside

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Image", + "module": "Image" + }, + "loadPixels": { + "name": "loadPixels", + "class": "p5.Image", + "module": "Image" + }, + "updatePixels": { + "name": "updatePixels", + "class": "p5.Image", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the upper-left corner\n of the subsection to update.

    \n", + "type": "Integer" + }, + { + "name": "y", + "description": "

    y-coordinate of the upper-left corner\n of the subsection to update.

    \n", + "type": "Integer" + }, + { + "name": "w", + "description": "

    width of the subsection to update.

    \n", + "type": "Integer" + }, + { + "name": "h", + "description": "

    height of the subsection to update.

    \n", + "type": "Integer" + } + ] + }, + { + "params": [] + } + ] + }, + "get": { + "name": "get", + "class": "p5.Image", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "w", + "description": "

    width of the subsection to be returned.

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the subsection to be returned.

    \n", + "type": "Number" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + } + ] + } + ] + }, + "set": { + "name": "set", + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the pixel.

    \n", + "type": "Number" + }, + { + "name": "a", + "description": "

    grayscale value | pixel array |\n p5.Color object |\n p5.Image to copy.

    \n", + "type": "Number|Number[]|Object" + } + ], + "class": "p5.Image", + "module": "Image" + }, + "resize": { + "name": "resize", + "params": [ + { + "name": "width", + "description": "

    resized image width.

    \n", + "type": "Number" + }, + { + "name": "height", + "description": "

    resized image height.

    \n", + "type": "Number" + } + ], + "class": "p5.Image", + "module": "Image" + }, + "copy": { + "name": "copy", + "class": "p5.Image", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "

    source image.

    \n", + "type": "p5.Image|p5.Element" + }, + { + "name": "sx", + "description": "

    x-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sy", + "description": "

    y-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sw", + "description": "

    source image width.

    \n", + "type": "Integer" + }, + { + "name": "sh", + "description": "

    source image height.

    \n", + "type": "Integer" + }, + { + "name": "dx", + "description": "

    x-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dy", + "description": "

    y-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dw", + "description": "

    destination image width.

    \n", + "type": "Integer" + }, + { + "name": "dh", + "description": "

    destination image height.

    \n", + "type": "Integer" + } + ] + }, + { + "params": [ + { + "name": "sx", + "description": "", + "type": "Integer" + }, + { + "name": "sy", + "description": "", + "type": "Integer" + }, + { + "name": "sw", + "description": "", + "type": "Integer" + }, + { + "name": "sh", + "description": "", + "type": "Integer" + }, + { + "name": "dx", + "description": "", + "type": "Integer" + }, + { + "name": "dy", + "description": "", + "type": "Integer" + }, + { + "name": "dw", + "description": "", + "type": "Integer" + }, + { + "name": "dh", + "description": "", + "type": "Integer" + } + ] + } + ] + }, + "mask": { + "name": "mask", + "params": [ + { + "name": "srcImage", + "description": "

    source image.

    \n", + "type": "p5.Image" + } + ], + "class": "p5.Image", + "module": "Image" + }, + "filter": { + "name": "filter", + "params": [ + { + "name": "filterType", + "description": "

    either THRESHOLD, GRAY, OPAQUE, INVERT,\n POSTERIZE, ERODE, DILATE or BLUR.

    \n", + "type": "Constant" + }, + { + "name": "filterParam", + "description": "

    parameter unique to each filter.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Image", + "module": "Image" + }, + "blend": { + "name": "blend", + "class": "p5.Image", + "module": "Image", + "overloads": [ + { + "params": [ + { + "name": "srcImage", + "description": "

    source image

    \n", + "type": "p5.Image" + }, + { + "name": "sx", + "description": "

    x-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sy", + "description": "

    y-coordinate of the source's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "sw", + "description": "

    source image width.

    \n", + "type": "Integer" + }, + { + "name": "sh", + "description": "

    source image height.

    \n", + "type": "Integer" + }, + { + "name": "dx", + "description": "

    x-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dy", + "description": "

    y-coordinate of the destination's upper-left corner.

    \n", + "type": "Integer" + }, + { + "name": "dw", + "description": "

    destination image width.

    \n", + "type": "Integer" + }, + { + "name": "dh", + "description": "

    destination image height.

    \n", + "type": "Integer" + }, + { + "name": "blendMode", + "description": "

    the blend mode. either\n BLEND, DARKEST, LIGHTEST, DIFFERENCE,\n MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n SOFT_LIGHT, DODGE, BURN, ADD or NORMAL.

    \n

    Available blend modes are: normal | multiply | screen | overlay |\n darken | lighten | color-dodge | color-burn | hard-light |\n soft-light | difference | exclusion | hue | saturation |\n color | luminosity

    \n

    http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/

    \n", + "type": "Constant" + } + ] + }, + { + "params": [ + { + "name": "sx", + "description": "", + "type": "Integer" + }, + { + "name": "sy", + "description": "", + "type": "Integer" + }, + { + "name": "sw", + "description": "", + "type": "Integer" + }, + { + "name": "sh", + "description": "", + "type": "Integer" + }, + { + "name": "dx", + "description": "", + "type": "Integer" + }, + { + "name": "dy", + "description": "", + "type": "Integer" + }, + { + "name": "dw", + "description": "", + "type": "Integer" + }, + { + "name": "dh", + "description": "", + "type": "Integer" + }, + { + "name": "blendMode", + "description": "", + "type": "Constant" + } + ] + } + ] + }, + "save": { + "name": "save", + "params": [ + { + "name": "filename", + "description": "

    filename. Defaults to 'untitled'.

    \n", + "type": "String" + }, + { + "name": "extension", + "description": "

    file extension, either 'png' or 'jpg'.\n Defaults to 'png'.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.Image", + "module": "Image" + }, + "reset": { + "name": "reset", + "class": "p5.Image", + "module": "Image" + }, + "getCurrentFrame": { + "name": "getCurrentFrame", + "class": "p5.Image", + "module": "Image" + }, + "setFrame": { + "name": "setFrame", + "params": [ + { + "name": "index", + "description": "

    index of the frame to display.

    \n", + "type": "Number" + } + ], + "class": "p5.Image", + "module": "Image" + }, + "numFrames": { + "name": "numFrames", + "class": "p5.Image", + "module": "Image" + }, + "play": { + "name": "play", + "class": "p5.Image", + "module": "Image" + }, + "pause": { + "name": "pause", + "class": "p5.Image", + "module": "Image" + }, + "delay": { + "name": "delay", + "params": [ + { + "name": "d", + "description": "

    delay in milliseconds between switching frames.

    \n", + "type": "Number" + }, + { + "name": "index", + "description": "

    index of the frame that will have its delay modified.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Image", + "module": "Image" + } + }, + "p5.PrintWriter": { + "write": { + "name": "write", + "params": [ + { + "name": "data", + "description": "

    all data to be written by the PrintWriter

    \n", + "type": "Array" + } + ], + "class": "p5.PrintWriter", + "module": "IO" + }, + "print": { + "name": "print", + "params": [ + { + "name": "data", + "description": "

    all data to be printed by the PrintWriter

    \n", + "type": "Array" + } + ], + "class": "p5.PrintWriter", + "module": "IO" + }, + "clear": { + "name": "clear", + "class": "p5.PrintWriter", + "module": "IO" + }, + "close": { + "name": "close", + "class": "p5.PrintWriter", + "module": "IO" + } + }, + "p5.Table": { + "columns": { + "name": "columns", + "class": "p5.Table", + "module": "IO" + }, + "rows": { + "name": "rows", + "class": "p5.Table", + "module": "IO" + }, + "addRow": { + "name": "addRow", + "params": [ + { + "name": "row", + "description": "

    row to be added to the table

    \n", + "type": "p5.TableRow", + "optional": true + } + ], + "class": "p5.Table", + "module": "IO" + }, + "removeRow": { + "name": "removeRow", + "params": [ + { + "name": "id", + "description": "

    ID number of the row to remove

    \n", + "type": "Integer" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getRow": { + "name": "getRow", + "params": [ + { + "name": "rowID", + "description": "

    ID number of the row to get

    \n", + "type": "Integer" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getRows": { + "name": "getRows", + "class": "p5.Table", + "module": "IO" + }, + "findRow": { + "name": "findRow", + "params": [ + { + "name": "value", + "description": "

    The value to match

    \n", + "type": "String" + }, + { + "name": "column", + "description": "

    ID number or title of the\n column to search

    \n", + "type": "Integer|String" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "findRows": { + "name": "findRows", + "params": [ + { + "name": "value", + "description": "

    The value to match

    \n", + "type": "String" + }, + { + "name": "column", + "description": "

    ID number or title of the\n column to search

    \n", + "type": "Integer|String" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "matchRow": { + "name": "matchRow", + "params": [ + { + "name": "regexp", + "description": "

    The regular expression to match

    \n", + "type": "String|RegExp" + }, + { + "name": "column", + "description": "

    The column ID (number) or\n title (string)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "matchRows": { + "name": "matchRows", + "params": [ + { + "name": "regexp", + "description": "

    The regular expression to match

    \n", + "type": "String" + }, + { + "name": "column", + "description": "

    The column ID (number) or\n title (string)

    \n", + "type": "String|Integer", + "optional": true + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getColumn": { + "name": "getColumn", + "params": [ + { + "name": "column", + "description": "

    String or Number of the column to return

    \n", + "type": "String|Number" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "clearRows": { + "name": "clearRows", + "class": "p5.Table", + "module": "IO" + }, + "addColumn": { + "name": "addColumn", + "params": [ + { + "name": "title", + "description": "

    title of the given column

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getColumnCount": { + "name": "getColumnCount", + "class": "p5.Table", + "module": "IO" + }, + "getRowCount": { + "name": "getRowCount", + "class": "p5.Table", + "module": "IO" + }, + "removeTokens": { + "name": "removeTokens", + "params": [ + { + "name": "chars", + "description": "

    String listing characters to be removed

    \n", + "type": "String" + }, + { + "name": "column", + "description": "

    Column ID (number)\n or name (string)

    \n", + "type": "String|Integer", + "optional": true + } + ], + "class": "p5.Table", + "module": "IO" + }, + "trim": { + "name": "trim", + "params": [ + { + "name": "column", + "description": "

    Column ID (number)\n or name (string)

    \n", + "type": "String|Integer", + "optional": true + } + ], + "class": "p5.Table", + "module": "IO" + }, + "removeColumn": { + "name": "removeColumn", + "params": [ + { + "name": "column", + "description": "

    columnName (string) or ID (number)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "set": { + "name": "set", + "params": [ + { + "name": "row", + "description": "

    row ID

    \n", + "type": "Integer" + }, + { + "name": "column", + "description": "

    column ID (Number)\n or title (String)

    \n", + "type": "String|Integer" + }, + { + "name": "value", + "description": "

    value to assign

    \n", + "type": "String|Number" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "setNum": { + "name": "setNum", + "params": [ + { + "name": "row", + "description": "

    row ID

    \n", + "type": "Integer" + }, + { + "name": "column", + "description": "

    column ID (Number)\n or title (String)

    \n", + "type": "String|Integer" + }, + { + "name": "value", + "description": "

    value to assign

    \n", + "type": "Number" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "setString": { + "name": "setString", + "params": [ + { + "name": "row", + "description": "

    row ID

    \n", + "type": "Integer" + }, + { + "name": "column", + "description": "

    column ID (Number)\n or title (String)

    \n", + "type": "String|Integer" + }, + { + "name": "value", + "description": "

    value to assign

    \n", + "type": "String" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "get": { + "name": "get", + "params": [ + { + "name": "row", + "description": "

    row ID

    \n", + "type": "Integer" + }, + { + "name": "column", + "description": "

    columnName (string) or\n ID (number)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getNum": { + "name": "getNum", + "params": [ + { + "name": "row", + "description": "

    row ID

    \n", + "type": "Integer" + }, + { + "name": "column", + "description": "

    columnName (string) or\n ID (number)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getString": { + "name": "getString", + "params": [ + { + "name": "row", + "description": "

    row ID

    \n", + "type": "Integer" + }, + { + "name": "column", + "description": "

    columnName (string) or\n ID (number)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getObject": { + "name": "getObject", + "params": [ + { + "name": "headerColumn", + "description": "

    Name of the column which should be used to\n title each row object (optional)

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.Table", + "module": "IO" + }, + "getArray": { + "name": "getArray", + "class": "p5.Table", + "module": "IO" + } + }, + "p5.TableRow": { + "set": { + "name": "set", + "params": [ + { + "name": "column", + "description": "

    Column ID (Number)\n or Title (String)

    \n", + "type": "String|Integer" + }, + { + "name": "value", + "description": "

    The value to be stored

    \n", + "type": "String|Number" + } + ], + "class": "p5.TableRow", + "module": "IO" + }, + "setNum": { + "name": "setNum", + "params": [ + { + "name": "column", + "description": "

    Column ID (Number)\n or Title (String)

    \n", + "type": "String|Integer" + }, + { + "name": "value", + "description": "

    The value to be stored\n as a Float

    \n", + "type": "Number|String" + } + ], + "class": "p5.TableRow", + "module": "IO" + }, + "setString": { + "name": "setString", + "params": [ + { + "name": "column", + "description": "

    Column ID (Number)\n or Title (String)

    \n", + "type": "String|Integer" + }, + { + "name": "value", + "description": "

    The value to be stored\n as a String

    \n", + "type": "String|Number|Boolean|Object" + } + ], + "class": "p5.TableRow", + "module": "IO" + }, + "get": { + "name": "get", + "params": [ + { + "name": "column", + "description": "

    columnName (string) or\n ID (number)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.TableRow", + "module": "IO" + }, + "getNum": { + "name": "getNum", + "params": [ + { + "name": "column", + "description": "

    columnName (string) or\n ID (number)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.TableRow", + "module": "IO" + }, + "getString": { + "name": "getString", + "params": [ + { + "name": "column", + "description": "

    columnName (string) or\n ID (number)

    \n", + "type": "String|Integer" + } + ], + "class": "p5.TableRow", + "module": "IO" + } + }, + "p5.XML": { + "getParent": { + "name": "getParent", + "class": "p5.XML", + "module": "IO" + }, + "getName": { + "name": "getName", + "class": "p5.XML", + "module": "IO" + }, + "setName": { + "name": "setName", + "params": [ + { + "name": "the", + "description": "

    new name of the node

    \n", + "type": "String" + } + ], + "class": "p5.XML", + "module": "IO" + }, + "hasChildren": { + "name": "hasChildren", + "class": "p5.XML", + "module": "IO" + }, + "listChildren": { + "name": "listChildren", + "class": "p5.XML", + "module": "IO" + }, + "getChildren": { + "name": "getChildren", + "params": [ + { + "name": "name", + "description": "

    element name

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.XML", + "module": "IO" + }, + "getChild": { + "name": "getChild", + "params": [ + { + "name": "name", + "description": "

    element name or index

    \n", + "type": "String|Integer" + } + ], + "class": "p5.XML", + "module": "IO" + }, + "addChild": { + "name": "addChild", + "params": [ + { + "name": "node", + "description": "

    a p5.XML Object which will be the child to be added

    \n", + "type": "p5.XML" + } + ], + "class": "p5.XML", + "module": "IO" + }, + "removeChild": { + "name": "removeChild", + "params": [ + { + "name": "name", + "description": "

    element name or index

    \n", + "type": "String|Integer" + } + ], + "class": "p5.XML", + "module": "IO" + }, + "getAttributeCount": { + "name": "getAttributeCount", + "class": "p5.XML", + "module": "IO" + }, + "listAttributes": { + "name": "listAttributes", + "class": "p5.XML", + "module": "IO" + }, + "hasAttribute": { + "name": "hasAttribute", + "params": [ + { + "name": "the", + "description": "

    attribute to be checked

    \n", + "type": "String" + } + ], + "class": "p5.XML", + "module": "IO" + }, + "getNum": { + "name": "getNum", + "params": [ + { + "name": "name", + "description": "

    the non-null full name of the attribute

    \n", + "type": "String" + }, + { + "name": "defaultValue", + "description": "

    the default value of the attribute

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.XML", + "module": "IO" + }, + "getString": { + "name": "getString", + "params": [ + { + "name": "name", + "description": "

    the non-null full name of the attribute

    \n", + "type": "String" + }, + { + "name": "defaultValue", + "description": "

    the default value of the attribute

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.XML", + "module": "IO" + }, + "setAttribute": { + "name": "setAttribute", + "params": [ + { + "name": "name", + "description": "

    the full name of the attribute

    \n", + "type": "String" + }, + { + "name": "value", + "description": "

    the value of the attribute

    \n", + "type": "Number|String|Boolean" + } + ], + "class": "p5.XML", + "module": "IO" + }, + "getContent": { + "name": "getContent", + "params": [ + { + "name": "defaultValue", + "description": "

    value returned if no content is found

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.XML", + "module": "IO" + }, + "setContent": { + "name": "setContent", + "params": [ + { + "name": "text", + "description": "

    the new content

    \n", + "type": "String" + } + ], + "class": "p5.XML", + "module": "IO" + }, + "serialize": { + "name": "serialize", + "class": "p5.XML", + "module": "IO" + } + }, + "p5.Vector": { + "x": { + "name": "x", + "class": "p5.Vector", + "module": "Math" + }, + "y": { + "name": "y", + "class": "p5.Vector", + "module": "Math" + }, + "z": { + "name": "z", + "class": "p5.Vector", + "module": "Math" + }, + "toString": { + "name": "toString", + "class": "p5.Vector", + "module": "Math" + }, + "set": { + "name": "set", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x component of the vector.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "y", + "description": "

    y component of the vector.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    z component of the vector.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    vector to set.

    \n", + "type": "p5.Vector|Number[]" + } + ], + "chainable": 1 + } + ] + }, + "copy": { + "name": "copy", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "

    the p5.Vector to create a copy of

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "add": { + "name": "add", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x component of the vector to be added.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component of the vector to be added.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    z component of the vector to be added.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    The vector to add

    \n", + "type": "p5.Vector|Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "

    A p5.Vector to add

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    A p5.Vector to add

    \n", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "

    vector to receive the result.

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "rem": { + "name": "rem", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x component of divisor vector.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component of divisor vector.

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    z component of divisor vector.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    divisor vector.

    \n", + "type": "p5.Vector | Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "

    The dividend p5.Vector

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    The divisor p5.Vector

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "sub": { + "name": "sub", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x component of the vector to subtract.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component of the vector to subtract.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    z component of the vector to subtract.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "value", + "description": "

    the vector to subtract

    \n", + "type": "p5.Vector|Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "

    A p5.Vector to subtract from

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    A p5.Vector to subtract

    \n", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "

    vector to receive the result.

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "mult": { + "name": "mult", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    The number to multiply with the vector

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "

    number to multiply with the x component of the vector.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    number to multiply with the y component of the vector.

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    number to multiply with the z component of the vector.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "arr", + "description": "

    array to multiply with the components of the vector.

    \n", + "type": "Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v", + "description": "

    vector to multiply with the components of the original vector.

    \n", + "type": "p5.Vector" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number", + "optional": true + } + ], + "static": 1 + }, + { + "params": [ + { + "name": "v", + "description": "", + "type": "p5.Vector" + }, + { + "name": "n", + "description": "", + "type": "Number" + }, + { + "name": "target", + "description": "

    vector to receive the result.

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + }, + { + "params": [ + { + "name": "v0", + "description": "", + "type": "p5.Vector" + }, + { + "name": "v1", + "description": "", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + }, + { + "params": [ + { + "name": "v0", + "description": "", + "type": "p5.Vector" + }, + { + "name": "arr", + "description": "", + "type": "Number[]" + }, + { + "name": "target", + "description": "", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "div": { + "name": "div", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "n", + "description": "

    The number to divide the vector by

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "

    number to divide with the x component of the vector.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    number to divide with the y component of the vector.

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    number to divide with the z component of the vector.

    \n", + "type": "Number", + "optional": true + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "arr", + "description": "

    array to divide the components of the vector by.

    \n", + "type": "Number[]" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v", + "description": "

    vector to divide the components of the original vector by.

    \n", + "type": "p5.Vector" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + }, + { + "name": "z", + "description": "", + "type": "Number", + "optional": true + } + ], + "static": 1 + }, + { + "params": [ + { + "name": "v", + "description": "", + "type": "p5.Vector" + }, + { + "name": "n", + "description": "", + "type": "Number" + }, + { + "name": "target", + "description": "

    The vector to receive the result

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + }, + { + "params": [ + { + "name": "v0", + "description": "", + "type": "p5.Vector" + }, + { + "name": "v1", + "description": "", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + }, + { + "params": [ + { + "name": "v0", + "description": "", + "type": "p5.Vector" + }, + { + "name": "arr", + "description": "", + "type": "Number[]" + }, + { + "name": "target", + "description": "", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "mag": { + "name": "mag", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "vecT", + "description": "

    The vector to return the magnitude of

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "magSq": { + "name": "magSq", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "vecT", + "description": "

    the vector to return the squared magnitude of

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "dot": { + "name": "dot", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x component of the vector.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component of the vector.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    z component of the vector.

    \n", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "v", + "description": "

    p5.Vector to be dotted.

    \n", + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "

    first p5.Vector.

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    second p5.Vector.

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "cross": { + "name": "cross", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "v", + "description": "

    p5.Vector to be crossed.

    \n", + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "

    first p5.Vector.

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    second p5.Vector.

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "dist": { + "name": "dist", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "v", + "description": "

    x, y, and z coordinates of a p5.Vector.

    \n", + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "

    The first p5.Vector

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    The second p5.Vector

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "normalize": { + "name": "normalize", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "

    The vector to normalize

    \n", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "

    The vector to receive the result

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "limit": { + "name": "limit", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "max", + "description": "

    maximum magnitude for the vector.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v", + "description": "

    the vector to limit

    \n", + "type": "p5.Vector" + }, + { + "name": "max", + "description": "", + "type": "Number" + }, + { + "name": "target", + "description": "

    the vector to receive the result (Optional)

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "setMag": { + "name": "setMag", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "len", + "description": "

    new length for this vector.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v", + "description": "

    the vector to set the magnitude of

    \n", + "type": "p5.Vector" + }, + { + "name": "len", + "description": "", + "type": "Number" + }, + { + "name": "target", + "description": "

    the vector to receive the result (Optional)

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "heading": { + "name": "heading", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "

    the vector to find the angle of

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "setHeading": { + "name": "setHeading", + "params": [ + { + "name": "angle", + "description": "

    angle of rotation.

    \n", + "type": "Number" + } + ], + "class": "p5.Vector", + "module": "Math" + }, + "rotate": { + "name": "rotate", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "angle", + "description": "

    angle of rotation.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v", + "description": "", + "type": "p5.Vector" + }, + { + "name": "angle", + "description": "", + "type": "Number" + }, + { + "name": "target", + "description": "

    The vector to receive the result

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "angleBetween": { + "name": "angleBetween", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "value", + "description": "

    x, y, and z components of a p5.Vector.

    \n", + "type": "p5.Vector" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "

    the first vector.

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    the second vector.

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "lerp": { + "name": "lerp", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x component.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y component.

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    z component.

    \n", + "type": "Number" + }, + { + "name": "amt", + "description": "

    amount of interpolation between 0.0 (old vector)\n and 1.0 (new vector). 0.5 is halfway between.

    \n", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v", + "description": "

    p5.Vector to lerp toward.

    \n", + "type": "p5.Vector" + }, + { + "name": "amt", + "description": "", + "type": "Number" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "v1", + "description": "", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "", + "type": "p5.Vector" + }, + { + "name": "amt", + "description": "", + "type": "Number" + }, + { + "name": "target", + "description": "

    The vector to receive the result

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "slerp": { + "name": "slerp", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "v", + "description": "

    p5.Vector to slerp toward.

    \n", + "type": "p5.Vector" + }, + { + "name": "amt", + "description": "

    amount of interpolation between 0.0 (old vector)\n and 1.0 (new vector). 0.5 is halfway between.

    \n", + "type": "Number" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "

    old vector.

    \n", + "type": "p5.Vector" + }, + { + "name": "v2", + "description": "

    new vector.

    \n", + "type": "p5.Vector" + }, + { + "name": "amt", + "description": "", + "type": "Number" + }, + { + "name": "target", + "description": "

    vector to receive the result.

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "reflect": { + "name": "reflect", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "surfaceNormal", + "description": "

    p5.Vector\n to reflect about.

    \n", + "type": "p5.Vector" + } + ], + "chainable": 1 + }, + { + "params": [ + { + "name": "incidentVector", + "description": "

    vector to be reflected.

    \n", + "type": "p5.Vector" + }, + { + "name": "surfaceNormal", + "description": "", + "type": "p5.Vector" + }, + { + "name": "target", + "description": "

    vector to receive the result.

    \n", + "type": "p5.Vector", + "optional": true + } + ], + "static": 1 + } + ] + }, + "array": { + "name": "array", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [] + }, + { + "params": [ + { + "name": "v", + "description": "

    the vector to convert to an array

    \n", + "type": "p5.Vector" + } + ], + "static": 1 + } + ] + }, + "equals": { + "name": "equals", + "class": "p5.Vector", + "module": "Math", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x component of the vector.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "y", + "description": "

    y component of the vector.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "z", + "description": "

    z component of the vector.

    \n", + "type": "Number", + "optional": true + } + ] + }, + { + "params": [ + { + "name": "value", + "description": "

    vector to compare.

    \n", + "type": "p5.Vector|Array" + } + ] + }, + { + "params": [ + { + "name": "v1", + "description": "

    the first vector to compare

    \n", + "type": "p5.Vector|Array" + }, + { + "name": "v2", + "description": "

    the second vector to compare

    \n", + "type": "p5.Vector|Array" + } + ], + "static": 1 + } + ] + }, + "fromAngle": { + "name": "fromAngle", + "params": [ + { + "name": "angle", + "description": "

    desired angle, in radians. Unaffected by angleMode().

    \n", + "type": "Number" + }, + { + "name": "length", + "description": "

    length of the new vector (defaults to 1).

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Vector", + "module": "Math" + }, + "fromAngles": { + "name": "fromAngles", + "params": [ + { + "name": "theta", + "description": "

    polar angle in radians (zero is up).

    \n", + "type": "Number" + }, + { + "name": "phi", + "description": "

    azimuthal angle in radians\n (zero is out of the screen).

    \n", + "type": "Number" + }, + { + "name": "length", + "description": "

    length of the new vector (defaults to 1).

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Vector", + "module": "Math" + }, + "random2D": { + "name": "random2D", + "class": "p5.Vector", + "module": "Math" + }, + "random3D": { + "name": "random3D", + "class": "p5.Vector", + "module": "Math" + } + }, + "p5.Font": { + "font": { + "name": "font", + "class": "p5.Font", + "module": "Typography" + }, + "textBounds": { + "name": "textBounds", + "params": [ + { + "name": "str", + "description": "

    string of text.

    \n", + "type": "String" + }, + { + "name": "x", + "description": "

    x-coordinate of the text.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the text.

    \n", + "type": "Number" + }, + { + "name": "fontSize", + "description": "

    font size. Defaults to the current\n textSize().

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Font", + "module": "Typography" + }, + "textToPoints": { + "name": "textToPoints", + "params": [ + { + "name": "str", + "description": "

    string of text.

    \n", + "type": "String" + }, + { + "name": "x", + "description": "

    x-coordinate of the text.

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the text.

    \n", + "type": "Number" + }, + { + "name": "fontSize", + "description": "

    font size. Defaults to the current\n textSize().

    \n", + "type": "Number", + "optional": true + }, + { + "name": "options", + "description": "

    object with sampleFactor and simplifyThreshold\n properties.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.Font", + "module": "Typography" + } + }, + "p5.Camera": { + "eyeX": { + "name": "eyeX", + "class": "p5.Camera", + "module": "3D" + }, + "eyeY": { + "name": "eyeY", + "class": "p5.Camera", + "module": "3D" + }, + "eyeZ": { + "name": "eyeZ", + "class": "p5.Camera", + "module": "3D" + }, + "centerX": { + "name": "centerX", + "class": "p5.Camera", + "module": "3D" + }, + "centerY": { + "name": "centerY", + "class": "p5.Camera", + "module": "3D" + }, + "centerZ": { + "name": "centerZ", + "class": "p5.Camera", + "module": "3D" + }, + "upX": { + "name": "upX", + "class": "p5.Camera", + "module": "3D" + }, + "upY": { + "name": "upY", + "class": "p5.Camera", + "module": "3D" + }, + "upZ": { + "name": "upZ", + "class": "p5.Camera", + "module": "3D" + }, + "perspective": { + "name": "perspective", + "class": "p5.Camera", + "module": "3D" + }, + "ortho": { + "name": "ortho", + "class": "p5.Camera", + "module": "3D" + }, + "frustum": { + "name": "frustum", + "class": "p5.Camera", + "module": "3D" + }, + "pan": { + "name": "pan", + "params": [ + { + "name": "angle", + "description": "

    amount to rotate camera in current\nangleMode units.\nGreater than 0 values rotate counterclockwise (to the left).

    \n", + "type": "Number" + } + ], + "class": "p5.Camera", + "module": "3D" + }, + "tilt": { + "name": "tilt", + "params": [ + { + "name": "angle", + "description": "

    amount to rotate camera in current\nangleMode units.\nGreater than 0 values rotate counterclockwise (to the left).

    \n", + "type": "Number" + } + ], + "class": "p5.Camera", + "module": "3D" + }, + "lookAt": { + "name": "lookAt", + "params": [ + { + "name": "x", + "description": "

    x position of a point in world space

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y position of a point in world space

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    z position of a point in world space

    \n", + "type": "Number" + } + ], + "class": "p5.Camera", + "module": "3D" + }, + "camera": { + "name": "camera", + "class": "p5.Camera", + "module": "3D" + }, + "move": { + "name": "move", + "params": [ + { + "name": "x", + "description": "

    amount to move along camera's left-right axis

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    amount to move along camera's up-down axis

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    amount to move along camera's forward-backward axis

    \n", + "type": "Number" + } + ], + "class": "p5.Camera", + "module": "3D" + }, + "setPosition": { + "name": "setPosition", + "params": [ + { + "name": "x", + "description": "

    x position of a point in world space

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y position of a point in world space

    \n", + "type": "Number" + }, + { + "name": "z", + "description": "

    z position of a point in world space

    \n", + "type": "Number" + } + ], + "class": "p5.Camera", + "module": "3D" + }, + "set": { + "name": "set", + "params": [ + { + "name": "cam", + "description": "

    source camera

    \n", + "type": "p5.Camera" + } + ], + "class": "p5.Camera", + "module": "3D" + }, + "slerp": { + "name": "slerp", + "params": [ + { + "name": "cam0", + "description": "

    first p5.Camera

    \n", + "type": "p5.Camera" + }, + { + "name": "cam1", + "description": "

    second p5.Camera

    \n", + "type": "p5.Camera" + }, + { + "name": "amt", + "description": "

    amount to use for interpolation during slerp

    \n", + "type": "Number" + } + ], + "class": "p5.Camera", + "module": "3D" + } + }, + "p5.Framebuffer": { + "pixels": { + "name": "pixels", + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "resize": { + "name": "resize", + "params": [ + { + "name": "width", + "description": "", + "type": "Number" + }, + { + "name": "height", + "description": "", + "type": "Number" + } + ], + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "pixelDensity": { + "name": "pixelDensity", + "params": [ + { + "name": "density", + "description": "

    A scaling factor for the number of pixels per\nside of the framebuffer

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "autoSized": { + "name": "autoSized", + "params": [ + { + "name": "autoSized", + "description": "

    Whether or not the framebuffer should resize\nalong with the canvas it's attached to

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "createCamera": { + "name": "createCamera", + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "remove": { + "name": "remove", + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "begin": { + "name": "begin", + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "end": { + "name": "end", + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "draw": { + "name": "draw", + "params": [ + { + "name": "callback", + "description": "

    A function to run that draws to the canvas. The\nfunction will immediately be run, but it will draw to the framebuffer\ninstead of the canvas.

    \n", + "type": "Function" + } + ], + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "get": { + "name": "get", + "class": "p5.Framebuffer", + "module": "Rendering", + "overloads": [ + { + "params": [ + { + "name": "x", + "description": "

    x-coordinate of the pixel

    \n", + "type": "Number" + }, + { + "name": "y", + "description": "

    y-coordinate of the pixel

    \n", + "type": "Number" + }, + { + "name": "w", + "description": "

    width of the section to be returned

    \n", + "type": "Number" + }, + { + "name": "h", + "description": "

    height of the section to be returned

    \n", + "type": "Number" + } + ] + }, + { + "params": [] + }, + { + "params": [ + { + "name": "x", + "description": "", + "type": "Number" + }, + { + "name": "y", + "description": "", + "type": "Number" + } + ] + } + ] + }, + "color": { + "name": "color", + "class": "p5.Framebuffer", + "module": "Rendering" + }, + "depth": { + "name": "depth", + "class": "p5.Framebuffer", + "module": "Rendering" + } + }, + "p5.Geometry": { + "clearColors": { + "name": "clearColors", + "class": "p5.Geometry", + "module": "Shape" + }, + "flipU": { + "name": "flipU", + "class": "p5.Geometry", + "module": "Shape" + }, + "flipV": { + "name": "flipV", + "class": "p5.Geometry", + "module": "Shape" + }, + "computeFaces": { + "name": "computeFaces", + "class": "p5.Geometry", + "module": "Shape" + }, + "computeNormals": { + "name": "computeNormals", + "params": [ + { + "name": "shadingType", + "description": "

    shading type (FLAT for flat shading or SMOOTH for smooth shading) for buildGeometry() outputs. Defaults to FLAT.

    \n", + "type": "String", + "optional": true + }, + { + "name": "options", + "description": "

    An optional object with configuration.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.Geometry", + "module": "Shape" + }, + "averageNormals": { + "name": "averageNormals", + "class": "p5.Geometry", + "module": "Shape" + }, + "averagePoleNormals": { + "name": "averagePoleNormals", + "class": "p5.Geometry", + "module": "Shape" + }, + "normalize": { + "name": "normalize", + "class": "p5.Geometry", + "module": "Shape" + } + }, + "p5.Shader": { + "copyToContext": { + "name": "copyToContext", + "params": [ + { + "name": "context", + "description": "

    The graphic or instance to copy this shader to.\nPass window if you need to copy to the main canvas.

    \n", + "type": "p5|p5.Graphics" + } + ], + "class": "p5.Shader", + "module": "3D" + }, + "setUniform": { + "name": "setUniform", + "params": [ + { + "name": "uniformName", + "description": "

    the name of the uniform.\nMust correspond to the name used in the vertex and fragment shaders

    \n", + "type": "String" + }, + { + "name": "data", + "description": "

    The value to assign to the uniform. This can be\na boolean (true/false), a number, an array of numbers, or\nan image (p5.Image, p5.Graphics, p5.MediaElement, p5.Texture)

    \n", + "type": "Boolean|Number|Number[]|p5.Image|p5.Graphics|p5.MediaElement|p5.Texture" + } + ], + "class": "p5.Shader", + "module": "3D" + } + }, + "p5.SoundFile": { + "isLoaded": { + "name": "isLoaded", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "play": { + "name": "play", + "params": [ + { + "name": "startTime", + "description": "

    (optional) schedule playback to start (in seconds from now).

    \n", + "type": "Number", + "optional": true + }, + { + "name": "rate", + "description": "

    (optional) playback rate

    \n", + "type": "Number", + "optional": true + }, + { + "name": "amp", + "description": "

    (optional) amplitude (volume)\n of playback

    \n", + "type": "Number", + "optional": true + }, + { + "name": "cueStart", + "description": "

    (optional) cue start time in seconds

    \n", + "type": "Number", + "optional": true + }, + { + "name": "duration", + "description": "

    (optional) duration of playback in seconds

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "playMode": { + "name": "playMode", + "params": [ + { + "name": "str", + "description": "

    'restart' or 'sustain' or 'untilDone'

    \n", + "type": "String" + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "pause": { + "name": "pause", + "params": [ + { + "name": "startTime", + "description": "

    (optional) schedule event to occur\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "loop": { + "name": "loop", + "params": [ + { + "name": "startTime", + "description": "

    (optional) schedule event to occur\n seconds from now

    \n", + "type": "Number", + "optional": true + }, + { + "name": "rate", + "description": "

    (optional) playback rate

    \n", + "type": "Number", + "optional": true + }, + { + "name": "amp", + "description": "

    (optional) playback volume

    \n", + "type": "Number", + "optional": true + }, + { + "name": "cueLoopStart", + "description": "

    (optional) startTime in seconds

    \n", + "type": "Number", + "optional": true + }, + { + "name": "duration", + "description": "

    (optional) loop duration in seconds

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "setLoop": { + "name": "setLoop", + "params": [ + { + "name": "Boolean", + "description": "

    set looping to true or false

    \n", + "type": "Boolean" + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "isLooping": { + "name": "isLooping", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "isPlaying": { + "name": "isPlaying", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "isPaused": { + "name": "isPaused", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "stop": { + "name": "stop", + "params": [ + { + "name": "startTime", + "description": "

    (optional) schedule event to occur\n in seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "pan": { + "name": "pan", + "params": [ + { + "name": "panValue", + "description": "

    Set the stereo panner

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "getPan": { + "name": "getPan", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "rate": { + "name": "rate", + "params": [ + { + "name": "playbackRate", + "description": "

    Set the playback rate. 1.0 is normal,\n .5 is half-speed, 2.0 is twice as fast.\n Values less than zero play backwards.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "setVolume": { + "name": "setVolume", + "params": [ + { + "name": "volume", + "description": "

    Volume (amplitude) between 0.0\n and 1.0 or modulating signal/oscillator

    \n", + "type": "Number|Object" + }, + { + "name": "rampTime", + "description": "

    Fade for t seconds

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    Schedule this event to happen at\n t seconds in the future

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "duration": { + "name": "duration", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "currentTime": { + "name": "currentTime", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "jump": { + "name": "jump", + "params": [ + { + "name": "cueTime", + "description": "

    cueTime of the soundFile in seconds.

    \n", + "type": "Number" + }, + { + "name": "duration", + "description": "

    duration in seconds.

    \n", + "type": "Number" + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "channels": { + "name": "channels", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "sampleRate": { + "name": "sampleRate", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "frames": { + "name": "frames", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "getPeaks": { + "name": "getPeaks", + "params": [ + { + "name": "length", + "description": "

    length is the size of the returned array.\n Larger length results in more precision.\n Defaults to 5*width of the browser window.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "reverseBuffer": { + "name": "reverseBuffer", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "onended": { + "name": "onended", + "params": [ + { + "name": "callback", + "description": "

    function to call when the\n soundfile has ended.

    \n", + "type": "Function" + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "object", + "description": "

    Audio object that accepts an input

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "setPath": { + "name": "setPath", + "params": [ + { + "name": "path", + "description": "

    path to audio file

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    Callback

    \n", + "type": "Function" + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "setBuffer": { + "name": "setBuffer", + "params": [ + { + "name": "buf", + "description": "

    Array of Float32 Array(s). 2 Float32 Arrays\n will create a stereo source. 1 will create\n a mono source.

    \n", + "type": "Array" + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "addCue": { + "name": "addCue", + "params": [ + { + "name": "time", + "description": "

    Time in seconds, relative to this media\n element's playback. For example, to trigger\n an event every time playback reaches two\n seconds, pass in the number 2. This will be\n passed as the first parameter to\n the callback function.

    \n", + "type": "Number" + }, + { + "name": "callback", + "description": "

    Name of a function that will be\n called at the given time. The callback will\n receive time and (optionally) param as its\n two parameters.

    \n", + "type": "Function" + }, + { + "name": "value", + "description": "

    An object to be passed as the\n second parameter to the\n callback function.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "removeCue": { + "name": "removeCue", + "params": [ + { + "name": "id", + "description": "

    ID of the cue, as returned by addCue

    \n", + "type": "Number" + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "clearCues": { + "name": "clearCues", + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "save": { + "name": "save", + "params": [ + { + "name": "fileName", + "description": "

    name of the resulting .wav file.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.SoundFile", + "module": "p5.sound" + }, + "getBlob": { + "name": "getBlob", + "class": "p5.SoundFile", + "module": "p5.sound" + } + }, + "p5.Amplitude": { + "setInput": { + "name": "setInput", + "params": [ + { + "name": "snd", + "description": "

    set the sound source\n (optional, defaults to\n main output)

    \n", + "type": "SoundObject|undefined", + "optional": true + }, + { + "name": "smoothing", + "description": "

    a range between 0.0 and 1.0\n to smooth amplitude readings

    \n", + "type": "Number|undefined", + "optional": true + } + ], + "class": "p5.Amplitude", + "module": "p5.sound" + }, + "getLevel": { + "name": "getLevel", + "params": [ + { + "name": "channel", + "description": "

    Optionally return only channel 0 (left) or 1 (right)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Amplitude", + "module": "p5.sound" + }, + "toggleNormalize": { + "name": "toggleNormalize", + "params": [ + { + "name": "boolean", + "description": "

    set normalize to true (1) or false (0)

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5.Amplitude", + "module": "p5.sound" + }, + "smooth": { + "name": "smooth", + "params": [ + { + "name": "set", + "description": "

    smoothing from 0.0 <= 1

    \n", + "type": "Number" + } + ], + "class": "p5.Amplitude", + "module": "p5.sound" + } + }, + "p5.FFT": { + "setInput": { + "name": "setInput", + "params": [ + { + "name": "source", + "description": "

    p5.sound object (or web audio API source node)

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.FFT", + "module": "p5.sound" + }, + "waveform": { + "name": "waveform", + "params": [ + { + "name": "bins", + "description": "

    Must be a power of two between\n 16 and 1024. Defaults to 1024.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "precision", + "description": "

    If any value is provided, will return results\n in a Float32 Array which is more precise\n than a regular array.

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.FFT", + "module": "p5.sound" + }, + "analyze": { + "name": "analyze", + "params": [ + { + "name": "bins", + "description": "

    Must be a power of two between\n 16 and 1024. Defaults to 1024.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "scale", + "description": "

    If \"dB,\" returns decibel\n float measurements between\n -140 and 0 (max).\n Otherwise returns integers from 0-255.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.FFT", + "module": "p5.sound" + }, + "getEnergy": { + "name": "getEnergy", + "params": [ + { + "name": "frequency1", + "description": "

    Will return a value representing\n energy at this frequency. Alternately,\n the strings \"bass\", \"lowMid\" \"mid\",\n \"highMid\", and \"treble\" will return\n predefined frequency ranges.

    \n", + "type": "Number|String" + }, + { + "name": "frequency2", + "description": "

    If a second frequency is given,\n will return average amount of\n energy that exists between the\n two frequencies.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.FFT", + "module": "p5.sound" + }, + "getCentroid": { + "name": "getCentroid", + "class": "p5.FFT", + "module": "p5.sound" + }, + "smooth": { + "name": "smooth", + "params": [ + { + "name": "smoothing", + "description": "

    0.0 < smoothing < 1.0.\n Defaults to 0.8.

    \n", + "type": "Number" + } + ], + "class": "p5.FFT", + "module": "p5.sound" + }, + "linAverages": { + "name": "linAverages", + "params": [ + { + "name": "N", + "description": "

    Number of returned frequency groups

    \n", + "type": "Number" + } + ], + "class": "p5.FFT", + "module": "p5.sound" + }, + "logAverages": { + "name": "logAverages", + "params": [ + { + "name": "octaveBands", + "description": "

    Array of Octave Bands objects for grouping

    \n", + "type": "Array" + } + ], + "class": "p5.FFT", + "module": "p5.sound" + }, + "getOctaveBands": { + "name": "getOctaveBands", + "params": [ + { + "name": "N", + "description": "

    Specifies the 1/N type of generated octave bands

    \n", + "type": "Number" + }, + { + "name": "fCtr0", + "description": "

    Minimum central frequency for the lowest band

    \n", + "type": "Number" + } + ], + "class": "p5.FFT", + "module": "p5.sound" + } + }, + "p5.Oscillator": { + "start": { + "name": "start", + "params": [ + { + "name": "time", + "description": "

    startTime in seconds from now.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "frequency", + "description": "

    frequency in Hz.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "stop": { + "name": "stop", + "params": [ + { + "name": "secondsFromNow", + "description": "

    Time, in seconds from now.

    \n", + "type": "Number" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "amp": { + "name": "amp", + "params": [ + { + "name": "vol", + "description": "

    between 0 and 1.0\n or a modulating signal/oscillator

    \n", + "type": "Number|Object" + }, + { + "name": "rampTime", + "description": "

    create a fade that lasts rampTime

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "getAmp": { + "name": "getAmp", + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "freq": { + "name": "freq", + "params": [ + { + "name": "Frequency", + "description": "

    Frequency in Hz\n or modulating signal/oscillator

    \n", + "type": "Number|Object" + }, + { + "name": "rampTime", + "description": "

    Ramp time (in seconds)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    Schedule this event to happen\n at x seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "getFreq": { + "name": "getFreq", + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "setType": { + "name": "setType", + "params": [ + { + "name": "type", + "description": "

    'sine', 'triangle', 'sawtooth' or 'square'.

    \n", + "type": "String" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "getType": { + "name": "getType", + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "

    A p5.sound or Web Audio object

    \n", + "type": "Object" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "pan": { + "name": "pan", + "params": [ + { + "name": "panning", + "description": "

    Number between -1 and 1

    \n", + "type": "Number" + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "getPan": { + "name": "getPan", + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "phase": { + "name": "phase", + "params": [ + { + "name": "phase", + "description": "

    float between 0.0 and 1.0

    \n", + "type": "Number" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "add": { + "name": "add", + "params": [ + { + "name": "number", + "description": "

    Constant number to add

    \n", + "type": "Number" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "mult": { + "name": "mult", + "params": [ + { + "name": "number", + "description": "

    Constant number to multiply

    \n", + "type": "Number" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + }, + "scale": { + "name": "scale", + "params": [ + { + "name": "inMin", + "description": "

    input range minumum

    \n", + "type": "Number" + }, + { + "name": "inMax", + "description": "

    input range maximum

    \n", + "type": "Number" + }, + { + "name": "outMin", + "description": "

    input range minumum

    \n", + "type": "Number" + }, + { + "name": "outMax", + "description": "

    input range maximum

    \n", + "type": "Number" + } + ], + "class": "p5.Oscillator", + "module": "p5.sound" + } + }, + "p5.Envelope": { + "attackTime": { + "name": "attackTime", + "class": "p5.Envelope", + "module": "p5.sound" + }, + "attackLevel": { + "name": "attackLevel", + "class": "p5.Envelope", + "module": "p5.sound" + }, + "decayTime": { + "name": "decayTime", + "class": "p5.Envelope", + "module": "p5.sound" + }, + "decayLevel": { + "name": "decayLevel", + "class": "p5.Envelope", + "module": "p5.sound" + }, + "releaseTime": { + "name": "releaseTime", + "class": "p5.Envelope", + "module": "p5.sound" + }, + "releaseLevel": { + "name": "releaseLevel", + "class": "p5.Envelope", + "module": "p5.sound" + }, + "set": { + "name": "set", + "params": [ + { + "name": "attackTime", + "description": "

    Time (in seconds) before level\n reaches attackLevel

    \n", + "type": "Number" + }, + { + "name": "attackLevel", + "description": "

    Typically an amplitude between\n 0.0 and 1.0

    \n", + "type": "Number" + }, + { + "name": "decayTime", + "description": "

    Time

    \n", + "type": "Number" + }, + { + "name": "decayLevel", + "description": "

    Amplitude (In a standard ADSR envelope,\n decayLevel = sustainLevel)

    \n", + "type": "Number" + }, + { + "name": "releaseTime", + "description": "

    Release Time (in seconds)

    \n", + "type": "Number" + }, + { + "name": "releaseLevel", + "description": "

    Amplitude

    \n", + "type": "Number" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "setADSR": { + "name": "setADSR", + "params": [ + { + "name": "attackTime", + "description": "

    Time (in seconds before envelope\n reaches Attack Level

    \n", + "type": "Number" + }, + { + "name": "decayTime", + "description": "

    Time (in seconds) before envelope\n reaches Decay/Sustain Level

    \n", + "type": "Number", + "optional": true + }, + { + "name": "susRatio", + "description": "

    Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using setRange),\n then decayLevel would increase proportionally, to become 0.5.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "releaseTime", + "description": "

    Time in seconds from now (defaults to 0)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "setRange": { + "name": "setRange", + "params": [ + { + "name": "aLevel", + "description": "

    attack level (defaults to 1)

    \n", + "type": "Number" + }, + { + "name": "rLevel", + "description": "

    release level (defaults to 0)

    \n", + "type": "Number" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "setInput": { + "name": "setInput", + "params": [ + { + "name": "inputs", + "description": "

    A p5.sound object or\n Web Audio Param.

    \n", + "type": "Object", + "optional": true, + "multiple": true + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "setExp": { + "name": "setExp", + "params": [ + { + "name": "isExp", + "description": "

    true is exponential, false is linear

    \n", + "type": "Boolean" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "play": { + "name": "play", + "params": [ + { + "name": "unit", + "description": "

    A p5.sound object or\n Web Audio Param.

    \n", + "type": "Object" + }, + { + "name": "startTime", + "description": "

    time from now (in seconds) at which to play

    \n", + "type": "Number", + "optional": true + }, + { + "name": "sustainTime", + "description": "

    time to sustain before releasing the envelope

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "triggerAttack": { + "name": "triggerAttack", + "params": [ + { + "name": "unit", + "description": "

    p5.sound Object or Web Audio Param

    \n", + "type": "Object" + }, + { + "name": "secondsFromNow", + "description": "

    time from now (in seconds)

    \n", + "type": "Number" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "triggerRelease": { + "name": "triggerRelease", + "params": [ + { + "name": "unit", + "description": "

    p5.sound Object or Web Audio Param

    \n", + "type": "Object" + }, + { + "name": "secondsFromNow", + "description": "

    time to trigger the release

    \n", + "type": "Number" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "ramp": { + "name": "ramp", + "params": [ + { + "name": "unit", + "description": "

    p5.sound Object or Web Audio Param

    \n", + "type": "Object" + }, + { + "name": "secondsFromNow", + "description": "

    When to trigger the ramp

    \n", + "type": "Number" + }, + { + "name": "v", + "description": "

    Target value

    \n", + "type": "Number" + }, + { + "name": "v2", + "description": "

    Second target value

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "add": { + "name": "add", + "params": [ + { + "name": "number", + "description": "

    Constant number to add

    \n", + "type": "Number" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "mult": { + "name": "mult", + "params": [ + { + "name": "number", + "description": "

    Constant number to multiply

    \n", + "type": "Number" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + }, + "scale": { + "name": "scale", + "params": [ + { + "name": "inMin", + "description": "

    input range minumum

    \n", + "type": "Number" + }, + { + "name": "inMax", + "description": "

    input range maximum

    \n", + "type": "Number" + }, + { + "name": "outMin", + "description": "

    input range minumum

    \n", + "type": "Number" + }, + { + "name": "outMax", + "description": "

    input range maximum

    \n", + "type": "Number" + } + ], + "class": "p5.Envelope", + "module": "p5.sound" + } + }, + "p5.Noise": { + "setType": { + "name": "setType", + "params": [ + { + "name": "type", + "description": "

    'white', 'pink' or 'brown'

    \n", + "type": "String", + "optional": true + } + ], + "class": "p5.Noise", + "module": "p5.sound" + } + }, + "p5.Pulse": { + "width": { + "name": "width", + "params": [ + { + "name": "width", + "description": "

    Width between the pulses (0 to 1.0,\n defaults to 0)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Pulse", + "module": "p5.sound" + } + }, + "p5.AudioIn": { + "input": { + "name": "input", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "output": { + "name": "output", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "stream": { + "name": "stream", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "mediaStream": { + "name": "mediaStream", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "currentSource": { + "name": "currentSource", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "enabled": { + "name": "enabled", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "amplitude": { + "name": "amplitude", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "start": { + "name": "start", + "params": [ + { + "name": "successCallback", + "description": "

    Name of a function to call on\n success.

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    Name of a function to call if\n there was an error. For example,\n some browsers do not support\n getUserMedia.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "stop": { + "name": "stop", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "

    An object that accepts audio input,\n such as an FFT

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "getLevel": { + "name": "getLevel", + "params": [ + { + "name": "smoothing", + "description": "

    Smoothing is 0.0 by default.\n Smooths values based on previous values.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "amp": { + "name": "amp", + "params": [ + { + "name": "vol", + "description": "

    between 0 and 1.0

    \n", + "type": "Number" + }, + { + "name": "time", + "description": "

    ramp time (optional)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "getSources": { + "name": "getSources", + "params": [ + { + "name": "successCallback", + "description": "

    This callback function handles the sources when they\n have been enumerated. The callback function\n receives the deviceList array as its only argument

    \n", + "type": "Function", + "optional": true + }, + { + "name": "errorCallback", + "description": "

    This optional callback receives the error\n message as its argument.

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5.AudioIn", + "module": "p5.sound" + }, + "setSource": { + "name": "setSource", + "params": [ + { + "name": "num", + "description": "

    position of input source in the array

    \n", + "type": "Number" + } + ], + "class": "p5.AudioIn", + "module": "p5.sound" + } + }, + "p5.Effect": { + "amp": { + "name": "amp", + "params": [ + { + "name": "vol", + "description": "

    amplitude between 0 and 1.0

    \n", + "type": "Number", + "optional": true + }, + { + "name": "rampTime", + "description": "

    create a fade that lasts until rampTime

    \n", + "type": "Number", + "optional": true + }, + { + "name": "tFromNow", + "description": "

    schedule this event to happen in tFromNow seconds

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Effect", + "module": "p5.sound" + }, + "chain": { + "name": "chain", + "params": [ + { + "name": "arguments", + "description": "

    Chain together multiple sound objects

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.Effect", + "module": "p5.sound" + }, + "drywet": { + "name": "drywet", + "params": [ + { + "name": "fade", + "description": "

    The desired drywet value (0 - 1.0)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Effect", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "", + "type": "Object" + } + ], + "class": "p5.Effect", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.Effect", + "module": "p5.sound" + } + }, + "p5.Filter": { + "biquadFilter": { + "name": "biquadFilter", + "class": "p5.Filter", + "module": "p5.sound" + }, + "process": { + "name": "process", + "params": [ + { + "name": "Signal", + "description": "

    An object that outputs audio

    \n", + "type": "Object" + }, + { + "name": "freq", + "description": "

    Frequency in Hz, from 10 to 22050

    \n", + "type": "Number", + "optional": true + }, + { + "name": "res", + "description": "

    Resonance/Width of the filter frequency\n from 0.001 to 1000

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Filter", + "module": "p5.sound" + }, + "set": { + "name": "set", + "params": [ + { + "name": "freq", + "description": "

    Frequency in Hz, from 10 to 22050

    \n", + "type": "Number", + "optional": true + }, + { + "name": "res", + "description": "

    Resonance (Q) from 0.001 to 1000

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Filter", + "module": "p5.sound" + }, + "freq": { + "name": "freq", + "params": [ + { + "name": "freq", + "description": "

    Filter Frequency

    \n", + "type": "Number" + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Filter", + "module": "p5.sound" + }, + "res": { + "name": "res", + "params": [ + { + "name": "res", + "description": "

    Resonance/Width of filter freq\n from 0.001 to 1000

    \n", + "type": "Number" + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Filter", + "module": "p5.sound" + }, + "gain": { + "name": "gain", + "params": [ + { + "name": "gain", + "description": "", + "type": "Number" + } + ], + "class": "p5.Filter", + "module": "p5.sound" + }, + "toggle": { + "name": "toggle", + "class": "p5.Filter", + "module": "p5.sound" + }, + "setType": { + "name": "setType", + "params": [ + { + "name": "t", + "description": "", + "type": "String" + } + ], + "class": "p5.Filter", + "module": "p5.sound" + } + }, + "p5.EQ": { + "bands": { + "name": "bands", + "class": "p5.EQ", + "module": "p5.sound" + }, + "process": { + "name": "process", + "params": [ + { + "name": "src", + "description": "

    Audio source

    \n", + "type": "Object" + } + ], + "class": "p5.EQ", + "module": "p5.sound" + } + }, + "p5.Panner3D": { + "panner": { + "name": "panner", + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "process": { + "name": "process", + "params": [ + { + "name": "src", + "description": "

    Input source

    \n", + "type": "Object" + } + ], + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "set": { + "name": "set", + "params": [ + { + "name": "xVal", + "description": "", + "type": "Number" + }, + { + "name": "yVal", + "description": "", + "type": "Number" + }, + { + "name": "zVal", + "description": "", + "type": "Number" + }, + { + "name": "time", + "description": "", + "type": "Number" + } + ], + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "positionX": { + "name": "positionX", + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "positionY": { + "name": "positionY", + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "positionZ": { + "name": "positionZ", + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "orient": { + "name": "orient", + "params": [ + { + "name": "xVal", + "description": "", + "type": "Number" + }, + { + "name": "yVal", + "description": "", + "type": "Number" + }, + { + "name": "zVal", + "description": "", + "type": "Number" + }, + { + "name": "time", + "description": "", + "type": "Number" + } + ], + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "orientX": { + "name": "orientX", + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "orientY": { + "name": "orientY", + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "orientZ": { + "name": "orientZ", + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "setFalloff": { + "name": "setFalloff", + "params": [ + { + "name": "maxDistance", + "description": "", + "type": "Number", + "optional": true + }, + { + "name": "rolloffFactor", + "description": "", + "type": "Number", + "optional": true + } + ], + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "maxDist": { + "name": "maxDist", + "params": [ + { + "name": "maxDistance", + "description": "", + "type": "Number" + } + ], + "class": "p5.Panner3D", + "module": "p5.sound" + }, + "rollof": { + "name": "rollof", + "params": [ + { + "name": "rolloffFactor", + "description": "", + "type": "Number" + } + ], + "class": "p5.Panner3D", + "module": "p5.sound" + } + }, + "p5.Delay": { + "leftDelay": { + "name": "leftDelay", + "class": "p5.Delay", + "module": "p5.sound" + }, + "rightDelay": { + "name": "rightDelay", + "class": "p5.Delay", + "module": "p5.sound" + }, + "process": { + "name": "process", + "params": [ + { + "name": "Signal", + "description": "

    An object that outputs audio

    \n", + "type": "Object" + }, + { + "name": "delayTime", + "description": "

    Time (in seconds) of the delay/echo.\n Some browsers limit delayTime to\n 1 second.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "feedback", + "description": "

    sends the delay back through itself\n in a loop that decreases in volume\n each time.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "lowPass", + "description": "

    Cutoff frequency. Only frequencies\n below the lowPass will be part of the\n delay.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Delay", + "module": "p5.sound" + }, + "delayTime": { + "name": "delayTime", + "params": [ + { + "name": "delayTime", + "description": "

    Time (in seconds) of the delay

    \n", + "type": "Number" + } + ], + "class": "p5.Delay", + "module": "p5.sound" + }, + "feedback": { + "name": "feedback", + "params": [ + { + "name": "feedback", + "description": "

    0.0 to 1.0, or an object such as an\n Oscillator that can be used to\n modulate this param

    \n", + "type": "Number|Object" + } + ], + "class": "p5.Delay", + "module": "p5.sound" + }, + "filter": { + "name": "filter", + "params": [ + { + "name": "cutoffFreq", + "description": "

    A lowpass filter will cut off any\n frequencies higher than the filter frequency.

    \n", + "type": "Number|Object" + }, + { + "name": "res", + "description": "

    Resonance of the filter frequency\n cutoff, or an object (i.e. a p5.Oscillator)\n that can be used to modulate this parameter.\n High numbers (i.e. 15) will produce a resonance,\n low numbers (i.e. .2) will produce a slope.

    \n", + "type": "Number|Object" + } + ], + "class": "p5.Delay", + "module": "p5.sound" + }, + "setType": { + "name": "setType", + "params": [ + { + "name": "type", + "description": "

    'pingPong' (1) or 'default' (0)

    \n", + "type": "String|Number" + } + ], + "class": "p5.Delay", + "module": "p5.sound" + }, + "amp": { + "name": "amp", + "params": [ + { + "name": "volume", + "description": "

    amplitude between 0 and 1.0

    \n", + "type": "Number" + }, + { + "name": "rampTime", + "description": "

    create a fade that lasts rampTime

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Delay", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "", + "type": "Object" + } + ], + "class": "p5.Delay", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.Delay", + "module": "p5.sound" + } + }, + "p5.Reverb": { + "process": { + "name": "process", + "params": [ + { + "name": "src", + "description": "

    p5.sound / Web Audio object with a sound\n output.

    \n", + "type": "Object" + }, + { + "name": "seconds", + "description": "

    Duration of the reverb, in seconds.\n Min: 0, Max: 10. Defaults to 3.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "decayRate", + "description": "

    Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "reverse", + "description": "

    Play the reverb backwards or forwards.

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5.Reverb", + "module": "p5.sound" + }, + "set": { + "name": "set", + "params": [ + { + "name": "seconds", + "description": "

    Duration of the reverb, in seconds.\n Min: 0, Max: 10. Defaults to 3.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "decayRate", + "description": "

    Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "reverse", + "description": "

    Play the reverb backwards or forwards.

    \n", + "type": "Boolean", + "optional": true + } + ], + "class": "p5.Reverb", + "module": "p5.sound" + }, + "amp": { + "name": "amp", + "params": [ + { + "name": "volume", + "description": "

    amplitude between 0 and 1.0

    \n", + "type": "Number" + }, + { + "name": "rampTime", + "description": "

    create a fade that lasts rampTime

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Reverb", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "", + "type": "Object" + } + ], + "class": "p5.Reverb", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.Reverb", + "module": "p5.sound" + } + }, + "p5.Convolver": { + "convolverNode": { + "name": "convolverNode", + "class": "p5.Convolver", + "module": "p5.sound" + }, + "impulses": { + "name": "impulses", + "class": "p5.Convolver", + "module": "p5.sound" + }, + "process": { + "name": "process", + "params": [ + { + "name": "src", + "description": "

    p5.sound / Web Audio object with a sound\n output.

    \n", + "type": "Object" + } + ], + "class": "p5.Convolver", + "module": "p5.sound" + }, + "addImpulse": { + "name": "addImpulse", + "params": [ + { + "name": "path", + "description": "

    path to a sound file

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    function (optional)

    \n", + "type": "Function" + }, + { + "name": "errorCallback", + "description": "

    function (optional)

    \n", + "type": "Function" + } + ], + "class": "p5.Convolver", + "module": "p5.sound" + }, + "resetImpulse": { + "name": "resetImpulse", + "params": [ + { + "name": "path", + "description": "

    path to a sound file

    \n", + "type": "String" + }, + { + "name": "callback", + "description": "

    function (optional)

    \n", + "type": "Function" + }, + { + "name": "errorCallback", + "description": "

    function (optional)

    \n", + "type": "Function" + } + ], + "class": "p5.Convolver", + "module": "p5.sound" + }, + "toggleImpulse": { + "name": "toggleImpulse", + "params": [ + { + "name": "id", + "description": "

    Identify the impulse by its original filename\n (String), or by its position in the\n .impulses Array (Number).

    \n", + "type": "String|Number" + } + ], + "class": "p5.Convolver", + "module": "p5.sound" + } + }, + "p5.Phrase": { + "sequence": { + "name": "sequence", + "class": "p5.Phrase", + "module": "p5.sound" + } + }, + "p5.Part": { + "setBPM": { + "name": "setBPM", + "params": [ + { + "name": "BPM", + "description": "

    Beats Per Minute

    \n", + "type": "Number" + }, + { + "name": "rampTime", + "description": "

    Seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "getBPM": { + "name": "getBPM", + "class": "p5.Part", + "module": "p5.sound" + }, + "start": { + "name": "start", + "params": [ + { + "name": "time", + "description": "

    seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "loop": { + "name": "loop", + "params": [ + { + "name": "time", + "description": "

    seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "noLoop": { + "name": "noLoop", + "class": "p5.Part", + "module": "p5.sound" + }, + "stop": { + "name": "stop", + "params": [ + { + "name": "time", + "description": "

    seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "pause": { + "name": "pause", + "params": [ + { + "name": "time", + "description": "

    seconds from now

    \n", + "type": "Number" + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "addPhrase": { + "name": "addPhrase", + "params": [ + { + "name": "phrase", + "description": "

    reference to a p5.Phrase

    \n", + "type": "p5.Phrase" + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "removePhrase": { + "name": "removePhrase", + "params": [ + { + "name": "phraseName", + "description": "", + "type": "String" + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "getPhrase": { + "name": "getPhrase", + "params": [ + { + "name": "phraseName", + "description": "", + "type": "String" + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "replaceSequence": { + "name": "replaceSequence", + "params": [ + { + "name": "phraseName", + "description": "", + "type": "String" + }, + { + "name": "sequence", + "description": "

    Array of values to pass into the callback\n at each step of the phrase.

    \n", + "type": "Array" + } + ], + "class": "p5.Part", + "module": "p5.sound" + }, + "onStep": { + "name": "onStep", + "params": [ + { + "name": "callback", + "description": "

    The name of the callback\n you want to fire\n on every beat/tatum.

    \n", + "type": "Function" + } + ], + "class": "p5.Part", + "module": "p5.sound" + } + }, + "p5.Score": { + "start": { + "name": "start", + "class": "p5.Score", + "module": "p5.sound" + }, + "stop": { + "name": "stop", + "class": "p5.Score", + "module": "p5.sound" + }, + "pause": { + "name": "pause", + "class": "p5.Score", + "module": "p5.sound" + }, + "loop": { + "name": "loop", + "class": "p5.Score", + "module": "p5.sound" + }, + "noLoop": { + "name": "noLoop", + "class": "p5.Score", + "module": "p5.sound" + }, + "setBPM": { + "name": "setBPM", + "params": [ + { + "name": "BPM", + "description": "

    Beats Per Minute

    \n", + "type": "Number" + }, + { + "name": "rampTime", + "description": "

    Seconds from now

    \n", + "type": "Number" + } + ], + "class": "p5.Score", + "module": "p5.sound" + } + }, + "p5.SoundLoop": { + "bpm": { + "name": "bpm", + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "timeSignature": { + "name": "timeSignature", + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "interval": { + "name": "interval", + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "iterations": { + "name": "iterations", + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "musicalTimeMode": { + "name": "musicalTimeMode", + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "maxIterations": { + "name": "maxIterations", + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "start": { + "name": "start", + "params": [ + { + "name": "timeFromNow", + "description": "

    schedule a starting time

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "stop": { + "name": "stop", + "params": [ + { + "name": "timeFromNow", + "description": "

    schedule a stopping time

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "pause": { + "name": "pause", + "params": [ + { + "name": "timeFromNow", + "description": "

    schedule a pausing time

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundLoop", + "module": "p5.sound" + }, + "syncedStart": { + "name": "syncedStart", + "params": [ + { + "name": "otherLoop", + "description": "

    a p5.SoundLoop to sync with

    \n", + "type": "Object" + }, + { + "name": "timeFromNow", + "description": "

    Start the loops in sync after timeFromNow seconds

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.SoundLoop", + "module": "p5.sound" + } + }, + "p5.Compressor": { + "compressor": { + "name": "compressor", + "class": "p5.Compressor", + "module": "p5.sound" + }, + "process": { + "name": "process", + "params": [ + { + "name": "src", + "description": "

    Sound source to be connected

    \n", + "type": "Object" + }, + { + "name": "attack", + "description": "

    The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1

    \n", + "type": "Number", + "optional": true + }, + { + "name": "knee", + "description": "

    A decibel value representing the range above the\n threshold where the curve smoothly transitions to the \"ratio\" portion.\n default = 30, range 0 - 40

    \n", + "type": "Number", + "optional": true + }, + { + "name": "ratio", + "description": "

    The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20

    \n", + "type": "Number", + "optional": true + }, + { + "name": "threshold", + "description": "

    The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0

    \n", + "type": "Number", + "optional": true + }, + { + "name": "release", + "description": "

    The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Compressor", + "module": "p5.sound" + }, + "set": { + "name": "set", + "params": [ + { + "name": "attack", + "description": "

    The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1

    \n", + "type": "Number" + }, + { + "name": "knee", + "description": "

    A decibel value representing the range above the\n threshold where the curve smoothly transitions to the \"ratio\" portion.\n default = 30, range 0 - 40

    \n", + "type": "Number" + }, + { + "name": "ratio", + "description": "

    The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20

    \n", + "type": "Number" + }, + { + "name": "threshold", + "description": "

    The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0

    \n", + "type": "Number" + }, + { + "name": "release", + "description": "

    The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1

    \n", + "type": "Number" + } + ], + "class": "p5.Compressor", + "module": "p5.sound" + }, + "attack": { + "name": "attack", + "params": [ + { + "name": "attack", + "description": "

    Attack is the amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1

    \n", + "type": "Number", + "optional": true + }, + { + "name": "time", + "description": "

    Assign time value to schedule the change in value

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Compressor", + "module": "p5.sound" + }, + "knee": { + "name": "knee", + "params": [ + { + "name": "knee", + "description": "

    A decibel value representing the range above the\n threshold where the curve smoothly transitions to the \"ratio\" portion.\n default = 30, range 0 - 40

    \n", + "type": "Number", + "optional": true + }, + { + "name": "time", + "description": "

    Assign time value to schedule the change in value

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Compressor", + "module": "p5.sound" + }, + "ratio": { + "name": "ratio", + "params": [ + { + "name": "ratio", + "description": "

    The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20

    \n", + "type": "Number", + "optional": true + }, + { + "name": "time", + "description": "

    Assign time value to schedule the change in value

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Compressor", + "module": "p5.sound" + }, + "threshold": { + "name": "threshold", + "params": [ + { + "name": "threshold", + "description": "

    The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0

    \n", + "type": "Number" + }, + { + "name": "time", + "description": "

    Assign time value to schedule the change in value

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Compressor", + "module": "p5.sound" + }, + "release": { + "name": "release", + "params": [ + { + "name": "release", + "description": "

    The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1

    \n", + "type": "Number" + }, + { + "name": "time", + "description": "

    Assign time value to schedule the change in value

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Compressor", + "module": "p5.sound" + }, + "reduction": { + "name": "reduction", + "class": "p5.Compressor", + "module": "p5.sound" + } + }, + "p5.PeakDetect": { + "isDetected": { + "name": "isDetected", + "class": "p5.PeakDetect", + "module": "p5.sound" + }, + "update": { + "name": "update", + "params": [ + { + "name": "fftObject", + "description": "

    A p5.FFT object

    \n", + "type": "p5.FFT" + } + ], + "class": "p5.PeakDetect", + "module": "p5.sound" + }, + "onPeak": { + "name": "onPeak", + "params": [ + { + "name": "callback", + "description": "

    Name of a function that will\n be called when a peak is\n detected.

    \n", + "type": "Function" + }, + { + "name": "val", + "description": "

    Optional value to pass\n into the function when\n a peak is detected.

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.PeakDetect", + "module": "p5.sound" + } + }, + "p5.SoundRecorder": { + "setInput": { + "name": "setInput", + "params": [ + { + "name": "unit", + "description": "

    p5.sound object or a web audio unit\n that outputs sound

    \n", + "type": "Object", + "optional": true + } + ], + "class": "p5.SoundRecorder", + "module": "p5.sound" + }, + "record": { + "name": "record", + "params": [ + { + "name": "soundFile", + "description": "

    p5.SoundFile

    \n", + "type": "p5.SoundFile" + }, + { + "name": "duration", + "description": "

    Time (in seconds)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "callback", + "description": "

    The name of a function that will be\n called once the recording completes

    \n", + "type": "Function", + "optional": true + } + ], + "class": "p5.SoundRecorder", + "module": "p5.sound" + }, + "stop": { + "name": "stop", + "class": "p5.SoundRecorder", + "module": "p5.sound" + } + }, + "p5.Distortion": { + "WaveShaperNode": { + "name": "WaveShaperNode", + "class": "p5.Distortion", + "module": "p5.sound" + }, + "process": { + "name": "process", + "params": [ + { + "name": "amount", + "description": "

    Unbounded distortion amount.\n Normal values range from 0-1.

    \n", + "type": "Number", + "optional": true, + "optdefault": "0.25" + }, + { + "name": "oversample", + "description": "

    'none', '2x', or '4x'.

    \n", + "type": "String", + "optional": true, + "optdefault": "'none'" + } + ], + "class": "p5.Distortion", + "module": "p5.sound" + }, + "set": { + "name": "set", + "params": [ + { + "name": "amount", + "description": "

    Unbounded distortion amount.\n Normal values range from 0-1.

    \n", + "type": "Number", + "optional": true, + "optdefault": "0.25" + }, + { + "name": "oversample", + "description": "

    'none', '2x', or '4x'.

    \n", + "type": "String", + "optional": true, + "optdefault": "'none'" + } + ], + "class": "p5.Distortion", + "module": "p5.sound" + }, + "getAmount": { + "name": "getAmount", + "class": "p5.Distortion", + "module": "p5.sound" + }, + "getOversample": { + "name": "getOversample", + "class": "p5.Distortion", + "module": "p5.sound" + } + }, + "p5.Gain": { + "setInput": { + "name": "setInput", + "params": [ + { + "name": "src", + "description": "

    p5.sound / Web Audio object with a sound\n output.

    \n", + "type": "Object" + } + ], + "class": "p5.Gain", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "", + "type": "Object" + } + ], + "class": "p5.Gain", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.Gain", + "module": "p5.sound" + }, + "amp": { + "name": "amp", + "params": [ + { + "name": "volume", + "description": "

    amplitude between 0 and 1.0

    \n", + "type": "Number" + }, + { + "name": "rampTime", + "description": "

    create a fade that lasts rampTime

    \n", + "type": "Number", + "optional": true + }, + { + "name": "timeFromNow", + "description": "

    schedule this event to happen\n seconds from now

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.Gain", + "module": "p5.sound" + } + }, + "p5.AudioVoice": { + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "", + "type": "Object" + } + ], + "class": "p5.AudioVoice", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.AudioVoice", + "module": "p5.sound" + } + }, + "p5.MonoSynth": { + "attack": { + "name": "attack", + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "decay": { + "name": "decay", + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "sustain": { + "name": "sustain", + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "release": { + "name": "release", + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "play": { + "name": "play", + "params": [ + { + "name": "note", + "description": "

    the note you want to play, specified as a\n frequency in Hertz (Number) or as a midi\n value in Note/Octave format (\"C4\", \"Eb3\"...etc\")\n See \n Tone. Defaults to 440 hz.

    \n", + "type": "String | Number" + }, + { + "name": "velocity", + "description": "

    velocity of the note to play (ranging from 0 to 1)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "secondsFromNow", + "description": "

    time from now (in seconds) at which to play

    \n", + "type": "Number", + "optional": true + }, + { + "name": "sustainTime", + "description": "

    time to sustain before releasing the envelope. Defaults to 0.15 seconds.

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "triggerAttack": { + "params": [ + { + "name": "note", + "description": "

    the note you want to play, specified as a\n frequency in Hertz (Number) or as a midi\n value in Note/Octave format (\"C4\", \"Eb3\"...etc\")\n See \n Tone. Defaults to 440 hz

    \n", + "type": "String | Number" + }, + { + "name": "velocity", + "description": "

    velocity of the note to play (ranging from 0 to 1)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "secondsFromNow", + "description": "

    time from now (in seconds) at which to play

    \n", + "type": "Number", + "optional": true + } + ], + "name": "triggerAttack", + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "triggerRelease": { + "params": [ + { + "name": "secondsFromNow", + "description": "

    time to trigger the release

    \n", + "type": "Number" + } + ], + "name": "triggerRelease", + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "setADSR": { + "name": "setADSR", + "params": [ + { + "name": "attackTime", + "description": "

    Time (in seconds before envelope\n reaches Attack Level

    \n", + "type": "Number" + }, + { + "name": "decayTime", + "description": "

    Time (in seconds) before envelope\n reaches Decay/Sustain Level

    \n", + "type": "Number", + "optional": true + }, + { + "name": "susRatio", + "description": "

    Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using setRange),\n then decayLevel would increase proportionally, to become 0.5.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "releaseTime", + "description": "

    Time in seconds from now (defaults to 0)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "amp": { + "name": "amp", + "params": [ + { + "name": "vol", + "description": "

    desired volume

    \n", + "type": "Number" + }, + { + "name": "rampTime", + "description": "

    Time to reach new volume

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "

    A p5.sound or Web Audio object

    \n", + "type": "Object" + } + ], + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.MonoSynth", + "module": "p5.sound" + }, + "dispose": { + "name": "dispose", + "class": "p5.MonoSynth", + "module": "p5.sound" + } + }, + "p5.PolySynth": { + "notes": { + "name": "notes", + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "polyvalue": { + "name": "polyvalue", + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "AudioVoice": { + "name": "AudioVoice", + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "play": { + "name": "play", + "params": [ + { + "name": "note", + "description": "

    midi note to play (ranging from 0 to 127 - 60 being a middle C)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "velocity", + "description": "

    velocity of the note to play (ranging from 0 to 1)

    \n", + "type": "Number", + "optional": true + }, + { + "name": "secondsFromNow", + "description": "

    time from now (in seconds) at which to play

    \n", + "type": "Number", + "optional": true + }, + { + "name": "sustainTime", + "description": "

    time to sustain before releasing the envelope

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "noteADSR": { + "name": "noteADSR", + "params": [ + { + "name": "note", + "description": "

    Midi note on which ADSR should be set.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "attackTime", + "description": "

    Time (in seconds before envelope\n reaches Attack Level

    \n", + "type": "Number", + "optional": true + }, + { + "name": "decayTime", + "description": "

    Time (in seconds) before envelope\n reaches Decay/Sustain Level

    \n", + "type": "Number", + "optional": true + }, + { + "name": "susRatio", + "description": "

    Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using setRange),\n then decayLevel would increase proportionally, to become 0.5.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "releaseTime", + "description": "

    Time in seconds from now (defaults to 0)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "setADSR": { + "name": "setADSR", + "params": [ + { + "name": "attackTime", + "description": "

    Time (in seconds before envelope\n reaches Attack Level

    \n", + "type": "Number", + "optional": true + }, + { + "name": "decayTime", + "description": "

    Time (in seconds) before envelope\n reaches Decay/Sustain Level

    \n", + "type": "Number", + "optional": true + }, + { + "name": "susRatio", + "description": "

    Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n where 1.0 = attackLevel, 0.0 = releaseLevel.\n The susRatio determines the decayLevel and the level at which the\n sustain portion of the envelope will sustain.\n For example, if attackLevel is 0.4, releaseLevel is 0,\n and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n increased to 1.0 (using setRange),\n then decayLevel would increase proportionally, to become 0.5.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "releaseTime", + "description": "

    Time in seconds from now (defaults to 0)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "noteAttack": { + "name": "noteAttack", + "params": [ + { + "name": "note", + "description": "

    midi note on which attack should be triggered.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "velocity", + "description": "

    velocity of the note to play (ranging from 0 to 1)/

    \n", + "type": "Number", + "optional": true + }, + { + "name": "secondsFromNow", + "description": "

    time from now (in seconds)

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "noteRelease": { + "name": "noteRelease", + "params": [ + { + "name": "note", + "description": "

    midi note on which attack should be triggered.\n If no value is provided, all notes will be released.

    \n", + "type": "Number", + "optional": true + }, + { + "name": "secondsFromNow", + "description": "

    time to trigger the release

    \n", + "type": "Number", + "optional": true + } + ], + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "connect": { + "name": "connect", + "params": [ + { + "name": "unit", + "description": "

    A p5.sound or Web Audio object

    \n", + "type": "Object" + } + ], + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "disconnect": { + "name": "disconnect", + "class": "p5.PolySynth", + "module": "p5.sound" + }, + "dispose": { + "name": "dispose", + "class": "p5.PolySynth", + "module": "p5.sound" + } + } +} \ No newline at end of file diff --git a/src/accessibility/describe.js b/src/accessibility/describe.js index da2a9d3deb..63c52843b2 100644 --- a/src/accessibility/describe.js +++ b/src/accessibility/describe.js @@ -33,7 +33,7 @@ const labelTableElId = '_lte_'; //Label Table Element * * @method describe * @param {String} text description of the canvas. - * @param {Constant} [display] either LABEL or FALLBACK. + * @param {(FALLBACK|LABEL)} [display] either LABEL or FALLBACK. * * @example *
    @@ -183,7 +183,7 @@ p5.prototype.describe = function(text, display) { * @method describeElement * @param {String} name name of the element. * @param {String} text description of the element. - * @param {Constant} [display] either LABEL or FALLBACK. + * @param {(FALLBACK|LABEL)} [display] either LABEL or FALLBACK. * * @example *
    diff --git a/src/accessibility/outputs.js b/src/accessibility/outputs.js index 33afc5991b..7a9feda007 100644 --- a/src/accessibility/outputs.js +++ b/src/accessibility/outputs.js @@ -39,7 +39,7 @@ import p5 from '../core/main'; * learn more about making sketches accessible. * * @method textOutput - * @param {Constant} [display] either FALLBACK or LABEL. + * @param {(FALLBACK|LABEL)} [display] either FALLBACK or LABEL. * * @example *
    @@ -175,7 +175,7 @@ p5.prototype.textOutput = function(display) { * learn more about making sketches accessible. * * @method gridOutput - * @param {Constant} [display] either FALLBACK or LABEL. + * @param {(FALLBACK|LABEL)} [display] either FALLBACK or LABEL. * * @example *
    diff --git a/src/color/p5.Color.js b/src/color/p5.Color.js index 08371b3c4c..55454a823f 100644 --- a/src/color/p5.Color.js +++ b/src/color/p5.Color.js @@ -13,6 +13,7 @@ import color_conversion from './color_conversion'; /* * CSS named colors. + * @private */ const namedColors = { aliceblue: '#f0f8ff', @@ -180,6 +181,7 @@ const PERCENT = new RegExp(`${DECIMAL.source}%`); // Match 12.9%, 79%, .9%, etc. /* * Full color string patterns. The capture groups are necessary. + * @private */ const colorPatterns = { // Match colors in format #XXX, e.g. #416. diff --git a/src/color/setting.js b/src/color/setting.js index 457e686dd0..903261feac 100644 --- a/src/color/setting.js +++ b/src/color/setting.js @@ -475,7 +475,7 @@ p5.prototype.clear = function(...args) { * created in. Changing modes doesn't affect their appearance. * * @method colorMode - * @param {Constant} mode either RGB, HSB or HSL, corresponding to + * @param {(RGB|HSB|HSL)} mode either RGB, HSB or HSL, corresponding to * Red/Green/Blue and Hue/Saturation/Brightness * (or Lightness). * @param {Number} [max] range for all values. @@ -545,7 +545,7 @@ p5.prototype.clear = function(...args) { /** * @method colorMode - * @param {Constant} mode + * @param {(RGB|HSB|HSL)} mode * @param {Number} max1 range for the red or hue depending on the * current color mode. * @param {Number} max2 range for the green or saturation depending diff --git a/src/core/constants.js b/src/core/constants.js index f18eb7bb53..35357cd3ea 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -17,7 +17,8 @@ export const VERSION = // GRAPHICS RENDERER /** * The default, two-dimensional renderer. - * @property {String} P2D + * @typedef {unique symbol} P2D + * @property {P2D} P2D * @final */ export const P2D = Symbol('p2d'); @@ -38,7 +39,8 @@ export const P2D = Symbol('p2d'); * * To learn more about WEBGL mode, check out all the interactive WEBGL tutorials in the "Learn" section of this website, or read the wiki article "Getting started with WebGL in p5". * - * @property {String} WEBGL + * @typedef {unique symbol} WEBGL + * @property {WEBGL} WEBGL * @final */ export const WEBGL = Symbol('webgl'); @@ -46,39 +48,46 @@ export const WEBGL = Symbol('webgl'); * One of the two possible values of a WebGL canvas (either WEBGL or WEBGL2), * which can be used to determine what capabilities the rendering environment * has. - * @property {String} WEBGL2 + * @typedef {unique symbol} WEBGL2 + * @property {WEBGL2} WEBGL2 * @final */ export const WEBGL2 = Symbol('webgl2'); // ENVIRONMENT /** - * @property {String} ARROW + * @typedef {'default'} ARROW + * @property {ARROW} ARROW * @final */ export const ARROW = 'default'; /** - * @property {String} CROSS + * @typedef {'crosshair'} CROSS + * @property {CROSS} CROSS * @final */ export const CROSS = 'crosshair'; /** - * @property {String} HAND + * @typedef {'pointer'} HAND + * @property {HAND} HAND * @final */ export const HAND = 'pointer'; /** - * @property {String} MOVE + * @typedef {'move'} MOVE + * @property {MOVE} MOVE * @final */ export const MOVE = 'move'; /** - * @property {String} TEXT + * @typedef {'text'} TEXT + * @property {TEXT} TEXT * @final */ export const TEXT = 'text'; /** - * @property {String} WAIT + * @typedef {'wait'} WAIT + * @property {WAIT} WAIT * @final */ export const WAIT = 'wait'; @@ -178,7 +187,8 @@ export const TWO_PI = _PI * 2; /** * 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 + * @typedef {unique symbol} DEGREES + * @property {DEGREES} DEGREES * @final * * @example @@ -192,7 +202,8 @@ export const DEGREES = Symbol('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 + * @typedef {unique symbol} RADIANS + * @property {RADIANS} RADIANS * @final * * @example @@ -208,161 +219,178 @@ export const RAD_TO_DEG = 180.0 / _PI; // SHAPE /** - * @property {String} CORNER + * @typedef {'corner'} CORNER + * @property {CORNER} CORNER * @final */ export const CORNER = 'corner'; /** - * @property {String} CORNERS + * @typedef {'corners'} CORNERS + * @property {CORNERS} CORNERS * @final */ export const CORNERS = 'corners'; /** - * @property {String} RADIUS + * @typedef {'radius'} RADIUS + * @property {RADIUS} RADIUS * @final */ export const RADIUS = 'radius'; /** - * @property {String} RIGHT + * @typedef {'right'} RIGHT + * @property {RIGHT} RIGHT * @final */ export const RIGHT = 'right'; /** - * @property {String} LEFT + * @typedef {'left'} LEFT + * @property {LEFT} LEFT * @final */ export const LEFT = 'left'; /** - * @property {String} CENTER + * @typedef {'center'} CENTER + * @property {CENTER} CENTER * @final */ export const CENTER = 'center'; /** - * @property {String} TOP + * @typedef {'top'} TOP + * @property {TOP} TOP * @final */ export const TOP = 'top'; /** - * @property {String} BOTTOM + * @typedef {'bottom'} BOTTOM + * @property {BOTTOM} BOTTOM * @final */ export const BOTTOM = 'bottom'; /** - * @property {String} BASELINE + * @typedef {'alphabetic'} BASELINE + * @property {BASELINE} BASELINE * @final - * @default alphabetic */ export const BASELINE = 'alphabetic'; /** - * @property {Number} POINTS + * @typedef {0x0000} POINTS + * @property {POINTS} POINTS * @final - * @default 0x0000 */ export const POINTS = 0x0000; /** - * @property {Number} LINES + * @typedef {0x0001} LINES + * @property {LINES} LINES * @final - * @default 0x0001 */ export const LINES = 0x0001; /** - * @property {Number} LINE_STRIP + * @property {0x0003} LINE_STRIP + * @property {LINE_STRIP} LINE_STRIP * @final - * @default 0x0003 */ export const LINE_STRIP = 0x0003; /** - * @property {Number} LINE_LOOP + * @typedef {0x0002} LINE_LOOP + * @property {LINE_LOOP} LINE_LOOP * @final - * @default 0x0002 */ export const LINE_LOOP = 0x0002; /** - * @property {Number} TRIANGLES + * @typedef {0x0004} TRIANGLES + * @property {TRIANGLES} TRIANGLES * @final - * @default 0x0004 */ export const TRIANGLES = 0x0004; /** - * @property {Number} TRIANGLE_FAN + * @typedef {0x0006} TRIANGLE_FAN + * @property {TRIANGLE_FAN} TRIANGLE_FAN * @final - * @default 0x0006 */ export const TRIANGLE_FAN = 0x0006; /** - * @property {Number} TRIANGLE_STRIP + * @typedef {0x0005} TRIANGLE_STRIP + * @property {TRIANGLE_STRIP} TRIANGLE_STRIP * @final - * @default 0x0005 */ export const TRIANGLE_STRIP = 0x0005; /** - * @property {String} QUADS + * @typedef {'quads'} QUADS + * @property {QUADS} QUADS * @final */ export const QUADS = 'quads'; /** - * @property {String} QUAD_STRIP + * @typedef {'quad_strip'} QUAD_STRIP + * @property {QUAD_STRIP} QUAD_STRIP * @final - * @default quad_strip */ export const QUAD_STRIP = 'quad_strip'; /** - * @property {String} TESS + * @typedef {'tess'} TESS + * @property {TESS} TESS * @final - * @default tess */ export const TESS = 'tess'; /** - * @property {String} CLOSE + * @typedef {'close'} CLOSE + * @property {CLOSE} CLOSE * @final */ export const CLOSE = 'close'; /** - * @property {String} OPEN + * @typedef {'open'} OPEN + * @property {OPEN} OPEN * @final */ export const OPEN = 'open'; /** - * @property {String} CHORD + * @typedef {'chord'} CHORD + * @property {CHORD} CHORD * @final */ export const CHORD = 'chord'; /** - * @property {String} PIE + * @typedef {'pie'} PIE + * @property {PIE} PIE * @final */ export const PIE = 'pie'; /** - * @property {String} PROJECT + * @typedef {'square'} PROJECT + * @property {PROJECT} PROJECT * @final - * @default square */ export const PROJECT = 'square'; // PEND: careful this is counterintuitive /** - * @property {String} SQUARE + * @typedef {'butt'} SQUARE + * @property {SQUERE} SQUARE * @final - * @default butt */ export const SQUARE = 'butt'; /** - * @property {String} ROUND + * @typedef {'round'} ROUND + * @property {ROUND} ROUND * @final */ export const ROUND = 'round'; /** - * @property {String} BEVEL + * @typedef {'bevel'} BEVEL + * @property {BEVEL} BEVEL * @final */ export const BEVEL = 'bevel'; /** - * @property {String} MITER + * @typedef {'miter'} MITER + * @property {MITER} MITER * @final */ export const MITER = 'miter'; // COLOR /** - * @property {String} RGB + * @typedef {'rgb'} RGB + * @property {RGB} RGB * @final */ export const RGB = 'rgb'; @@ -371,12 +399,14 @@ export const RGB = 'rgb'; * You can learn more about it at * HSB. * - * @property {String} HSB + * @typedef {'hsb'} HSB + * @property {HSB} HSB * @final */ export const HSB = 'hsb'; /** - * @property {String} HSL + * @typedef {'hsl'} HSL + * @property {HSL} HSL * @final */ export const HSL = 'hsl'; @@ -387,244 +417,280 @@ export const HSL = 'hsl'; * based on the current height and width of the element. Only one parameter can * be passed to the size function as AUTO, at a time. * - * @property {String} AUTO + * @typedef {'auto'} AUTO + * @property {AUTO} AUTO * @final */ export const AUTO = 'auto'; /** - * @property {Number} ALT + * @typedef {18} ALT + * @property {ALT} ALT * @final */ // INPUT export const ALT = 18; /** - * @property {Number} BACKSPACE + * @typedef {8} BACKSPACE + * @property {BACKSPACE} BACKSPACE * @final */ export const BACKSPACE = 8; /** - * @property {Number} CONTROL + * @typedef {17} CONTROL + * @property {CONTROL} CONTROL * @final */ export const CONTROL = 17; /** - * @property {Number} DELETE + * @typedef {46} DELETE + * @property {DELETE} DELETE * @final */ export const DELETE = 46; /** - * @property {Number} DOWN_ARROW + * @typedef {40} DOWN_ARROW + * @property {DOWN_ARROW} DOWN_ARROW * @final */ export const DOWN_ARROW = 40; /** - * @property {Number} ENTER + * @typedef {13} ENTER + * @property {ENTER} ENTER * @final */ export const ENTER = 13; /** - * @property {Number} ESCAPE + * @typedef {27} ESCAPE + * @property {ESCAPE} ESCAPE * @final */ export const ESCAPE = 27; /** - * @property {Number} LEFT_ARROW + * @typedef {37} LEFT_ARROW + * @property {LEFT_ARROW} LEFT_ARROW * @final */ export const LEFT_ARROW = 37; /** - * @property {Number} OPTION + * @typedef {18} OPTION + * @property {OPTION} OPTION * @final */ export const OPTION = 18; /** - * @property {Number} RETURN + * @typedef {13} RETURN + * @property {RETURN} RETURN * @final */ export const RETURN = 13; /** - * @property {Number} RIGHT_ARROW + * @typedef {39} RIGHT_ARROW + * @property {RIGHT_ARROW} RIGHT_ARROW * @final */ export const RIGHT_ARROW = 39; /** - * @property {Number} SHIFT + * @typedef {16} SHIFT + * @property {SHIFT} SHIFT * @final */ export const SHIFT = 16; /** - * @property {Number} TAB + * @typedef {9} TAB + * @property {TAB} TAB * @final */ export const TAB = 9; /** - * @property {Number} UP_ARROW + * @typedef {38} UP_ARROW + * @property {UP_ARROW} UP_ARROW * @final */ export const UP_ARROW = 38; // RENDERING /** - * @property {String} BLEND + * @typedef {'source-over'} BLEND + * @property {BLEND} BLEND * @final - * @default source-over */ export const BLEND = 'source-over'; /** - * @property {String} REMOVE + * @typedef {'destination-out'} REMOVE + * @property {REMOVE} REMOVE * @final - * @default destination-out */ export const REMOVE = 'destination-out'; /** - * @property {String} ADD + * @typedef {'lighter'} ADD + * @property {ADD} ADD * @final - * @default lighter */ export const ADD = 'lighter'; -//ADD: 'add', // -//SUBTRACT: 'subtract', // /** - * @property {String} DARKEST + * @typedef {'darken'} DARKEST + * @property {DARKEST} DARKEST * @final */ export const DARKEST = 'darken'; /** - * @property {String} LIGHTEST + * @typedef {'lighten'} LIGHTEST + * @property {LIGHTEST} LIGHTEST * @final - * @default lighten */ export const LIGHTEST = 'lighten'; /** - * @property {String} DIFFERENCE + * @typedef {'difference'} DIFFERENCE + * @property {DIFFERENCE} DIFFERENCE * @final */ export const DIFFERENCE = 'difference'; /** - * @property {String} SUBTRACT + * @typedef {'subtract'} SUBTRACT + * @property {SUBTRACT} SUBTRACT * @final */ export const SUBTRACT = 'subtract'; /** - * @property {String} EXCLUSION + * @typedef {'exclusion'} EXCLUSION + * @property {EXCLUSION} EXCLUSION * @final */ export const EXCLUSION = 'exclusion'; /** - * @property {String} MULTIPLY + * @typedef {'multiply'} MULTIPLY + * @property {MULTIPLY} MULTIPLY * @final */ export const MULTIPLY = 'multiply'; /** - * @property {String} SCREEN + * @typedef {'screen'} SCREEN + * @property {SCREEN} SCREEN * @final */ export const SCREEN = 'screen'; /** - * @property {String} REPLACE + * @typedef {'copy'} REPLACE + * @property {REPLACE} REPLACE * @final - * @default copy */ export const REPLACE = 'copy'; /** - * @property {String} OVERLAY + * @typedef {'overlay'} OVERLAY + * @property {OVERLAY} OVERLAY * @final */ export const OVERLAY = 'overlay'; /** - * @property {String} HARD_LIGHT + * @typedef {'hard-light'} HARD_LIGHT + * @property {HARD_LIGHT} HARD_LIGHT * @final */ export const HARD_LIGHT = 'hard-light'; /** - * @property {String} SOFT_LIGHT + * @typedef {'soft-light'} SOFT_LIGHT + * @property {SOFT_LIGHT} SOFT_LIGHT * @final */ export const SOFT_LIGHT = 'soft-light'; /** - * @property {String} DODGE + * @typedef {'color-dodge'} DODGE + * @property {DODGE} DODGE * @final - * @default color-dodge */ export const DODGE = 'color-dodge'; /** - * @property {String} BURN + * @typedef {'color-burn'} BURN + * @property {BURN} BURN * @final - * @default color-burn */ export const BURN = 'color-burn'; // FILTERS /** - * @property {String} THRESHOLD + * @typedef {'threshold'} THRESHOLD + * @property {THRESHOLD} THRESHOLD * @final */ export const THRESHOLD = 'threshold'; /** - * @property {String} GRAY + * @typedef {'gray'} GRAY + * @property {GRAY} GRAY * @final */ export const GRAY = 'gray'; /** - * @property {String} OPAQUE + * @typedef {'opaque'} OPAQUE + * @property {OPAQUE} OPAQUE * @final */ export const OPAQUE = 'opaque'; /** - * @property {String} INVERT + * @typedef {'invert'} INVERT + * @property {INVERT} INVERT * @final */ export const INVERT = 'invert'; /** - * @property {String} POSTERIZE + * @typedef {'posterize'} POSTERIZE + * @property {POSTERIZE} POSTERIZE * @final */ export const POSTERIZE = 'posterize'; /** - * @property {String} DILATE + * @typedef {'dilate'} DILATE + * @property {DILATE} DILATE * @final */ export const DILATE = 'dilate'; /** - * @property {String} ERODE + * @typedef {'erode'} ERODE + * @property {ERODE} ERODE * @final */ export const ERODE = 'erode'; /** - * @property {String} BLUR + * @typedef {'blur'} BLUR + * @property {BLUR} BLUR * @final */ export const BLUR = 'blur'; // TYPOGRAPHY /** - * @property {String} NORMAL + * @typedef {'normal'} NORMAL + * @property {NORMAL} NORMAL * @final */ export const NORMAL = 'normal'; /** - * @property {String} ITALIC + * @typedef {'italic'} ITALIC + * @property {ITALIC} ITALIC * @final */ export const ITALIC = 'italic'; /** - * @property {String} BOLD + * @typedef {'bold'} BOLD + * @property {BOLD} BOLD * @final */ export const BOLD = 'bold'; /** - * @property {String} BOLDITALIC + * @typedef {'bold italic'} BOLDITALIC + * @property {BOLDITALIC} BOLDITALIC * @final */ export const BOLDITALIC = 'bold italic'; /** - * @property {String} CHAR + * @typedef {'CHAR'} CHAR + * @property {CHAR} CHAR * @final */ export const CHAR = 'CHAR'; /** - * @property {String} WORD + * @typedef {'WORD'} WORD + * @property {WORD} WORD * @final */ export const WORD = 'WORD'; @@ -636,44 +702,52 @@ export const _CTX_MIDDLE = 'middle'; // VERTICES /** - * @property {String} LINEAR + * @typedef {'linear'} LINEAR + * @property {LINEAR} LINEAR * @final */ export const LINEAR = 'linear'; /** - * @property {String} QUADRATIC + * @typedef {'quadratic'} QUADRATIC + * @property {QUADRATIC} QUADRATIC * @final */ export const QUADRATIC = 'quadratic'; /** - * @property {String} BEZIER + * @typedef {'bezier'} BEZIER + * @property {BEZIER} BEZIER * @final */ export const BEZIER = 'bezier'; /** - * @property {String} CURVE + * @typedef {'curve'} CURVE + * @property {CURVE} CURVE * @final */ export const CURVE = 'curve'; // WEBGL DRAWMODES /** - * @property {String} STROKE + * @typedef {'stroke'} STROKE + * @property {STROKE} STROKE * @final */ export const STROKE = 'stroke'; /** - * @property {String} FILL + * @typedef {'fill'} FILL + * @property {FILL} FILL * @final */ export const FILL = 'fill'; /** - * @property {String} TEXTURE + * @typedef {'texture'} TEXTURE + * @property {TEXTURE} TEXTURE * @final */ export const TEXTURE = 'texture'; /** - * @property {String} IMMEDIATE + * @typedef {'immediate'} IMMEDIATE + * @property {IMMEDIATE} IMMEDIATE * @final */ export const IMMEDIATE = 'immediate'; @@ -681,7 +755,8 @@ export const IMMEDIATE = 'immediate'; // WEBGL TEXTURE MODE // NORMAL already exists for typography /** - * @property {String} IMAGE + * @typedef {'image'} IMAGE + * @property {IMAGE} IMAGE * @final */ export const IMAGE = 'image'; @@ -689,46 +764,54 @@ export const IMAGE = 'image'; // WEBGL TEXTURE WRAP AND FILTERING // LINEAR already exists above /** - * @property {String} NEAREST + * @typedef {'nearest'} NEAREST + * @property {NEAREST} NEAREST * @final */ export const NEAREST = 'nearest'; /** - * @property {String} REPEAT + * @typedef {'repeat'} REPEAT + * @property {REPEAT} REPEAT * @final */ export const REPEAT = 'repeat'; /** - * @property {String} CLAMP + * @typedef {'clamp'} CLAMP + * @property {CLAMP} CLAMP * @final */ export const CLAMP = 'clamp'; /** - * @property {String} MIRROR + * @typedef {'mirror'} MIRROR + * @property {MIRROR} MIRROR * @final */ export const MIRROR = 'mirror'; // WEBGL GEOMETRY SHADING /** - * @property {String} FLAT + * @typedef {'flat'} FLAT + * @property {FLAT} FLAT * @final */ export const FLAT = 'flat'; /** - * @property {String} SMOOTH + * @typedef {'smooth'} SMOOTH + * @property {SMOOTH} SMOOTH * @final */ export const SMOOTH = 'smooth'; // DEVICE-ORIENTATION /** - * @property {String} LANDSCAPE + * @typedef {'landscape'} LANDSCAPE + * @property {LANDSCAPE} LANDSCAPE * @final */ export const LANDSCAPE = 'landscape'; /** - * @property {String} PORTRAIT + * @typedef {'portrait'} PORTRAIT + * @property {PORTRAIT} PORTRAIT * @final */ export const PORTRAIT = 'portrait'; @@ -738,66 +821,77 @@ export const _DEFAULT_STROKE = '#000000'; export const _DEFAULT_FILL = '#FFFFFF'; /** - * @property {String} GRID + * @typedef {'grid'} GRID + * @property {GRID} GRID * @final */ export const GRID = 'grid'; /** - * @property {String} AXES + * @typedef {'axes'} AXES + * @property {AXES} AXES * @final */ export const AXES = 'axes'; /** - * @property {String} LABEL + * @typedef {'label'} LABEL + * @property {LABEL} LABEL * @final */ export const LABEL = 'label'; /** - * @property {String} FALLBACK + * @typedef {'fallback'} FALLBACK + * @property {FALLBACK} FALLBACK * @final */ export const FALLBACK = 'fallback'; /** - * @property {String} CONTAIN + * @typedef {'contain'} CONTAIN + * @property {CONTAIN} CONTAIN * @final */ export const CONTAIN = 'contain'; /** - * @property {String} COVER + * @typedef {'cover'} COVER + * @property {COVER} COVER * @final */ export const COVER = 'cover'; /** - * @property {String} UNSIGNED_BYTE + * @typedef {'unsigned-byte'} UNSIGNED_BYTE + * @property {UNSIGNED_BYTE} UNSIGNED_BYTE * @final */ export const UNSIGNED_BYTE = 'unsigned-byte'; /** - * @property {String} UNSIGNED_INT + * @typedef {'unsigned-int'} UNSIGNED_INT + * @property {UNSIGNED_INT} UNSIGNED_INT * @final */ export const UNSIGNED_INT = 'unsigned-int'; /** - * @property {String} FLOAT + * @typedef {'float'} FLOAT + * @property {FLOAT} FLOAT * @final */ export const FLOAT = 'float'; /** - * @property {String} HALF_FLOAT + * @typedef {'half-float'} HALF_FLOAT + * @property {HALF_FLOAT} HALF_FLOAT * @final */ export const HALF_FLOAT = 'half-float'; /** - * @property {String} RGBA + * @typedef {'rgba'} RGBA + * @property {RGBA} RGBA * @final */ export const RGBA = 'rgba'; diff --git a/src/core/environment.js b/src/core/environment.js index cf4444bc65..05df4177a0 100644 --- a/src/core/environment.js +++ b/src/core/environment.js @@ -207,7 +207,7 @@ p5.prototype.focused = document.hasFocus(); * and `y` must be less than the image's width and height, respectively. * * @method cursor - * @param {String|Constant} type Built-in: either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT. + * @param {(ARROW|CROSS|HAND|MOVE|TEXT|WAIT|String)} type Built-in: either ARROW, CROSS, HAND, MOVE, TEXT, or WAIT. * Native CSS properties: 'grab', 'progress', and so on. * Path to cursor image. * @param {Number} [x] horizontal active spot of the cursor. @@ -474,7 +474,7 @@ p5.prototype.noCursor = function() { * See setAttributes() for ways to set the * WebGL version. * - * @property {String} webglVersion + * @property {(WEBGL|WEBGL2)} webglVersion * @readOnly * @example *
    diff --git a/src/core/internationalization.js b/src/core/internationalization.js index f7b677d6f1..6f61925cff 100644 --- a/src/core/internationalization.js +++ b/src/core/internationalization.js @@ -26,6 +26,7 @@ if (typeof IS_MINIFIED === 'undefined') { /* * This is our i18next "backend" plugin. It tries to fetch languages * from a CDN. + * @private */ class FetchResources { constructor(services, options) { @@ -121,6 +122,7 @@ export let translator = (key, values) => { /* * Set up our translation function, with loaded languages + * @private */ export const initialize = () => { let i18init = i18next @@ -166,6 +168,7 @@ export const initialize = () => { /* * Returns a list of languages we have translations loaded for + * @private */ export const availableTranslatorLanguages = () => { return i18next.languages; @@ -173,6 +176,7 @@ export const availableTranslatorLanguages = () => { /* * Returns the current language selected for translation + * @private */ export const currentTranslatorLanguage = language => { return i18next.language; @@ -182,6 +186,7 @@ export const currentTranslatorLanguage = language => { * Sets the current language for translation * Returns a promise that resolved when loading is finished, * or rejects if it fails. + * @private */ export const setTranslatorLanguage = language => { return i18next.changeLanguage(language || undefined, e => diff --git a/src/core/p5.Graphics.js b/src/core/p5.Graphics.js index e7da71b907..9a5304568f 100644 --- a/src/core/p5.Graphics.js +++ b/src/core/p5.Graphics.js @@ -18,7 +18,7 @@ import * as constants from './constants'; * @extends p5.Element * @param {Number} w width * @param {Number} h height - * @param {Constant} renderer the renderer to use, either P2D or WEBGL + * @param {(P2D|WEBGL)} renderer the renderer to use, either P2D or WEBGL * @param {p5} [pInst] pointer to p5 instance * @param {HTMLCanvasElement} [canvas] existing html canvas element */ diff --git a/src/core/p5.Renderer2D.js b/src/core/p5.Renderer2D.js index 6a6ec0c589..2575764d3b 100644 --- a/src/core/p5.Renderer2D.js +++ b/src/core/p5.Renderer2D.js @@ -3,14 +3,15 @@ import * as constants from './constants'; import Renderer from './p5.Renderer'; -/* +const styleEmpty = 'rgba(0,0,0,0)'; +// const alphaThreshold = 0.00125; // minimum visible + +/** * p5.Renderer2D * The 2D graphics canvas renderer class. * extends p5.Renderer + * @private */ -const styleEmpty = 'rgba(0,0,0,0)'; -// const alphaThreshold = 0.00125; // minimum visible - class Renderer2D extends Renderer { constructor(elt, pInst, isMainCanvas) { super(elt, pInst, isMainCanvas); diff --git a/src/core/rendering.js b/src/core/rendering.js index 5f6a248f50..7da2976f32 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -50,7 +50,7 @@ const renderers = p5.renderers = { * @method createCanvas * @param {Number} w width of the canvas * @param {Number} h height of the canvas - * @param {Constant} [renderer] either P2D or WEBGL + * @param {(P2D|WEBGL)} [renderer] either P2D or WEBGL * @param {HTMLCanvasElement} [canvas] existing html canvas element * @return {p5.Renderer} pointer to p5.Renderer holding canvas * @example @@ -266,7 +266,7 @@ p5.prototype.noCanvas = function() { * @method createGraphics * @param {Number} w width of the offscreen graphics buffer * @param {Number} h height of the offscreen graphics buffer - * @param {Constant} [renderer] either P2D or WEBGL + * @param {(P2D|WEBGL)} [renderer] either P2D or WEBGL * undefined defaults to p2d * @param {HTMLCanvasElement} [canvas] existing html canvas element * @return {p5.Graphics} offscreen graphics buffer @@ -499,7 +499,7 @@ p5.prototype.clearDepth = function(depth) { * (3D) indicates that this blend mode only works in the WEBGL renderer. * * @method blendMode - * @param {Constant} mode blend mode to set for canvas. + * @param {(BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|REMOVE|SUBTRACT)} mode blend mode to set for canvas. * either BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY, * EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, * SOFT_LIGHT, DODGE, BURN, ADD, REMOVE or SUBTRACT diff --git a/src/core/shape/2d_primitives.js b/src/core/shape/2d_primitives.js index f2b62203e3..28264e1c79 100644 --- a/src/core/shape/2d_primitives.js +++ b/src/core/shape/2d_primitives.js @@ -116,7 +116,7 @@ p5.prototype._normalizeArcAngles = ( * @param {Number} h height of the arc's ellipse by default. * @param {Number} start angle to start the arc, specified in radians. * @param {Number} stop angle to stop the arc, specified in radians. - * @param {Constant} [mode] optional parameter to determine the way of drawing + * @param {(CHORD|PIE|OPEN)} [mode] optional parameter to determine the way of drawing * the arc. either CHORD, PIE, or OPEN. * @param {Integer} [detail] optional parameter for WebGL mode only. This is to * specify the number of vertices that makes up the diff --git a/src/core/shape/attributes.js b/src/core/shape/attributes.js index e50b17c577..29198b23a9 100644 --- a/src/core/shape/attributes.js +++ b/src/core/shape/attributes.js @@ -30,7 +30,7 @@ import * as constants from '../constants'; * case-sensitive language. * * @method ellipseMode - * @param {Constant} mode either CENTER, RADIUS, CORNER, or CORNERS + * @param {(CENTER|RADIUS|CORNER|CORNERS)} mode either CENTER, RADIUS, CORNER, or CORNERS * @chainable * @example *
    @@ -127,7 +127,7 @@ p5.prototype.noSmooth = function() { * JavaScript is a case-sensitive language. * * @method rectMode - * @param {Constant} mode either CORNER, CORNERS, CENTER, or RADIUS + * @param {(CENTER|RADIUS|CORNER|CORNERS)} mode either CORNER, CORNERS, CENTER, or RADIUS * @chainable * @example *
    @@ -216,7 +216,7 @@ p5.prototype.smooth = function() { * JavaScript is a case-sensitive language. * * @method strokeCap - * @param {Constant} cap either ROUND, SQUARE, or PROJECT + * @param {(ROUND|SQUARE|PROJECT)} cap either ROUND, SQUARE, or PROJECT * @chainable * @example *
    @@ -254,7 +254,7 @@ p5.prototype.strokeCap = function(cap) { * JavaScript is a case-sensitive language. * * @method strokeJoin - * @param {Constant} join either MITER, BEVEL, or ROUND + * @param {(MITER|BEVEL|ROUND)} join either MITER, BEVEL, or ROUND * @chainable * @example *
    diff --git a/src/dom/dom.js b/src/dom/dom.js index f8b5952d91..61a99f5e42 100644 --- a/src/dom/dom.js +++ b/src/dom/dom.js @@ -2145,7 +2145,7 @@ if (navigator.mediaDevices.getUserMedia === undefined) { * and here. * * @method createCapture - * @param {String|Constant|Object} [type] type of capture, either AUDIO or VIDEO, + * @param {(AUDIO|VIDEO|Object)} [type] type of capture, either AUDIO or VIDEO, * or a constraints object. Both video and audio * audio streams are captured by default. * @param {Function} [callback] function to call once the stream @@ -3243,8 +3243,8 @@ p5.Element.prototype.hide = function () { */ /** * @method size - * @param {Number|Constant} w width of the element, either AUTO, or a number. - * @param {Number|Constant} [h] height of the element, either AUTO, or a number. + * @param {(Number|AUTO)} w width of the element, either AUTO, or a number. + * @param {(Number|AUTO)} [h] height of the element, either AUTO, or a number. * @chainable */ p5.Element.prototype.size = function (w, h) { diff --git a/src/events/acceleration.js b/src/events/acceleration.js index 01c3d294f8..01adabe7f6 100644 --- a/src/events/acceleration.js +++ b/src/events/acceleration.js @@ -15,7 +15,7 @@ import * as constants from '../core/constants'; * or 'portrait'. If no data is available it will be set to 'undefined'. * either LANDSCAPE or PORTRAIT. * - * @property {Constant} deviceOrientation + * @property {(LANDSCAPE|PORTRAIT)} deviceOrientation * @readOnly */ p5.prototype.deviceOrientation = diff --git a/src/events/mouse.js b/src/events/mouse.js index daeb6439c3..bb73d320b1 100644 --- a/src/events/mouse.js +++ b/src/events/mouse.js @@ -344,7 +344,7 @@ p5.prototype.pwinMouseY = 0; * LEFT, RIGHT, or CENTER depending on which button was pressed last. * Warning: different browsers may track mouseButton differently. * - * @property {Constant} mouseButton + * @property {(LEFT|RIGHT|CENTER)} mouseButton * @readOnly * * @example diff --git a/src/image/filters.js b/src/image/filters.js index fe9f6b6f04..f55e4c3ae8 100644 --- a/src/image/filters.js +++ b/src/image/filters.js @@ -11,6 +11,8 @@ * A number of functions are borrowed/adapted from * http://www.html5rocks.com/en/tutorials/canvas/imagefilters/ * or the java processing implementation. + * + * @private */ const Filters = { diff --git a/src/image/loading_displaying.js b/src/image/loading_displaying.js index bc6ff747cc..0a1404f2eb 100644 --- a/src/image/loading_displaying.js +++ b/src/image/loading_displaying.js @@ -719,8 +719,8 @@ function _createGif( /** * @private - * @param {Constant} xAlign either LEFT, RIGHT or CENTER - * @param {Constant} yAlign either TOP, BOTTOM or CENTER + * @param {(LEFT|RIGHT|CENTER)} xAlign either LEFT, RIGHT or CENTER + * @param {(TOP|BOTTOM|CENTER)} yAlign either TOP, BOTTOM or CENTER * @param {Number} dx * @param {Number} dy * @param {Number} dw @@ -752,8 +752,8 @@ function _imageContain(xAlign, yAlign, dx, dy, dw, dh, sw, sh) { /** * @private - * @param {Constant} xAlign either LEFT, RIGHT or CENTER - * @param {Constant} yAlign either TOP, BOTTOM or CENTER + * @param {(LEFT|RIGHT|CENTER)} xAlign either LEFT, RIGHT or CENTER + * @param {(TOP|BOTTOM|CENTER)} yAlign either TOP, BOTTOM or CENTER * @param {Number} dw * @param {Number} dh * @param {Number} sx @@ -786,9 +786,9 @@ function _imageCover(xAlign, yAlign, dw, dh, sx, sy, sw, sh) { /** * @private - * @param {Constant} [fit] either CONTAIN or COVER - * @param {Constant} xAlign either LEFT, RIGHT or CENTER - * @param {Constant} yAlign either TOP, BOTTOM or CENTER + * @param {(CONTAIN|COVER)} [fit] either CONTAIN or COVER + * @param {(LEFT|RIGHT|CENTER)} xAlign either LEFT, RIGHT or CENTER + * @param {(TOP|BOTTOM|CENTER)} yAlign either TOP, BOTTOM or CENTER * @param {Number} dx * @param {Number} dy * @param {Number} dw @@ -1010,9 +1010,9 @@ function _sAssign(sVal, iVal) { * rectangle * @param {Number} [sHeight] the height of the subsection of the * source image to draw into the destination rectangle - * @param {Constant} [fit] either CONTAIN or COVER - * @param {Constant} [xAlign] either LEFT, RIGHT or CENTER default is CENTER - * @param {Constant} [yAlign] either TOP, BOTTOM or CENTER default is CENTER + * @param {(CONTAIN|COVER)} [fit] either CONTAIN or COVER + * @param {(LEFT|RIGHT|CENTER)} [xAlign=CENTER] either LEFT, RIGHT or CENTER default is CENTER + * @param {(TOP|BOTTOM|CENTER)} [yAlign=CENTER] either TOP, BOTTOM or CENTER default is CENTER */ p5.prototype.image = function( img, @@ -1293,7 +1293,7 @@ p5.prototype._getTintedImageCanvas = * center. The next parameters are its width and height. * * @method imageMode - * @param {Constant} mode either CORNER, CORNERS, or CENTER. + * @param {(CORNER|CORNERS|CENTER)} mode either CORNER, CORNERS, or CENTER. * @example * *
    diff --git a/src/image/p5.Image.js b/src/image/p5.Image.js index 444bf5a67c..02a54fb953 100644 --- a/src/image/p5.Image.js +++ b/src/image/p5.Image.js @@ -823,7 +823,7 @@ p5.Image = class Image { * `DILATE` * Increases the light areas. No parameter is used. * - * @param {Constant} filterType either THRESHOLD, GRAY, OPAQUE, INVERT, + * @param {(THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|ERODE|DILATE|BLUR)} filterType either THRESHOLD, GRAY, OPAQUE, INVERT, * POSTERIZE, ERODE, DILATE or BLUR. * @param {Number} [filterParam] parameter unique to each filter. * @example @@ -982,7 +982,7 @@ p5.Image = class Image { * @param {Integer} dy y-coordinate of the destination's upper-left corner. * @param {Integer} dw destination image width. * @param {Integer} dh destination image height. - * @param {Constant} blendMode the blend mode. either + * @param {(BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL)} blendMode the blend mode. either * BLEND, DARKEST, LIGHTEST, DIFFERENCE, * MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, * SOFT_LIGHT, DODGE, BURN, ADD or NORMAL. @@ -1063,7 +1063,7 @@ p5.Image = class Image { * @param {Integer} dy * @param {Integer} dw * @param {Integer} dh - * @param {Constant} blendMode + * @param {(BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL)} blendMode */ blend(...args) { p5._validateParameters('p5.Image.blend', arguments); diff --git a/src/image/pixels.js b/src/image/pixels.js index fd3eb435fa..8fbd96353c 100644 --- a/src/image/pixels.js +++ b/src/image/pixels.js @@ -117,7 +117,7 @@ p5.prototype.pixels = []; * @param {Integer} dy y-coordinate of the destination's upper-left corner. * @param {Integer} dw destination image width. * @param {Integer} dh destination image height. - * @param {Constant} blendMode the blend mode. either + * @param {(BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL)} blendMode the blend mode. either * BLEND, DARKEST, LIGHTEST, DIFFERENCE, * MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT, * SOFT_LIGHT, DODGE, BURN, ADD or NORMAL. @@ -193,7 +193,7 @@ p5.prototype.pixels = []; * @param {Integer} dy * @param {Integer} dw * @param {Integer} dh - * @param {Constant} blendMode + * @param {(BLEND|DARKEST|LIGHTEST|DIFFERENCE|MULTIPLY|EXCLUSION|SCREEN|REPLACE|OVERLAY|HARD_LIGHT|SOFT_LIGHT|DODGE|BURN|ADD|NORMAL)} blendMode */ p5.prototype.blend = function(...args) { p5._validateParameters('blend', args); @@ -385,10 +385,10 @@ p5.prototype._copyHelper = ( * * * @method filter - * @param {Constant} filterType either THRESHOLD, GRAY, OPAQUE, INVERT, + * @param {(THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|BLUR|ERODE|DILATE|BLUR)} filterType either THRESHOLD, GRAY, OPAQUE, INVERT, * POSTERIZE, BLUR, ERODE, DILATE or BLUR. * @param {Number} [filterParam] parameter unique to each filter. - * @param {Boolean} [useWebGL] flag to control whether to use fast + * @param {Boolean} [useWebGL=true] flag to control whether to use fast * WebGL filters (GPU) or original image * filters (CPU); defaults to `true`. * @@ -559,9 +559,9 @@ p5.prototype.getFilterGraphicsLayer = function() { /** * @method filter - * @param {Constant} filterType + * @param {(THRESHOLD|GRAY|OPAQUE|INVERT|POSTERIZE|BLUR|ERODE|DILATE|BLUR)} filterType * @param {Number} [filterParam] - * @param {Boolean} [useWebGL] + * @param {Boolean} [useWebGL=true] */ /** * @method filter diff --git a/src/math/trigonometry.js b/src/math/trigonometry.js index 8771831a57..5029bf881d 100644 --- a/src/math/trigonometry.js +++ b/src/math/trigonometry.js @@ -375,7 +375,7 @@ function trigonometry(p5, fn){ * * Calling `angleMode()` with no arguments returns current angle mode. * @method angleMode - * @param {Constant} mode either RADIANS or DEGREES. + * @param {(RADIANS|DEGREES)} mode either RADIANS or DEGREES. * @example *
    * @@ -400,7 +400,7 @@ function trigonometry(p5, fn){ */ /** * @method angleMode - * @return {Constant} mode either RADIANS or DEGREES + * @return {(RADIANS|DEGREES)} mode either RADIANS or DEGREES */ fn.angleMode = function(mode) { p5._validateParameters('angleMode', arguments); diff --git a/src/typography/attributes.js b/src/typography/attributes.js index 9cd54050c4..2d3579733f 100644 --- a/src/typography/attributes.js +++ b/src/typography/attributes.js @@ -26,9 +26,9 @@ import p5 from '../core/main'; * or `BASELINE`. * * @method textAlign - * @param {Constant} horizAlign horizontal alignment, either LEFT, + * @param {(LEFT|CENTER|RIGHT)} horizAlign horizontal alignment, either LEFT, * CENTER, or RIGHT. - * @param {Constant} [vertAlign] vertical alignment, either TOP, + * @param {(TOP|BOTTOM|BASELINE|CENTER)} [vertAlign] vertical alignment, either TOP, * BOTTOM, CENTER, or BASELINE. * @chainable * @example @@ -158,7 +158,7 @@ p5.prototype.textSize = function(theSize) { * affect fonts loaded with loadFont(). * * @method textStyle - * @param {Constant} style styling for text, either NORMAL, + * @param {(NORMAL|ITALIC|BOLD|BOLDITALIC)} style styling for text, either NORMAL, * ITALIC, BOLD or BOLDITALIC * @chainable * @example @@ -384,7 +384,7 @@ p5.prototype._updateTextMetrics = function() { * Calling `textWrap()` without an argument returns the current style. * * @method textWrap - * @param {Constant} style text wrapping style, either WORD or CHAR. + * @param {(WORD|CHAR)} style text wrapping style, either WORD or CHAR. * @return {String} style * @example *
    diff --git a/src/webgl/interaction.js b/src/webgl/interaction.js index bc1df2badc..adafb646ad 100644 --- a/src/webgl/interaction.js +++ b/src/webgl/interaction.js @@ -526,12 +526,12 @@ p5.prototype.orbitControl = function( /** * @method debugMode - * @param {Constant} mode either GRID or AXES + * @param {(GRID|AXES)} mode either GRID or AXES */ /** * @method debugMode - * @param {Constant} mode + * @param {(GRID|AXES)} mode * @param {Number} [gridSize] size of one side of the grid * @param {Number} [gridDivisions] number of divisions in the grid * @param {Number} [xOff] X axis offset from origin (0,0,0) @@ -541,7 +541,7 @@ p5.prototype.orbitControl = function( /** * @method debugMode - * @param {Constant} mode + * @param {(GRID|AXES)} mode * @param {Number} [axesSize] size of axes icon * @param {Number} [xOff] * @param {Number} [yOff] diff --git a/src/webgl/material.js b/src/webgl/material.js index 854917c7de..25188d3064 100644 --- a/src/webgl/material.js +++ b/src/webgl/material.js @@ -680,7 +680,7 @@ p5.prototype.texture = function (tex) { * size of a quad would require the points (0,0) (100, 0) (100,200) (0,200). * The same mapping in NORMAL is (0,0) (1,0) (1,1) (0,1). * @method textureMode - * @param {Constant} mode either IMAGE or NORMAL + * @param {(IMAGE|NORMAL)} mode either IMAGE or NORMAL * @example *
    * @@ -767,8 +767,8 @@ p5.prototype.textureMode = function (mode) { * If only one argument is provided, it will be applied to both the * horizontal and vertical axes. * @method textureWrap - * @param {Constant} wrapX either CLAMP, REPEAT, or MIRROR - * @param {Constant} [wrapY] either CLAMP, REPEAT, or MIRROR + * @param {(CLAMP|REPEAT|MIRROR)} wrapX either CLAMP, REPEAT, or MIRROR + * @param {(CLAMP|REPEAT|MIRROR)} [wrapY=wrapX] either CLAMP, REPEAT, or MIRROR * @example *
    * diff --git a/translations/index.js b/translations/index.js index 772a52d739..1327f3eae2 100644 --- a/translations/index.js +++ b/translations/index.js @@ -20,6 +20,7 @@ export default { * If you have just added a new language (yay!), add its key to the list below * (`en` is english, `es` es espaƱol). Also add its export to * dev.js, which is another file in this folder. + * @private */ export const languages = [ 'en', diff --git a/utils/convert.js b/utils/convert.js index 28a0457090..3a98f612ba 100644 --- a/utils/convert.js +++ b/utils/convert.js @@ -229,8 +229,8 @@ function getParams(entry) { // Constants // ============================================================================ for (const entry of allData) { - if (entry.kind === 'constant') { - constUsage[entry.name] = new Set(); + if (entry.kind === 'constant' || entry.kind === 'typedef') { + constUsage[entry.name] = constUsage[entry.name] || new Set(); const { module, submodule, forEntry } = getModuleInfo(entry);